浏览代码

优惠券

fanzherong_v 3 月之前
父节点
当前提交
76e0a34fec
共有 16 个文件被更改,包括 125 次插入52 次删除
  1. 10 1
      snowy-admin-web/src/views/biz/consumptionrecord/index.vue
  2. 2 2
      snowy-admin-web/src/views/biz/member/consumption.vue
  3. 1 0
      snowy-admin-web/src/views/biz/member/form.vue
  4. 1 1
      snowy-admin-web/src/views/biz/member/index.vue
  5. 16 8
      snowy-admin-web/src/views/biz/rebaterecord/index.vue
  6. 14 7
      snowy-admin-web/src/views/biz/rechargeplanconfig/index.vue
  7. 19 11
      snowy-admin-web/src/views/biz/rechargerecord/index.vue
  8. 18 4
      snowy-admin-web/src/views/biz/recommendrecord/index.vue
  9. 6 2
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/consumptionrecord/entity/ConsumptionRecord.java
  10. 8 7
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/consumptionrecord/service/impl/ConsumptionRecordServiceImpl.java
  11. 4 4
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/rechargerecord/mapper/mapping/BizRechargeRecordMapper.xml
  12. 1 1
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/rechargerecord/service/impl/BizRechargeRecordServiceImpl.java
  13. 8 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/entity/BizRecommendRecord.java
  14. 4 2
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/mapper/mapping/BizRecommendRecordMapper.xml
  15. 11 1
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/service/impl/BizRecommendRecordServiceImpl.java
  16. 2 1
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/impl/BizUserServiceImpl.java

+ 10 - 1
snowy-admin-web/src/views/biz/consumptionrecord/index.vue

@@ -68,7 +68,7 @@
 					</a-button>
 				</a-space>
 			</template>
-			<template #bodyCell="{ column, record }">
+			<template #bodyCell="{ column, record,index }">
 				<template v-if="column.dataIndex === 'action'">
 					<a-space>
 						<a @click="formRef.onOpen(record)" v-if="hasPerm('consumptionRecordEdit')">编辑</a>
@@ -93,6 +93,9 @@
 						{{ $TOOL.dictTypeData('consumption_operate', record.consumptionOperate) }}
 					</a-tag>
 				</template>
+				<template v-if="column.dataIndex === 'serial'">
+					{{ index + 1 }}
+				</template>
 			</template>
 		</s-table>
 	</a-card>
@@ -122,6 +125,12 @@
 
 	const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
 	const columns = [
+		{
+			title: '序号',
+			dataIndex: 'serial',
+			align: 'center',
+			width: 50
+		},
 		{
 			title: '会员姓名',
 			dataIndex: 'userName',

+ 2 - 2
snowy-admin-web/src/views/biz/member/consumption.vue

@@ -119,7 +119,7 @@
 			message.error('请先输入手机号!')
 			return
 		}
-		//bizAuthApi.sendMessage({phone:formData.value.phoneNumber}).then((res)=>{
+		bizAuthApi.sendMessage({phone:formData.value.phoneNumber}).then((res)=>{
 			/*if(res.code == '200'){
 				message.success("发送成功")
 			}else{
@@ -138,7 +138,7 @@
 					countdown.value = 300;
 				}
 			}, 1000);
-		//})
+		})
 	}
 	// 抛出函数
 	defineExpose({

+ 1 - 0
snowy-admin-web/src/views/biz/member/form.vue

@@ -97,6 +97,7 @@
 		voucherBalance:  [required('请输入代金券余额')],
 	}
 	// 验证并提交数据
+	//title: '确定要为'+formData.value.name+(formData.value.consumptionOperate=='1'?'赠送':'扣减')+(formData.value.consumptionType=='1'?'代金券':'余额')+formData.value.consumptionMoney+'元吗?',
 	const onSubmit = () => {
 		Modal.confirm({
 			title: '确定要为'+formData.value.name+(formData.value.consumptionOperate=='1'?'赠送':'扣减')+(formData.value.consumptionType=='1'?'代金券':'余额')+formData.value.consumptionMoney+'元吗?',

+ 1 - 1
snowy-admin-web/src/views/biz/member/index.vue

@@ -4,7 +4,7 @@
 			<a-row :gutter="24">
 				<a-col :span="6">
 					<a-form-item name="searchKey" :label="$t('common.searchKey')">
-						<a-input v-model:value="searchFormState.searchKey" :placeholder="'请输入姓名或号'" />
+						<a-input v-model:value="searchFormState.searchKey" :placeholder="'请输入姓名或手机号'" />
 					</a-form-item>
 				</a-col>
 				<a-col :span="6">

+ 16 - 8
snowy-admin-web/src/views/biz/rebaterecord/index.vue

@@ -61,35 +61,43 @@
 		{
 			title: '序号',
 			dataIndex: 'serial',
-			width: 80
+			width: 80,
+			align: 'center',
 		},
 		{
 			title: '充值人',
-			dataIndex: 'rechargeUserName'
+			dataIndex: 'rechargeUserName',
+			align: 'center',
 		},
 		{
 			title: '充值金额(元)',
-			dataIndex: 'rechargeAmount'
+			dataIndex: 'rechargeAmount',
+			align: 'center',
 		},
 		{
 			title: '推荐人',
-			dataIndex: 'recommendUserName'
+			dataIndex: 'recommendUserName',
+			align: 'center',
 		},
 		{
 			title: '返利金额(元)',
-			dataIndex: 'rebateAmout'
+			dataIndex: 'rebateAmout',
+			align: 'center',
 		},
 		{
 			title: '返利比例',
-			dataIndex: 'rebateRatio'
+			dataIndex: 'rebateRatio',
+			align: 'center',
 		},
 		{
 			title: '充值时间',
-			dataIndex: 'rechargeTime'
+			dataIndex: 'rechargeTime',
+			align: 'center',
 		},
 		{
 			title: '状态',
-			dataIndex: 'rebateStatus'
+			dataIndex: 'rebateStatus',
+			align: 'center',
 		}
 	]
 	// // 操作栏通过权限判断是否显示

+ 14 - 7
snowy-admin-web/src/views/biz/rechargeplanconfig/index.vue

@@ -104,31 +104,38 @@
 		{
 			title: '序号',
 			dataIndex: 'serial',
-			width: 80
+			width: 80,
+			align: 'center',
 		},
 		{
 			title: '充值金额及以上(元)',
-			dataIndex: 'rechargeAmount'
+			dataIndex: 'rechargeAmount',
+			align: 'center',
 		},
 		{
 			title: '优惠券金额(元)',
-			dataIndex: 'couponAmount'
+			dataIndex: 'couponAmount',
+			align: 'center',
 		},
 		{
 			title: '优惠券数量',
-			dataIndex: 'couponNum'
+			dataIndex: 'couponNum',
+			align: 'center',
 		},
 		{
 			title: '账户增加金额(元)',
-			dataIndex: 'accountBalance'
+			dataIndex: 'accountBalance',
+			align: 'center',
 		},
 		{
 			title: '返点比例(代金券)',
-			dataIndex: 'rebateRatio'
+			dataIndex: 'rebateRatio',
+			align: 'center',
 		},
 		{
 			title: '状态',
-			dataIndex: 'status'
+			dataIndex: 'status',
+			align: 'center',
 		}
 	]
 	// 操作栏通过权限判断是否显示

+ 19 - 11
snowy-admin-web/src/views/biz/rechargerecord/index.vue

@@ -4,7 +4,7 @@
 			<a-row :gutter="24">
 				<a-col :span="6">
 					<a-form-item label="关键字搜素" name="searchKey">
-						<a-input v-model:value="searchFormState.userId" placeholder="请输入姓名或者手机号" />
+						<a-input v-model:value="searchFormState.searchKey" placeholder="请输入姓名或者手机号" />
 					</a-form-item>
 				</a-col>
 				<a-col :span="6">
@@ -44,7 +44,7 @@
 	import { cloneDeep } from 'lodash-es'
 	import Form from './form.vue'
 	import bizRechargeRecordApi from '@/api/biz/bizRechargeRecordApi'
-	const searchFormState = ref({})
+	let searchFormState = reactive({})
 	const searchFormRef = ref()
 	const tableRef = ref()
 	const formRef = ref()
@@ -52,35 +52,43 @@
 		{
 			title: '序号',
 			dataIndex: 'serial',
-			width: 80
+			width: 80,
+			align: 'center',
 		},
 		{
 			title: '姓名',
-			dataIndex: 'name'
+			dataIndex: 'name',
+			align: 'center',
 		},
 		{
 			title: '手机号',
-			dataIndex: 'phone'
+			dataIndex: 'phone',
+			align: 'center',
 		},
 		{
 			title: '充值金额(元)',
-			dataIndex: 'rechargeAmount'
+			dataIndex: 'rechargeAmount',
+			align: 'center',
 		},
 		{
 			title: '充值时间',
-			dataIndex: 'rechargeTime'
+			dataIndex: 'rechargeTime',
+			align: 'center',
 		},
 		{
 			title: '原账户余额(元)',
-			dataIndex: 'oldAccountBalance'
+			dataIndex: 'oldAccountBalance',
+			align: 'center',
 		},
 		{
 			title: '新账户余额(元)',
-			dataIndex: 'newAccountBalance'
+			dataIndex: 'newAccountBalance',
+			align: 'center',
 		},
 		{
 			title: '是否支付',
-			dataIndex: 'isPay'
+			dataIndex: 'isPay',
+			align: 'center',
 		}
 	]
 	// 操作栏通过权限判断是否显示
@@ -91,7 +99,7 @@
 		width: 150
 	})
 	const loadData = (parameter) => {
-		const searchFormParam = cloneDeep(searchFormState.value)
+		const searchFormParam = JSON.parse(JSON.stringify(searchFormState))
 		// rechargeTime范围查询条件重载
 		if (searchFormParam.rechargeTime) {
 			searchFormParam.startRechargeTime = searchFormParam.rechargeTime[0]

+ 18 - 4
snowy-admin-web/src/views/biz/recommendrecord/index.vue

@@ -44,19 +44,33 @@
 		{
 			title: '序号',
 			dataIndex: 'serial',
-			width: 80
+			width: 80,
+			align: 'center'
 		},
 		{
 			title: '推荐人',
-			dataIndex: 'recommendUserName'
+			dataIndex: 'recommendUserName',
+			align: 'center'
+		},
+		{
+			title: '推荐人手机号',
+			dataIndex: 'recommendUserPhone',
+			align: 'center'
 		},
 		{
 			title: '被推荐人',
-			dataIndex: 'acceptUserName'
+			dataIndex: 'acceptUserName',
+			align: 'center'
+		},
+		{
+			title: '被推荐人手机号',
+			dataIndex: 'acceptUserPhone',
+			align: 'center'
 		},
 		{
 			title: '推荐时间',
-			dataIndex: 'createTime'
+			dataIndex: 'createTime',
+			align: 'center'
 		}
 	]
 	const loadData = (parameter) => {

+ 6 - 2
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/consumptionrecord/entity/ConsumptionRecord.java

@@ -13,6 +13,9 @@
 package vip.xiaonuo.biz.modular.consumptionrecord.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
@@ -30,7 +33,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("biz_consumption_record")
-public class ConsumptionRecord extends CommonEntity {
+public class ConsumptionRecord extends CommonEntity implements TransPojo {
 
     /** 主键ID */
     @TableId
@@ -66,7 +69,8 @@ public class ConsumptionRecord extends CommonEntity {
     private String consumptionRemark;
 
     /** 操作:1:赠送  2:扣减  3:消费 */
-    @Schema(description = "操作:1:赠送  2:扣减  3:消费")
+    @Schema(description = "操作:1:赠送  2:扣减  3:手动结算  4:扫码结算")
+    @Trans(type = TransType.DICTIONARY, key = "consumption_operate")
     private String consumptionOperate;
 
     /**总金额*/

+ 8 - 7
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/consumptionrecord/service/impl/ConsumptionRecordServiceImpl.java

@@ -42,6 +42,7 @@ import vip.xiaonuo.biz.modular.consumptionrecord.service.ConsumptionRecordServic
 import vip.xiaonuo.common.util.CommonCryptogramUtil;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -70,7 +71,8 @@ public class ConsumptionRecordServiceImpl extends ServiceImpl<ConsumptionRecordM
             queryWrapper.like("su.name",consumptionRecordPageParam.getUserName());
         }
         if(ObjectUtil.isNotEmpty(consumptionRecordPageParam.getConsumptionOperate())){
-            queryWrapper.eq("cr.consumption_operate",consumptionRecordPageParam.getConsumptionOperate());
+            List<String> list = Arrays.asList(consumptionRecordPageParam.getConsumptionOperate().split(","));
+            queryWrapper.in("cr.consumption_operate",list);
         }
         if(ObjectUtil.isNotEmpty(consumptionRecordPageParam.getOrgId())){
             queryWrapper.eq("cr.consumption_org",consumptionRecordPageParam.getOrgId());
@@ -138,12 +140,6 @@ public class ConsumptionRecordServiceImpl extends ServiceImpl<ConsumptionRecordM
             }
         }else if(StringUtils.equals(consumptionRecordAddParam.getConsumptionOperate(),"2")){
             bizUserFundChangeRecord.setChangeType("5");
-            if(bizUser.getVoucherBalance().compareTo(BigDecimal.ZERO) == 0){
-                throw new CommonException("会员当前代金券余额为0,不可扣减!");
-            }
-            if(bizUser.getAccountBalance().compareTo(BigDecimal.ZERO) == 0){
-                throw new CommonException("会员当前账户余额为0,不可扣减!");
-            }
             //会员扣减
             if(StringUtils.equals(consumptionRecordAddParam.getConsumptionType(),"1")){
                 //选择代金券,用户原有代金券金额-本次扣减金额
@@ -300,4 +296,9 @@ public class ConsumptionRecordServiceImpl extends ServiceImpl<ConsumptionRecordM
         queryWrapper.between("bcr.consumption_time", format+" 00:00:00",format+" 23:59:59");
         return this.getBaseMapper().getRecordTotal(queryWrapper);
     }
+
+
+    public static void main(String[] args) {
+        System.out.printf("加密后手机号:"+CommonCryptogramUtil.doSm4CbcEncrypt("15240260262"));
+    }
 }

+ 4 - 4
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/rechargerecord/mapper/mapping/BizRechargeRecordMapper.xml

@@ -6,8 +6,8 @@
         SELECT
             t.id,
             t.user_id,
-            su.NAME,
-            su.PHONE,
+            u.NAME,
+            u.PHONE,
             t.recharge_plan_id,
             t.plan_account_balance,
             t.recharge_amount,
@@ -22,9 +22,9 @@
             t.is_pay,
             t.pay_time
         FROM biz_recharge_record t
-        LEFT JOIN SYS_USER su ON t.user_id = su.id
+        LEFT JOIN SYS_USER u ON t.user_id = u.id
         <where>
             ${ew.sqlSegment}
         </where>
     </select>
-</mapper>
+</mapper>

+ 1 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/rechargerecord/service/impl/BizRechargeRecordServiceImpl.java

@@ -89,7 +89,7 @@ public class BizRechargeRecordServiceImpl extends ServiceImpl<BizRechargeRecordM
     public Page<BizRechargeRecord> page(BizRechargeRecordPageParam bizRechargeRecordPageParam) {
         QueryWrapper<BizRechargeRecord> queryWrapper = new QueryWrapper<BizRechargeRecord>().checkSqlInjection();
         if (ObjectUtil.isNotEmpty(bizRechargeRecordPageParam.getSearchKey())) {
-            queryWrapper.and(s -> s.like("u.PHONE", bizRechargeRecordPageParam.getSearchKey())
+            queryWrapper.and(s -> s.like("u.ACCOUNT", bizRechargeRecordPageParam.getSearchKey())
                     .or().like("u.NAME", bizRechargeRecordPageParam.getSearchKey()));
         }
         if (ObjectUtil.isNotEmpty(bizRechargeRecordPageParam.getStartRechargeTime()) && ObjectUtil.isNotEmpty(bizRechargeRecordPageParam.getEndRechargeTime())) {

+ 8 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/entity/BizRecommendRecord.java

@@ -46,11 +46,19 @@ public class BizRecommendRecord extends CommonEntity {
     @TableField(exist = false)
     private String recommendUserName;
 
+    /**推荐人手机号*/
+    @TableField(exist = false)
+    private String recommendUserPhone;
+
 
     /** 被推荐人用户id */
     @Schema(description = "被推荐人用户id")
     private String acceptUserId;
 
+    /**被推荐人手机号*/
+    @TableField(exist = false)
+    private String acceptUserPhone;
+
     /** 被推荐人 */
     @Schema(description = "被推荐人")
     @TableField(exist = false)

+ 4 - 2
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/mapper/mapping/BizRecommendRecordMapper.xml

@@ -9,11 +9,13 @@
             t.accept_user_id,
             t.create_time,
             u1.`NAME` acceptUserName,
-            u2.`NAME` recommendUserName
+            u1.`PHONE` acceptUserPhone,
+            u2.`NAME` recommendUserName,
+            u2.`PHONE` recommendUserPhone
         FROM
             biz_recommend_record t
         LEFT JOIN SYS_USER u1 ON u1.ID = t.accept_user_id
         LEFT JOIN SYS_USER u2 ON u2.ID = t.recommend_user_id
         ${ew.customSqlSegment}
     </select>
-</mapper>
+</mapper>

+ 11 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/recommendrecord/service/impl/BizRecommendRecordServiceImpl.java

@@ -33,6 +33,7 @@ import vip.xiaonuo.biz.modular.recommendrecord.param.BizRecommendRecordEditParam
 import vip.xiaonuo.biz.modular.recommendrecord.param.BizRecommendRecordIdParam;
 import vip.xiaonuo.biz.modular.recommendrecord.param.BizRecommendRecordPageParam;
 import vip.xiaonuo.biz.modular.recommendrecord.service.BizRecommendRecordService;
+import vip.xiaonuo.common.util.CommonCryptogramUtil;
 
 import java.util.List;
 
@@ -54,7 +55,16 @@ public class BizRecommendRecordServiceImpl extends ServiceImpl<BizRecommendRecor
         }
         queryWrapper.eq("t.delete_flag", CommonDeleteFlagEnum.NOT_DELETE);
         queryWrapper.orderByAsc("t.create_time");
-        return baseMapper.page(CommonPageRequest.defaultPage(), queryWrapper);
+        Page<BizRecommendRecord> page = baseMapper.page(CommonPageRequest.defaultPage(), queryWrapper);
+        for(BizRecommendRecord bizRecommendRecord : page.getRecords()){
+            if(ObjectUtil.isNotEmpty(bizRecommendRecord.getRecommendUserPhone())){
+                bizRecommendRecord.setRecommendUserPhone(CommonCryptogramUtil.doSm4CbcDecrypt(bizRecommendRecord.getRecommendUserPhone()));
+            }
+            if(ObjectUtil.isNotEmpty(bizRecommendRecord.getAcceptUserPhone())){
+                bizRecommendRecord.setAcceptUserPhone(CommonCryptogramUtil.doSm4CbcDecrypt(bizRecommendRecord.getAcceptUserPhone()));
+            }
+        }
+        return page;
     }
 
     @Override

+ 2 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/impl/BizUserServiceImpl.java

@@ -827,6 +827,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
                 throw new CommonException("未查询到该编码的推荐人");
             }
             referralUserId = referralUser.getId();
+            bizUser.setReferralUser(referralUserId);
         }
         // 校验openId或者手机号是否存在
         if (ObjectUtil.isNotNull(baseMapper.selectOne(new LambdaQueryWrapper<BizUser>()
@@ -838,7 +839,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         }
         bizUser.setAccount(wxUserRegisterParam.getPhone());
         bizUser.setPhone(wxUserRegisterParam.getPhone());
-        bizUser.setAvatar(CommonAvatarUtil.generateImg(bizUser.getName()));
+        bizUser.setAvatar(CommonAvatarUtil.generateImg(wxUserRegisterParam.getName()));
         // 设置默认密码
         bizUser.setPassword(CommonCryptogramUtil.doHashValue(devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_PASSWORD_KEY)));
         // 设置状态