Merge branch 'feature/mall_product'

pull/2/head^2
tangqian 2023-05-29 15:00:19 +08:00
commit a9d141e2dc
17 changed files with 184 additions and 24 deletions

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.shop.request.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Title:MemberChangeTieRequest
* @Description: TODO
* @author: tangqian
* @date: 2023/5/29 14:47
* @version: V1.0.0
*/
@Data
public class MemberChangeTieRequest implements Serializable {
private static final long serialVersionUID = -7173209981786890536L;
@Schema(description = "推广员id")
@NotNull(message = "推广员id不能为空")
private Long promoterId;
}

View File

@ -24,6 +24,9 @@ import java.util.List;
@Schema(description="会员充值下单请求入参") @Schema(description="会员充值下单请求入参")
public class OrderContentRequest implements Serializable { public class OrderContentRequest implements Serializable {
private static final long serialVersionUID = -9170167938995005780L; private static final long serialVersionUID = -9170167938995005780L;
@Schema(description = "用户姓名")
private String userName;
@Schema(description = "用户电话") @Schema(description = "用户电话")
private String userPhone; private String userPhone;
@ -37,6 +40,7 @@ public class OrderContentRequest implements Serializable {
@NotEmpty(message = "支付类型不能为空") @NotEmpty(message = "支付类型不能为空")
private String payType; private String payType;
@Schema(description = "订单信息") @Schema(description = "订单信息")
private List<OrderInfo> orderInfos; private List<OrderInfo> orderInfos;
@Data @Data

View File

@ -70,4 +70,5 @@ public class CreateOrderRequest implements Serializable {
@Schema(description = "手机号码") @Schema(description = "手机号码")
private String phone; private String phone;
} }

View File

@ -43,6 +43,7 @@ public class OrderPayResultResponse {
@Schema(description ="支付宝返回参数") @Schema(description ="支付宝返回参数")
private String body; private String body;
// //
// @Schema(description = "支付宝调起支付参数对象app支付专用") // @Schema(description = "支付宝调起支付参数对象app支付专用")
// private AliPayJsResultVo aliPayConfig; // private AliPayJsResultVo aliPayConfig;

View File

@ -369,4 +369,8 @@ public class StoreOrderDetailInfoResponse implements Serializable {
// private SystemStore systemStore; // private SystemStore systemStore;
// private String mapKey; // private String mapKey;
// private String statusPic; // private String statusPic;
@Schema(description ="倒计时")
private long countDownTime;
} }

View File

@ -11,6 +11,8 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRe
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO; import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert; import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
import cn.iocoder.yudao.module.shop.request.order.CreateOrderRequest;
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse; import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService; import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService;
@ -20,6 +22,8 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -42,6 +46,7 @@ public class MemberController {
@Autowired @Autowired
private RechargeOrderService rechargeOrderService; private RechargeOrderService rechargeOrderService;
// 会员档次信息列表 // 会员档次信息列表
@Operation(summary = "会员档次信息") @Operation(summary = "会员档次信息")
@RequestMapping(value = "/memberGradeInfo", method = RequestMethod.GET) @RequestMapping(value = "/memberGradeInfo", method = RequestMethod.GET)
@ -99,4 +104,13 @@ public class MemberController {
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfoByPhone(@RequestParam String phone) { public CommonResult<List<RechargeOrderRespVO>> memberOrderInfoByPhone(@RequestParam String phone) {
return CommonResult.success(rechargeOrderService.memberOrderInfoByPhone(phone)); return CommonResult.success(rechargeOrderService.memberOrderInfoByPhone(phone));
} }
@Operation(summary = "会员换绑")
@RequestMapping(value = "/memberChangeTie", method = RequestMethod.POST)
@PreAuthenticated
@TenantIgnore
public CommonResult<Boolean> memberChangeTie(@Validated @RequestBody MemberChangeTieRequest changeTieRequest) {
return CommonResult.success(rechargeOrderService.memberChangeTie(changeTieRequest));
}
} }

View File

@ -207,4 +207,16 @@ public class StoreOrder implements Serializable {
@Schema(description = "商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号") @Schema(description = "商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号")
private String outTradeNo; private String outTradeNo;
/**
* 广id
*/
private Long promoterId;
/**
* id
*/
private Long deptId;
} }

View File

@ -91,4 +91,14 @@ public class StoreOrderInfo implements Serializable {
@Schema(description = "商品类型:0-普通1-秒杀2-砍价3-拼团4-视频号") @Schema(description = "商品类型:0-普通1-秒杀2-砍价3-拼团4-视频号")
private Integer productType; private Integer productType;
/**
* 广id
*/
private Long promoterId;
/**
* id
*/
private Long deptId;
} }

View File

@ -45,9 +45,12 @@ import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List; import java.util.List;
@ -403,4 +406,13 @@ public class OrderPayServiceImpl implements OrderPayService {
return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); return localDateTime.format(DateTimeFormatter.ofPattern(pattern));
} }
public static void main(String[] args) {
System.out.println(formatLocalDateTime(LocalDateTime.now().plusMinutes(30),"yyyyMMddHHmmss"));
LocalDateTime localDateTime = LocalDateTime.now().plusMinutes(30);
long l = localDateTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
LocalDateTime a = Instant.ofEpochMilli(l).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
System.out.println(l);
System.out.println(a);
}
} }

View File

@ -10,12 +10,16 @@ import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
import cn.iocoder.yudao.module.member.api.address.AddressApi; import cn.iocoder.yudao.module.member.api.address.AddressApi;
import cn.iocoder.yudao.module.member.api.address.UserAddressApi; import cn.iocoder.yudao.module.member.api.address.UserAddressApi;
import cn.iocoder.yudao.module.member.api.address.dto.UserAddressRespDTO; import cn.iocoder.yudao.module.member.api.address.dto.UserAddressRespDTO;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
import cn.iocoder.yudao.module.shop.constants.PayConstants; import cn.iocoder.yudao.module.shop.constants.PayConstants;
import cn.iocoder.yudao.module.shop.constants.SysConfigConstants; import cn.iocoder.yudao.module.shop.constants.SysConfigConstants;
import cn.iocoder.yudao.module.shop.convert.order.StoreOrderConvert; import cn.iocoder.yudao.module.shop.convert.order.StoreOrderConvert;
@ -51,6 +55,8 @@ import cn.iocoder.yudao.module.shop.vo.order.OrderInfoVo;
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo; import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoVo; import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoVo;
import cn.iocoder.yudao.module.shop.vo.product.MyRecord; import cn.iocoder.yudao.module.shop.vo.product.MyRecord;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -64,6 +70,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -146,6 +153,12 @@ public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private StoreProductAttrValueService storeProductAttrValueService; private StoreProductAttrValueService storeProductAttrValueService;
@Autowired
private MemberUserApi userService;
@Autowired
private DeptApi deptApi;
/** /**
* *
* *
@ -1158,7 +1171,16 @@ public class OrderServiceImpl implements OrderService {
} }
String orderVoString = redisUtil.get(key).toString(); String orderVoString = redisUtil.get(key).toString();
OrderInfoVo orderInfoVo = JSONUtil.toBean(orderVoString, OrderInfoVo.class); OrderInfoVo orderInfoVo = JSONUtil.toBean(orderVoString, OrderInfoVo.class);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!");
// 获取组织id
PromoterDTO promoterDTO = userService.getPromoterDOByUserId(user.getId());
Long tenantId = TenantContextHolder.getTenantId();
Long deptId = promoterDTO.getDeptId();
if (deptId == null) {
DeptRespDTO deptRespDTO = deptApi.findParentDept(tenantId);
deptId = deptRespDTO.getId();
}
// 检测支付方式 // 检测支付方式
if (!orderUtil.checkPayType(orderRequest.getPayType())) throw new ServiceException("暂不支持该支付方式,请刷新页面或者联系管理员"); if (!orderUtil.checkPayType(orderRequest.getPayType())) throw new ServiceException("暂不支持该支付方式,请刷新页面或者联系管理员");
@ -1248,6 +1270,8 @@ public class OrderServiceImpl implements OrderService {
soInfo.setPayNum(detailVo.getPayNum()); soInfo.setPayNum(detailVo.getPayNum());
soInfo.setWeight(detailVo.getWeight()); soInfo.setWeight(detailVo.getWeight());
soInfo.setVolume(detailVo.getVolume()); soInfo.setVolume(detailVo.getVolume());
soInfo.setPromoterId(user.getPromoterId());
soInfo.setDeptId(deptId);
if (ObjectUtil.isNotNull(detailVo.getGiveIntegral()) && detailVo.getGiveIntegral() > 0) { if (ObjectUtil.isNotNull(detailVo.getGiveIntegral()) && detailVo.getGiveIntegral() > 0) {
soInfo.setGiveIntegral(detailVo.getGiveIntegral()); soInfo.setGiveIntegral(detailVo.getGiveIntegral());
} else { } else {
@ -1334,6 +1358,8 @@ public class OrderServiceImpl implements OrderService {
storeOrder.setPaid(false); storeOrder.setPaid(false);
storeOrder.setCost(BigDecimal.ZERO); storeOrder.setCost(BigDecimal.ZERO);
storeOrder.setType(0); storeOrder.setType(0);
storeOrder.setPromoterId(user.getPromoterId());
storeOrder.setDeptId(deptId);
if (orderInfoVo.getIsVideo()) { if (orderInfoVo.getIsVideo()) {
storeOrder.setType(1);// 视频号订单 storeOrder.setType(1);// 视频号订单
} }

View File

@ -159,6 +159,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
private RechargeGearService rechargeGearService; private RechargeGearService rechargeGearService;
@Autowired @Autowired
private StoreOrderMapper storeOrderMapper; private StoreOrderMapper storeOrderMapper;
/** /**
* PC * PC
* *
@ -1285,6 +1286,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
String s = "MEMBER_1661994584871321602"; String s = "MEMBER_1661994584871321602";
System.out.println(s.contains("MEMBER_")); System.out.println(s.contains("MEMBER_"));
} }
public void addPhoneRecord(RechargeOrderDO orderDO, String orderId) { public void addPhoneRecord(RechargeOrderDO orderDO, String orderId) {
List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId)); List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId));
List<PhoneRecordDO> recordDOS = new ArrayList<>(); List<PhoneRecordDO> recordDOS = new ArrayList<>();
@ -1524,7 +1526,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
MemberUserRespDTO userByMobile = userService.getUserByMobile(request.getUserPhone()); MemberUserRespDTO userByMobile = userService.getUserByMobile(request.getUserPhone());
// 初始化一个账号 // 初始化一个账号
if (Objects.isNull(userByMobile)) { if (Objects.isNull(userByMobile)) {
userService.saveMemberUser(request.getUserPhone(), user.getPromoterId()); userService.saveMemberUser(request.getUserPhone(), user.getPromoterId(), request.getUserName());
} }
} }
} }

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO; import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse; import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -83,4 +84,6 @@ public interface RechargeOrderService {
MemberHeadResponse memberHeadInfo(); MemberHeadResponse memberHeadInfo();
List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone); List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone);
Boolean memberChangeTie(MemberChangeTieRequest changeTieRequest);
} }

View File

@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO; import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest; import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse; import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
import cn.iocoder.yudao.module.system.api.tenant.TenantApi; import cn.iocoder.yudao.module.system.api.tenant.TenantApi;
@ -61,9 +62,8 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
private MemberUserApi userService; private MemberUserApi userService;
@Resource @Resource
private PhoneRecordService phoneRecordService; private PhoneRecordService phoneRecordService;
@Resource @Autowired
private MemberUserApi memberUserApi; private MemberUserApi memberUserApi;
@Resource @Resource
private TenantApi tenantApi; private TenantApi tenantApi;
@ -284,4 +284,13 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
return null; return null;
} }
@Override
public Boolean memberChangeTie(MemberChangeTieRequest changeTieRequest) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!");
MemberUserRespDTO user = userService.getUser(loginUser.getId());
user.setPromoterId(changeTieRequest.getPromoterId());
return memberUserApi.updateById(user)>0;
}
} }

View File

@ -81,7 +81,7 @@ public interface MemberUserApi {
MemberUserRespDTO getInfo(); MemberUserRespDTO getInfo();
void saveMemberUser(String phone,Long promoterId); void saveMemberUser(String phone,Long promoterId,String userName);
PromoterDTO getPromoterDOByUserId(Long userId); PromoterDTO getPromoterDOByUserId(Long userId);

View File

@ -108,11 +108,11 @@ public class MemberUserApiImpl implements MemberUserApi {
} }
@Override @Override
public void saveMemberUser(String phone,Long promoterId) { public void saveMemberUser(String phone,Long promoterId,String userName) {
AppAuthSmsLoginReqVO reqVO = new AppAuthSmsLoginReqVO(); AppAuthSmsLoginReqVO reqVO = new AppAuthSmsLoginReqVO();
reqVO.setMobile(phone); reqVO.setMobile(phone);
reqVO.setPromoterId(promoterId); reqVO.setPromoterId(promoterId);
reqVO.setRealName("初始化账号"); reqVO.setRealName(userName);
authService.initialize(reqVO); authService.initialize(reqVO);
} }

View File

@ -8,8 +8,8 @@
</view> </view>
<view class="count-down"> <view class="count-down">
支付剩余时间 支付剩余时间
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''" :minute-text="' : '" <countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''"
:second-text="' '" :datatime="invalidTime"></countDown> :minute-text="' : '" :second-text="' '" :datatime="invalidTime"></countDown>
</view> </view>
</view> </view>
<view class="payment"> <view class="payment">
@ -33,15 +33,15 @@
</view> </view>
<view class="btn"> <view class="btn">
<view class="button acea-row row-center-wrapper pay-button" @click='goPay'>确认支付</view> <view class="button acea-row row-center-wrapper pay-button" @click='goPay'>确认支付</view>
<view class="wait-pay" @click="waitPay"></view> <view class="wait-pay" @click="cancelPayModalShow = true">暂不支</view>
</view> </view>
<view v-show="false" v-html="formContent"></view> <view v-show="false" v-html="formContent"></view>
<u-modal :show="cancelPayModalShow" width="519rpx"> <u-modal :show="cancelPayModalShow" width="519rpx">
<view class="modal-wrap"> <view class="modal-wrap">
<view class="count-down"> <view class="count-down">
支付剩余时间 支付剩余时间
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''" :minute-text="' : '" <countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''"
:second-text="' '" :datatime="invalidTime"></countDown> :minute-text="' : '" :second-text="' '" :datatime="invalidTime"></countDown>
</view> </view>
<view class="model-content">确认要放弃付款吗</view> <view class="model-content">确认要放弃付款吗</view>
</view> </view>
@ -53,7 +53,7 @@
</view> </view>
</u-modal> </u-modal>
<!-- 支付宝支付链接复制组件 --> <!-- 支付宝支付链接复制组件 -->
<alipay-link-copy :show.sync="alipayShow" :alipayLink="alipayLink"/> <alipay-link-copy :show.sync="alipayShow" :alipayLink="alipayLink" @confirm="onConfirm" />
</view> </view>
</template> </template>
@ -76,9 +76,11 @@
data() { data() {
return { return {
cancelPayModalShow: false, cancelPayModalShow: false,
backPayModalShow: true,
alipayShow: false, alipayShow: false,
alipayLink: '', alipayLink: '',
checked: false, checked: false,
isClickGiveUpBtn: true,
// //
cartArr: [{ cartArr: [{
"name": '微信支付', "name": '微信支付',
@ -95,6 +97,7 @@
payStatus: 1, payStatus: 1,
} }
], ],
paytype: 'WXPAY',
orderId: 0, orderId: 0,
active: 0, active: 0,
payPrice: 10.00, payPrice: 10.00,
@ -113,7 +116,8 @@
}, },
onShow() { onShow() {
let options = wx.getEnterOptionsSync(); let options = wx.getEnterOptionsSync();
console.log(options) window.history.pushState(null, null, document.url)
window.addEventListener('popstate', this.backShowPayModal)
/* /*
if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) { if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) {
// //
@ -153,10 +157,25 @@
} }
}*/ }*/
}, },
onHide() {
window.removeEventListener('popstate', this.backShowPayModal)
},
onUnload() {
window.removeEventListener('popstate', this.backShowPayModal)
},
methods: { methods: {
backShowPayModal() {
this.isClickGiveUpBtn = false
this.cancelPayModalShow = this.backPayModalShow
},
onGiveUpPay() { onGiveUpPay() {
if (this.isClickGiveUpBtn) {
window.history.back()
}
this.cancelPayModalShow = false this.cancelPayModalShow = false
// uni.navigateBack() uni.navigateBack({
delta: 1
})
}, },
getCashierOrder() { getCashierOrder() {
uni.showLoading({ uni.showLoading({
@ -164,6 +183,7 @@
}); });
getOrderDetail(this.orderId).then(res => { getOrderDetail(this.orderId).then(res => {
const orderInfo = res.data const orderInfo = res.data
this.invalidTime = new Date(res.data.endTime).getTime()
this.payPrice = parseFloat(orderInfo.proTotalPrice).toFixed(2) this.payPrice = parseFloat(orderInfo.proTotalPrice).toFixed(2)
this.payPriceShow = parseFloat(orderInfo.proTotalPrice).toFixed(2) this.payPriceShow = parseFloat(orderInfo.proTotalPrice).toFixed(2)
}).catch(err => { }).catch(err => {
@ -176,12 +196,28 @@
this.active = index; this.active = index;
this.paytype = paytype; this.paytype = paytype;
}, },
waitPay() { onConfirm() {
this.cancelPayModalShow = true let that = this
// uni.reLaunch({ uni.showModal({
// url: '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=&type=3' + title: '提示',
// '&status=2&totalPrice=' + this.payPriceShow content: '您是否已支付?',
// }) cancelText: '未支付',
confirmText: '已支付',
success: function(res) {
if (res.confirm) {
// popstate
that.backPayModalShow = false
window.history.back()
setTimeout(()=>{
uni.redirectTo({
url: '/pages/users/order_list/index'
})
}, 200)
} else if (res.cancel) {
}
}
});
}, },
goPay() { goPay() {
let that = this; let that = this;
@ -205,6 +241,9 @@
}, },
wxPaySuccess: () => { wxPaySuccess: () => {
// window.location.reload() // window.location.reload()
uni.redirectTo({
url: '/pages/users/order_list/index'
})
}, },
aliPaySuccess: (link) => { aliPaySuccess: (link) => {
that.alipayLink = link that.alipayLink = link
@ -224,6 +263,7 @@
.count-down .time { .count-down .time {
margin-left: 10rpx; margin-left: 10rpx;
} }
.modal-btn-wrap { .modal-btn-wrap {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -251,7 +291,7 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
.count-down{ .count-down {
display: flex; display: flex;
justify-content: center; justify-content: center;
font-size: 32rpx; font-size: 32rpx;

View File

@ -293,7 +293,7 @@
preOrderNo: '' // preOrderNo: '' //
}; };
}, },
computed: mapGetters(['isLogin', 'systemPlatform', 'productType']), computed: mapGetters(['isLogin', 'systemPlatform', 'productType', 'tenantId']),
watch: { watch: {
isLogin: { isLogin: {
handler: function(newV, oldV) { handler: function(newV, oldV) {
@ -628,7 +628,7 @@
}, },
getOrderPay: function(orderNo, message) { getOrderPay: function(orderNo, message) {
let that = this; let that = this;
uni.navigateTo({ uni.redirectTo({
url: '/pages/goods_cashier/index?order_id=' + orderNo url: '/pages/goods_cashier/index?order_id=' + orderNo
}) })
// wechatOrderPay({ // wechatOrderPay({