Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product

pull/2/head
TianYu 2023-05-19 16:13:26 +08:00
commit d75d571637
17 changed files with 388 additions and 141 deletions

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.shop.request.member;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* @Title:AlipayNotifyParamRequest
* @Description: TODO
* @author: tangqian
* @date: 2023/5/19 10:27
* @version: V1.0.0
*/
@Data
@Accessors(chain = true)
public class AlipayNotifyParamRequest implements Serializable {
private static final long serialVersionUID = 5839750515063699319L;
private String appId;
private String tradeNo; // 支付宝交易凭证号
private String outTradeNo; // 原支付请求的商户订单号
private String outBizNo; // 商户业务ID主要是退款通知中返回退款申请的流水号
private String buyerId; // 买家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字
private String buyerLogonId; // 买家支付宝账号
private String sellerId; // 卖家支付宝用户号
private String sellerEmail; // 卖家支付宝账号
private String tradeStatus; // 交易目前所处的状态,见交易状态说明
private String totalAmount; // 本次交易支付的订单金额
private String receiptAmount; // 商家在交易中实际收到的款项
private String buyerPayAmount; // 用户在交易中支付的金额
private String refundFee; // 退款通知中,返回总退款金额,单位为元,支持两位小数
private String subject; // 商品的标题/交易标题/订单标题/订单关键字等
private String body; // 该订单的备注、描述、明细等。对应请求时的body参数原样通知回来
private Date gmtCreate; // 该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss
private Date gmtPayment; // 该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss
private Date notifyTime; // 通知时间。格式为yyyy-MM-dd HH:mm:ss
private Date gmtRefund; // 该笔交易的退款时间。格式为yyyy-MM-dd HH:mm:ss.S
private Date gmtClose; // 该笔交易结束时间。格式为yyyy-MM-dd HH:mm:ss
private String fundBillList; // 支付成功的各个渠道金额信息,array
private String passbackParams; // 公共回传参数,如果请求时传递了该参数,则返回给商户时会在异步通知时将该参数原样返回。
private String authAppId;
private String notifyId;
private String notifyType;
private String version;
private String invoiceAmount;//交易中可给用户开具发票的金额
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.controller.admin.notify;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
import com.alipay.api.AlipayApiException;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
@ -31,12 +34,13 @@ public class AliPayNotifyController {
@PermitAll
@PostMapping("pay_notify")
public Object payNotify(HttpServletRequest request, Map<String, String> params) {
return storeOrderService.aliNotify(request, params);
public Object payNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException {
return storeOrderService.aliNotify(request, response);
}
@PermitAll
@PostMapping("refund_notify")
public Object refundNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return storeOrderService.refundNotify(request, params);
public Object refundNotify(HttpServletRequest request, HttpServletResponse response) {
return storeOrderService.refundNotify(request, response);
}
}

View File

@ -15,6 +15,10 @@ public class RechargeOrderRespVO extends RechargeOrderBaseVO {
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "创建时间")
private String stringCreateTime;
@Schema(description = "档次")
private String grade;
@Schema(description = "组织名称")
private String parentOrganizationName;
@Schema(description = "推广员名称")

View File

@ -50,8 +50,7 @@ public class MemberController {
@RequestMapping(value = "/memberOrderInfo", method = RequestMethod.GET)
@PreAuthenticated
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfo() {
List<RechargeOrderDO> orderDOS = rechargeOrderService.memberOrderInfo();
return CommonResult.success(RechargeOrderConvert.INSTANCE.convertList(orderDOS));
return CommonResult.success(rechargeOrderService.memberOrderInfo());
}
@Operation(summary = "会员头部信息")
@RequestMapping(value = "/memberHeadInfo", method = RequestMethod.GET)

View File

@ -71,7 +71,7 @@ public class RechargeOrderDO extends BaseDO {
/**
*
*/
private Byte paid;
private Integer paid;
/**
*
*/
@ -91,7 +91,7 @@ public class RechargeOrderDO extends BaseDO {
/**
* 0 退 1 2 退 3 退
*/
private Byte refundStatus;
private Integer refundStatus;
/**
* 退
*/
@ -131,11 +131,11 @@ public class RechargeOrderDO extends BaseDO {
/**
* (012)
*/
private Byte isChannel;
private Integer isChannel;
/**
*
*/
private Byte isRemind;
private Integer isRemind;
/**
*
*/

View File

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.shop.response.member.ChangeOrderPayTypeResponse;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import cn.iocoder.yudao.module.shop.response.order.*;
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
import com.github.binarywang.wxpay.exception.WxPayException;
@ -391,14 +392,13 @@ public interface StoreOrderService extends IService<StoreOrder> {
/**
*
* @param request
* @param params
* @return
*/
Object aliNotify(HttpServletRequest request, Map<String, String> params);
Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException;
Object memberRefund(RefundRequest request, HttpServletRequest servletRequest);
Object refundNotify(HttpServletRequest request, Map<String, String> params);
Object refundNotify(HttpServletRequest request, HttpServletResponse response);
Boolean wxPayNotify(WxPayOrderNotifyV3Result.DecryptNotifyResult result);

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.shop.service.order.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
import cn.iocoder.yudao.module.shop.request.member.AlipayNotifyParamRequest;
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
@ -41,9 +43,7 @@ import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService;
import cn.iocoder.yudao.module.shop.support.StrategySupport;
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
import cn.iocoder.yudao.module.shop.utils.CommonPage;
import cn.iocoder.yudao.module.shop.utils.OrderUtil;
import cn.iocoder.yudao.module.shop.utils.RedisUtil;
import cn.iocoder.yudao.module.shop.utils.*;
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
@ -74,6 +74,10 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
@ -134,7 +138,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
@Autowired
private ExpressService expressService;
@Autowired
private WxMpService wxMpService;
@ -1163,36 +1167,40 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
}
@Override
public Object aliNotify(HttpServletRequest request, Map<String, String> params) {
boolean verifyResult = false;
try {
Map<String, String[]> map = request.getParameterMap();
verifyResult = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
log.debug("支付宝验证签名结果:{}", verifyResult);
} catch (AlipayApiException e) {
e.printStackTrace();
public Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException {
Map<String, String> params = new HashMap<String, String>();
Map requestParams = request.getParameterMap();
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String[] values = (String[]) requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
/** 乱码解决,这段代码在出现乱码时使用 **/
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
params.put(name, valueStr);
}
if (verifyResult) {
boolean flag = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
log.debug("支付宝验证签名结果:{}", flag);
if (flag) {
log.info("ALIPAY====MAP===>{}", params);
String orderId = params.get("out_trade_no");
String amount = params.get("refund_amount");
String total_amount = params.get("total_amount");
log.info("orderId:{}", orderId);
log.info("amount:{}", amount);
log.info("amount:{}", total_amount);
// 处理相关逻辑
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
if (Objects.isNull(orderDO)) {
log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId);
return "failure";
}
// 验证相关参数-金额
String amount = params.get("receipt_amount");
if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) {
log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount);
return "failure";
}
// 修改订单状态
orderDO.setPaid((byte) 1);
orderDO.setPaid(1);
orderDO.setPaySerialNumber(params.get("trade_no"));
rechargeOrderMapper.updateById(orderDO);
// 写入 充值档位记录表
addPhoneRecord(orderDO, orderId);
@ -1244,28 +1252,32 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
}
@Override
public Object refundNotify(HttpServletRequest request, Map<String, String> params) {
String tradeNo = params.get("trade_no"); // 支付宝交易号
String outTradeNo = params.get("out_trade_no"); // 商户订单号
String refundAmount = params.get("refund_amount"); // 退款金额
String tradeStatus = params.get("trade_status");
log.info("tradeStatus:{}", tradeStatus);
log.info("tradeNo:{}", tradeNo);
log.info("outTradeNo:{}", outTradeNo);
log.info("refundAmount:{}", refundAmount);
// 2. 验证回调签名
Map<String, String> paramMap = new HashMap<>(params);
paramMap.remove("sign_type"); // 移除sign_type参数
public Object refundNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> params = new HashMap<String, String>();
Map requestParams = request.getParameterMap();
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String[] values = (String[]) requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
/** 乱码解决,这段代码在出现乱码时使用 **/
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
params.put(name, valueStr);
}
params.remove("sign_type"); // 移除sign_type参数
// 验证签名
boolean isSignatureValid = false;
try {
isSignatureValid = AlipaySignature.rsaCheckV1(paramMap, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
isSignatureValid = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
} catch (AlipayApiException e) {
e.printStackTrace();
}
log.info("支付宝退款回调验证结果{}", isSignatureValid);
if (isSignatureValid) {
if ("TRADE_SUCCESS".equals(tradeStatus)) {
if ("TRADE_SUCCESS".equals("")) {
// 处理相关逻辑
// 验证相关参数-金额
// 修改订单状态
@ -1288,7 +1300,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
// 验证相关参数-金额
String outTradeNo = result.getOutTradeNo();
// 用户支付金额
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal()+"","100",2);
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2);
// 处理相关逻辑
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
@ -1296,7 +1308,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
return Boolean.FALSE;
}
// 修改订单状态
orderDO.setPaid((byte) 1);
orderDO.setPaid(1);
orderDO.setPaySerialNumber(result.getTransactionId());
rechargeOrderMapper.updateById(orderDO);
// 写入 充值档位记录表
addPhoneRecord(orderDO, outTradeNo);
@ -1308,7 +1321,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
@Override
public Boolean memberApplyRefund(RefundRequest request) {
RechargeOrderDO orderDO = rechargeOrderMapper.selectById(request.getOrderId());
orderDO.setRefundStatus((byte) 1);
orderDO.setRefundStatus(1);
return rechargeOrderMapper.updateById(orderDO) > 0;
}
@ -1566,6 +1579,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
// MyRecord myRecord = onePassService.expressDump(record);
// storeOrder.setDeliveryId(myRecord.getStr("kuaidinum"));
// }
/**
*
*/
@ -1576,7 +1590,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
}
if (StrUtil.isBlank(request.getExpressCode())) throw new ServiceException("请选择快递公司");
if (StrUtil.isBlank(request.getExpressRecordType())) throw new ServiceException("请选择发货记录类型");
// if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
// if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
if (StrUtil.isBlank(request.getToName())) throw new ServiceException("请填写寄件人姓名");
if (StrUtil.isBlank(request.getToTel())) throw new ServiceException("请填写寄件人电话");
if (StrUtil.isBlank(request.getToAddr())) throw new ServiceException("请填写寄件人地址");

View File

@ -68,7 +68,7 @@ public interface RechargeOrderService {
*/
List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO);
List<RechargeOrderDO> memberOrderInfo();
List<RechargeOrderRespVO> memberOrderInfo();
MemberHeadResponse memberHeadInfo();
}

View File

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.shop.service.recharge;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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.response.member.MemberHeadResponse;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -14,7 +16,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
@ -37,6 +41,8 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
@Resource
private RechargeOrderMapper rechargeOrderMapper;
@Resource
private RechargeOrderInfoMapper infoMapper;
@Override
public Integer createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
@ -93,10 +99,36 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
}
@Override
public List<RechargeOrderDO> memberOrderInfo() {
public List<RechargeOrderRespVO> memberOrderInfo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!");
return rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()));
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery()
.eq(RechargeOrderDO::getUid, loginUser.getId()).eq(RechargeOrderDO::getPaid, 1));
if (!CollectionUtils.isEmpty(orderDOS)) {
List<RechargeOrderRespVO> rechargeOrderRespVOS = RechargeOrderConvert.INSTANCE.convertList(orderDOS);
List<String> collect1 = rechargeOrderRespVOS.stream().map(RechargeOrderBaseVO::getOrderId).collect(Collectors.toList());
List<RechargeOrderInfoDO> infoDOS = infoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().in(RechargeOrderInfoDO::getOrderNo, collect1));
Map<String, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getOrderNo));
for (RechargeOrderRespVO orderDO : rechargeOrderRespVOS) {
StringBuilder grade = new StringBuilder();
List<RechargeOrderInfoDO> infoDOS1 = collect.get(orderDO.getOrderId());
for (RechargeOrderInfoDO infoDO : infoDOS1) {
if (infoDO.getPrice().compareTo(new BigDecimal("240")) == 0) {
grade.append("套餐1,");
} else if (infoDO.getPrice().compareTo(new BigDecimal("400")) == 0) {
grade.append("套餐2,");
} else if (infoDO.getPrice().compareTo(new BigDecimal("640")) == 0) {
grade.append("套餐3");
}
}
orderDO.setGrade(grade.toString());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
orderDO.setStringCreateTime(orderDO.getCreateTime().format(formatter));
}
return rechargeOrderRespVOS;
}
return null;
}
@Override

View File

@ -200,16 +200,17 @@ wx:
key-path: classpath:/2/apiclient_cert.p12
cert-serial-no: 47F04D51F958FFEF56A6DFC25BDE83CF89353E19
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
refund-notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/refund_notify
refund-notify-url: http://yuxy.perrymake.com/admin-api/pay/wxpay/refund_notify
--- #################### 芋道相关配置 ####################
ali:
pay:
one:
appId: 2021003196623046
merchantPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSj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0CoMVTKDIR7XunSJZqfOZTihLXD8GbqMFTMPRyuh/JNCHoeDfDhca2nD6hyVOLE7XqZK8gVq9WgUM8uVkXDHJJfPHFmQaU8jJt3pyuItsVi1id8vJvHdng/rFy0USPwSq9kVv9DaIxI2197UBvjtyt4iTTYE5esOiJeulUggwmpWoss7Cx2fbN0pLVors+DybJGZjEW3GdwL+R6FStvQNAVcIf2Ty/NgKwIDAQAB
gatewayUrl: https://openapi.alipay.com/gateway.do
notify-url: http://yuxy.perrymake.com/admin-api/notify/ali/pay_notify
refund-notify: http://yuxy.perrymake.com/admin-api/notify/ali/refund_notify
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
captcha:

View File

@ -31,8 +31,8 @@
id: 0
},
onLaunch: function(option) {
const res = memberGradeInfo().then((res) => {
if (res.data.some((item) => !!!parseInt(item.isExist))) {
const res = memberGradeInfo().then((res) =>{
if(res.data.some((item) => !!parseInt(item.isExist))){
uni.setTabBarItem({
index: 2,
text: 'text',

View File

@ -5,19 +5,26 @@ import request from "@/utils/request.js";
* 查询会员档次信息
*/
export function memberGradeInfo(){
return request.get('api/order/member/memberGradeInfo', {},{noAuth:true})
return request.get('api/order/member/memberGradeInfo', {})
}
/**
* 获取当前登录账号的充值记录
*/
export function memberOrderInfo(){
return request.get('api/order/member/memberOrderInfo', {},{noAuth:true})
return request.get('api/order/member/memberOrderInfo', {})
}
/**
* 会员充值
*/
export function memberTopUp(data) {
return request.post('api/order/member/memberTopUp',data,{ noAuth: true });
return request.post('api/order/member/memberTopUp',data);
}
/**
* 申请退款
*/
export function memberApplyRefund(data) {
return request.post('api/order/member/memberApplyRefund',data);
}

View File

@ -38,6 +38,12 @@
<paymentMember :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :payInfo="payInfo">
</paymentMember>
<button class="box-submit" @click="goPay"></button>
<u-navbar leftIcon="" title="会员申请">
<view class="u-nav-slot" slot="right">
<u-icon name="more-dot-fill" size="50" @click="show = true"></u-icon>
<u-action-sheet @select="handleSelect" :actions="list" :title="title" :show="show" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="show=false" :safeAreaInsetBottom="true"></u-action-sheet>
</view>
</u-navbar>
</view>
</template>
@ -54,6 +60,18 @@
},
data() {
return {
title:'管理',
list: [
{
name:'购买记录',
fontSize:'28'
},
{
name:'为他人充值',
fontSize:'28'
},
],
show: false,
memberData: [],
payInfo: {
userPhone: '',
@ -82,18 +100,27 @@
};
},
async onLoad() {
// uni.setTabBarItem({
// index: 2,
// text: 'text',
// pagePath: '/pages/member_equity/index'
// })
// uni.switchTab({
// url:'/pages/member_equity/index'
// })
const res = await memberGradeInfo()
this.memberData = res.data
},
methods: {
handleSelect(value){
switch (value.name){
case "购买记录":
uni.navigateTo({
url:'/pages/member_record/index'
})
break;
case "为他人充值":
console.log(123)
uni.navigateTo({
url:'/pages/member_others/index'
})
break;
default:
break;
}
},
handleMember(value, index) {
if (!!parseInt(value.isExist)) return
if (this.activeIndex.includes(index)) {
@ -119,6 +146,10 @@
userPhone: store.state.app.userInfo.mobile,
orderInfos
}
}else{
this.$util.Tips({
title: '请选择档次套餐'
})
}
},
/**
@ -168,6 +199,7 @@
<style lang="scss" scoped>
.box {
margin-top: 10%;
position: relative;
padding: 207rpx 40rpx 30rpx 40rpx;
min-height: 100vh;
@ -176,6 +208,10 @@
background-repeat: no-repeat;
background-attachment: fixed;
::v-deep .u-popup__content{
margin-bottom: 11%;
}
.phone-money {
width: 604rpx;
height: 140rpx;

View File

@ -10,17 +10,17 @@
<text>再升1级即可获得XX等6项权益</text>
</view>
<view class="member-right">
<image src='../../static/images/vipStar.png'></image>
<text >会员等级3级</text>
<button>立即续费</button>
<image src='../../static/images/vipStar.png'></image>
<text>会员等级3级</text>
<button>立即续费</button>
</view>
</view>
<view class="box-equity">
<view class="equity-text">
<view class="equity-text">
<text class="equity-member">我的会员权益</text>
<text class="equity-look">查看权益></text>
</view>
<view class="equity-item" v-for="(item,index) in 2" :key="index">
<view class="equity-item" v-for="(item,index) in 2" :key="index">
<view class="equity-grade">
<text>办理档次640</text>
<text>办理日期2021.12.30</text>
@ -48,6 +48,12 @@
</view>
</view>
</view>
<u-navbar leftIcon="" title="会员申请">
<view class="u-nav-slot" slot="right">
<u-icon name="more-dot-fill" size="50" @click="show = true"></u-icon>
<u-action-sheet @select="handleSelect" :actions="list" :title="title" :show="show" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="show=false" :safeAreaInsetBottom="true"></u-action-sheet>
</view>
</u-navbar>
</view>
</template>
@ -56,19 +62,30 @@
name: "member_application",
data() {
return {
title:'管理',
list: [
{
name:'购买记录',
fontSize:'28'
},
{
name:'为他人充值',
fontSize:'28'
},
],
show: false,
form: {
phone:''
phone: ''
},
rules: {
phone: [
{
pattern: /^[0-9a-zA-Z]*$/g,
//
transform(value) {
return String(value);
},
message: '只能包含字母或数字'
},
phone: [{
pattern: /^[0-9a-zA-Z]*$/g,
//
transform(value) {
return String(value);
},
message: '只能包含字母或数字'
},
{
message: '手机号不能为空',
// blurchange
@ -85,6 +102,23 @@
},
methods: {
handleSelect(value){
switch (value.name){
case "购买记录":
uni.navigateTo({
url:'/pages/member_record/index'
})
break;
case "为他人充值":
console.log(123)
uni.navigateTo({
url:'/pages/member_others/index'
})
break;
default:
break;
}
},
submit() {
this.$refs.uForm.validate().then(res => {
@ -99,12 +133,16 @@
<style lang="scss" scoped>
.box {
margin-top: 10%;
background: #fff;
height: 100vh;
background: url(../../static/images/memberBg.png);
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
.box-member {
padding: 36rpx 40rpx;
border-radius: 20rpx;
@ -112,7 +150,8 @@
// padding: 20rpx 20rpx 30rpx 20rpx;
display: flex;
justify-content: space-between;
.member-left{
.member-left {
display: flex;
flex-direction: column;
justify-content: space-between;
@ -121,18 +160,21 @@
font-family: PingFang SC;
font-weight: 400;
color: #000000;
.left-title{
.left-title {
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 600;
color: #000000;
}
.left-info{
.left-info {
display: flex;
justify-content: space-between;
}
}
.member-right{
.member-right {
display: flex;
flex-direction: column;
justify-content: space-between;
@ -142,6 +184,7 @@
font-family: PingFang SC;
font-weight: 400;
color: #000000;
image {
width: 100rpx;
height: 100rpx;
@ -149,7 +192,7 @@
margin-bottom: 10rpx;
}
button{
button {
margin-top: 10rpx;
padding: 7rpx 16rpx;
background: #F22E60;
@ -169,31 +212,33 @@
padding: 0 40rpx;
background: url(../../static/images/memberEquity.png);
background-size: 100%;
background-repeat: no-repeat;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
position: relative;
.equity-text{
margin:5% 0;
display: flex;
align-items: center;
height: 10%;
.equity-member{
.equity-text {
margin: 5% 0;
display: flex;
align-items: center;
height: 10%;
.equity-member {
margin: 0 10%;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
.equity-look{
.equity-look {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #FF4922;
}
}
.equity-item {
background: #fff;
display: flex;
@ -201,18 +246,21 @@
justify-content: space-between;
border-radius: 20rpx;
margin: 0 20rpx 20rpx 20rpx;
// padding: 30rpx 24rpx;
.equity-grade{
.equity-grade {
border-radius: 10rpx 10rpx;
padding: 20rpx;
display: flex;
justify-content: space-between;
}
.equity-money {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.money-box{
.money-box {
width: 46%;
padding: 24rpx 25rpx;
border-radius: 10px;
@ -224,21 +272,25 @@
font-weight: 400;
color: #000000;
margin-bottom: 18rpx;
.money-text{
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
.money-text {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
}
}
.money-completed{
.money-completed {
background: #FFF2F2;
border: 1px solid #F22E60;
.money-text{
.money-text {
color: #F91F57;
}
view{
margin-top:26rpx;
}
view {
margin-top: 26rpx;
display: flex;
justify-content: space-between;
align-items: center;
@ -249,28 +301,33 @@
}
}
.money-treat{
.money-treat {
background: #FFFDF1;
border: 1px solid #FF962F;
.money-text{
.money-text {
margin-top: 26rpx;
color: #EBAF00;
color: #EBAF00;
}
}
.money-term{
.money-term {
background: #F8FFF8;
border: 1px solid #38A74F;
.money-text{
.money-text {
margin-top: 26rpx;
color: #2C9E2C;
color: #2C9E2C;
}
}
.money-time{
.money-time {
background: #F0FDFC;
border: 1px solid #5CA4E8;
.money-text{
.money-text {
margin-top: 26rpx;
color: #2D7AC9;
color: #2D7AC9;
}
}
}

View File

@ -37,6 +37,7 @@
<paymentMember :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :payInfo="payInfo">
</paymentMember>
<button class="box-submit" @click="goPay"></button>
<u-navbar autoBack title="为他人充值"></u-navbar>
</view>
</template>
@ -144,7 +145,11 @@
confirmPhone: this.form.confirmPhone,
orderInfos
}
}
}else{
this.$util.Tips({
title: '请选择档次套餐'
})
}
}).catch(errors => {
uni.$u.toast('校验失败')
})
@ -196,6 +201,7 @@
<style lang="scss" scoped>
.box {
margin-top: 10%;
position: relative;
padding: 8% 40rpx 30rpx 40rpx;
min-height: 100vh;

View File

@ -1,22 +1,28 @@
<template>
<view class="box">
<u-search placeholder="按手机号搜索查询" v-model="keyword" border-color="#F94B78" height="70" margin="0 0 35rpx 0" placeholder-color="#9C9C9C" bg-color="#fff" :show-action="false"></u-search>
<view class="box-seach">
<u-search placeholder="按手机号搜索查询" v-model="keyword" border-color="#F94B78" height="70" margin="0 0 35rpx 0" placeholder-color="#9C9C9C" bg-color="#fff" :show-action="false"></u-search>
</view>
<view class="list-item" v-for="(item,index) in memberData" :key="index">
<view class="item-phone">
<view></view>
<text>充值号码{{item.userPhone}}</text>
<view class="item-title">
<view class="item-phone">
<view></view>
<text>充值号码{{item.userPhone}}</text>
</view>
<button v-show="item.bool" @click="handleService(item.orderId)">退</button>
</view>
<view class="item-text">
<text>充值档次{{item.grade}}</text>
<text>日期{{item.stringCreateTime}}</text>
</view>
</view>
<u-navbar autoBack title="购买纪录"></u-navbar>
</view>
</template>
<script>
import {
memberOrderInfo
memberOrderInfo,memberApplyRefund
} from '@/api/member.js';
import { Debounce } from '@/utils/validate.js'
export default {
@ -28,8 +34,17 @@
};
},
async onLoad() {
let milliseconds = 2 * 3600 * 1000 // 7200000
let timestamp = new Date().getTime()
const res = await memberOrderInfo()
this.memberData = res.data
const arr = res.data.map((item) => {
return {
...item,
bool:item.createTime+milliseconds>timestamp
}
})
this.memberData = arr
console.log(this.memberData)
},
watch:{
keyword :Debounce (function (){
@ -50,14 +65,24 @@
},1000)
},
methods: {
async handleService(orderId){
await memberApplyRefund({orderId})
}
}
};
</script>
<style lang="scss" scoped>
.box {
padding: 45rpx 40rpx;
margin-top: 10%;
padding: 20% 40rpx;
.box-seach{
padding: 10% 40rpx;
width: 100%;
position: fixed;
top: 3%;
left: 0;
}
.list-item{
margin-bottom: 26rpx;
padding: 30rpx 16rpx 25rpx 16rpx;
@ -66,19 +91,30 @@
display: flex;
flex-direction: column;
justify-content: space-between;
.item-phone{
.item-title{
display: flex;
align-items: center;
font-size: 30rpx;
color: #E91D51;
view{
border-radius: 3rpx;
margin-right: 10rpx;
width: 5rpx;
height: 12rpx;
background: #E91D51;
justify-content: space-between;
.item-phone{
display: flex;
align-items: center;
font-size: 30rpx;
color: #E91D51;
view{
border-radius: 3rpx;
margin-right: 10rpx;
width: 5rpx;
height: 12rpx;
background: #E91D51;
}
}
button{
padding: 6rpx ;
font-size: 26rpx;
background: rgb(22,155,213);
color: #fff;
}
}
.item-text{
padding: 34rpx 12rpx;
background: #fff;

View File

@ -125,7 +125,11 @@ import store from '@/store/index';
userPhone: store.state.app.userInfo.mobile,
orderInfos
}
}
}else{
this.$util.Tips({
title: '请选择档次套餐'
})
}
},
/**
* 事件回调