Browse Source

bug 修复

lilei 2 năm trước cách đây
mục cha
commit
dea434e2ab

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 31 - 0
api/rewardRule.js

@@ -0,0 +1,31 @@
+import request from './request';
+// 取当前活动规则
+export const findCurrentRewardRule = (params) => {
+  return request({
+    url: `shelf/rewardRule/findCurrentRewardRule`,
+    method: 'get'
+  })
+}
+// 获取当前用户 的奖励汇总信息
+export const findUserReward = (params) => {
+  return request({
+    url: `shelf/reward/findUserReward`,
+    method: 'get'
+  })
+}
+// 获取奖励列表信息
+export const getRewardOrderList = (params) => {
+  return request({
+    url: `shelf/rewardOrder/queryPage/${params.pageNo}/${params.pageSize}`,
+    data: params,
+    method: 'post'
+  })
+}
+// 滚动领奖列表
+export const getRewardRollList = (params) => {
+  return request({
+    url: `shelf/rewardOrder/rollList/${params.pageNo}/${params.pageSize}`,
+    data: params,
+    method: 'post'
+  })
+}

+ 9 - 1
pages/digitalShelf/choosePart.vue

@@ -303,6 +303,9 @@
 			},
 			isAdmin(){
 				return this.userInfo.superAdmin == 1
+			},
+			hasRedPacket(){
+				return this.$store.state.vuex_rewardRule
 			}
 		},
 		onLoad(opts) {
@@ -611,8 +614,13 @@
 					shelfOrderFlowCreate(params).then(res => {
 						console.log(res,'shelfOrderFlowCreate')
 						if(res.status == 200){
-							this.showMask = true
 							this.tempData = res.data
+							// 有红包活动
+							if(this.hasRedPacket){
+								this.showMask = true
+							}else{
+								this.toSuccess()
+							}
 						}else{
 							// 或失败
 							uni.redirectTo({

+ 28 - 6
pages/index/index.vue

@@ -120,6 +120,7 @@
 	import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
 	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, findPriceShow,findPriceShowType,findPriceShowEmployee } from '@/api/shelf.js'
 	import { xprhStoreApplyRead } from '@/api/xprh.js'
+	import { findCurrentRewardRule } from '@/api/rewardRule.js'
 	import { listLookUp, getLookUpDatas } from '@/api/data.js';
 	import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
 	export default {
@@ -149,11 +150,6 @@
 						fontSize: 32
 					}
 				],
-				imgList:[{
-						image: '/static/banner1.png'
-					},{
-						image: '/static/banner2.jpg'
-					}]
 			}
 		},
 		computed: {
@@ -166,6 +162,22 @@
 			},
 			storeApply(){
 				return this.$store.state.vuex_storeAuthInfo || null
+			},
+			hasRedPacket(){
+				return this.$store.state.vuex_rewardRule
+			},
+			imgList(){
+				if(this.hasRedPacket){
+					return [{
+						image: '/static/banner1.png'
+					},{
+						image: '/static/banner2.jpg'
+					}]
+				}else{
+					return [{
+						image: '/static/banner1.png'
+					}]
+				}
 			}
 		},
 		onReady() {
@@ -219,6 +231,10 @@
 				if(this.userInfo.sysUserFlag == '0'){
 					this.findLastApply()
 				}
+				if(this.userInfo.sysUserFlag == '1'){
+					// 查询红包活动
+					this.getRedPacketRule()
+				}
 			}
 		},
 		methods: {
@@ -370,6 +386,12 @@
 						}
 				})
 			},
+			// 查询是有红包活动
+			getRedPacketRule(){
+				findCurrentRewardRule().then(res => {
+					this.$store.state.vuex_rewardRule = res.data;
+				})
+			},
 			// 获取保证金金额
 			getShelfBWPayRecord(){
 				const data = this.$store.state.vuex_storeShelf
@@ -394,7 +416,7 @@
 			},
 			// 单击banner
 			clickBanner(index){
-				if(index == 1){
+				if(index == 1 && this.hasRedPacket){
 					uni.navigateTo({url:"/pages/morePage/redPacket"})
 				}
 			},

+ 4 - 1
pages/morePage/morePage.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 	<view class="morePages">
-		<view class="list-box">
+		<view class="list-box" v-if="hasRedPacket">
 			<view class="list-title flex align_center justify_between" @click="toPage('/pages/morePage/redPacket')">
 				<view><u-icon size="34" color="#f10000" name="red-packet-fill"></u-icon> <text style="color: #ff0000;margin-left: 10rpx;">红包奖励</text></view>
 				<view>
@@ -114,6 +114,9 @@
 			},
 			storeApply(){
 				return this.$store.state.vuex_storeAuthInfo
+			},
+			hasRedPacket(){
+				return this.$store.state.vuex_rewardRule
 			}
 		},
 		onShow() {

+ 115 - 20
pages/morePage/redPacket.vue

@@ -10,7 +10,7 @@
 				345.5
 				<text>元</text>
 			</view>
-			<view class="view-gz">查看活动规则>></view>
+			<view class="view-gz" @click="showModal = true">查看活动规则>></view>
 		</view>
 		<view class="list-box">
 			<view class="codes flex align_center">
@@ -24,43 +24,83 @@
 			</view>
 			<view class="tabbox">
 				<view class="tabhead flex align_center justify_between">
-					<view class="active">所有红包</view>
-					<view>已发红包</view>
-					<view>待发红包</view>
+					<view :class="curTab==0?'active':''" @click="tabChange(0)">所有红包</view>
+					<view :class="curTab==1?'active':''" @click="tabChange(1)">已发红包</view>
+					<view :class="curTab==2?'active':''" @click="tabChange(2)">待发红包</view>
 				</view>
-				<view class="tablist">
-					<view class="flex align_center justify_between" v-for="item in 12">
-						<view class="flex align_center">
-							<view class="imgs">
-								<u-icon size="30" color="#fff" name="red-packet"></u-icon>
+				<swiper class="tablist">
+					<swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
+						<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
+							<view class="totalBar" v-if="curTab==1">共<text>20</text>个红包,合计<text>200</text>元</view>
+							<view class="flex align_center justify_between itemlist" v-for="item in 12">
+								<view class="flex align_center">
+									<view class="imgs">
+										<u-icon size="30" color="#fff" name="red-packet"></u-icon>
+									</view>
+									<view class="txts">
+										<view class="txts-name">扫描VIN码下单得红包</view>
+										<view class="txts-time">2022-10-28 12:36</view>
+									</view>
+								</view>
+								<view class="amount">+0.50</view>
 							</view>
-							<view class="txts">
-								<view class="txts-name">扫描VIN码下单得红包</view>
-								<view class="txts-time">2022-10-28 12:36</view>
+							<view style="padding: 20upx;">
+								 <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+								 <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
 							</view>
-						</view>
-						<view class="amount">+0.50</view>
-					</view>
-				</view>
+						</scroll-view>
+					</swiper-item>
+				</swiper>
 			</view>
 		</view>
+		<!-- 活动规则 -->
+		<u-popup v-model="showModal" closeable mode="center" border-radius="15" width="600rpx">
+			<view style="padding: 20rpx;">
+				<view style="text-align: center;padding: 20rpx 0pt;">活动规则</view>
+				<view style="font-weight: bold;">【活动时间】</view>
+				<view style="padding: 10rpx 20rpx;">即日起—2022年12月31日</view>
+				<view style="font-weight: bold;">【活动内容】</view>
+				<view style="padding: 10rpx 20rpx;">活动期间,凡是通过店内易码通货架取货和小程序下单的用户,即可获得最高百元现金红包。</view>
+				<view style="font-weight: bold;">【领取方式】</view>
+				<view style="padding: 10rpx 20rpx;">在活动页面,扫码或添加客服微信号,发送“姓名+修理厂名称+手机号+提现金额”,客服会在收到信息后1-3个工作日内,以微信红包的形式发放现金红包,您可在“已发放”“待发放”中查看红包金额。</view>
+				<view style="font-weight: bold;">【注意】</view>
+				<view style="padding: 10rpx 20rpx;">1.退货或已取消的订单不可领取红包;</view>
+				<view style="padding: 10rpx 20rpx;">2.红包不可转让或为他人付款;</view>
+				<view style="padding: 10rpx 20rpx;">3.活动仅限实名认证用户才能参与,因微信账号非实名导致用户无法收到和领取红包的,请联系腾讯客服完成实名认证;</view>
+				<view style="padding: 10rpx 20rpx;">4.该活动最终解释权归广东易码通数字科技有限公司所有。</view>
+				<view style="font-weight: bold;">【声明】</view>
+				<view style="padding: 10rpx 20rpx;">广东易码通数字科技有限公司不会以任何理由向用户所要身份证、银行卡账户和密码等相关信息,请注意保护个人隐私。</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
 	import scrollBox from '@/components/scrollBox.vue'
-	import { scanVinLogQueryRoll }from '@/api/car.js'
+	import { findUserReward, getRewardOrderList, getRewardRollList } from '@/api/rewardRule.js'
 	export default {
 		components: {
 			scrollBox,
 		},
 		data() {
 			return {
+				showModal: false,
+				rewardData: null, // 奖励信息
 				slist:[],
+				status: 'loading',
+				noDataText: '暂无红包数据',
+				pageNo: 1,
+				pageSize: 30,
+				total: 0,
+				rewardStatus: ['','paid','un_paid'], //un_paid 未发放,paid 已发放
+				list: [],
+				curTab:'0'
 			}
 		},
 		onLoad(){
 			this.getScrollLog()
+			this.getUserReward()
+			this.getEwardOrder()
 		},
 		methods: {
 			openImg(url){
@@ -68,10 +108,57 @@
 					urls:[url]
 				})
 			},
+			// 活动奖励信息
+			getUserReward(){
+				findUserReward().then(res => {
+					this.rewardData = res.data
+				})
+			},
+			tabChange(i){
+				this.curTab = i
+				this.getEwardOrder(1)
+			},
+			// 查询列表
+			getEwardOrder (pageNo) {
+			  let _this = this
+			  if (pageNo) {
+			    this.pageNo = pageNo
+			  }
+			  // 状态条件
+			  let params = {
+			    pageNo: this.pageNo,
+			    pageSize: this.pageSize,
+				rewardStatus: this.rewardStatus[this.curTab]
+			  }
+			  this.status = "loading"
+			  getRewardOrderList(params).then(res => {
+				if (res.code == 200 || res.status == 204 || res.status == 200) {
+				  if(_this.pageNo>1){
+					  _this.list = _this.list.concat(res.data.list || [])
+				  }else{
+					  _this.list = res.data.list || []
+				  }
+				  _this.total = res.data.count || 0
+				} else {
+				  _this.list = []
+				  _this.total = 0
+				  _this.noDataText = res.message
+				}
+				_this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
+			  })
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.list.length < this.total){
+					this.pageNo += 1
+					this.getEwardOrder()
+				}else{
+					this.status = "nomore"
+				}
+			},
 			// 获取上方滚动扫描记录
 			getScrollLog(){
-				scanVinLogQueryRoll({pageNo:1,pageSize:1000}).then(res => {
-					console.log(res)
+				getRewardRollList({pageNo:1,pageSize:1000}).then(res => {
 					this.slist = res.data.list || []
 					this.slist.map(item => {
 						item.placeText = item.userName + '刚刚得到了1.5元 红包奖励'
@@ -151,8 +238,9 @@
 					}
 				}
 				.tablist{
+					height: 70vh;
 					padding: 20rpx 0;
-					> view{
+					.itemlist{
 						border-bottom: 1rpx solid #fff;
 						padding: 20rpx 30rpx;
 						.txts-name{
@@ -181,6 +269,13 @@
 						text-align: center;
 					}
 				}
+				.totalBar{
+					background-color: #fff;
+					padding: 10rpx 20rpx;
+					border-radius: 60rpx;
+					margin: 0 30rpx;
+					color: #e7463c;
+				}
 			}
 		}
 	}

+ 1 - 0
store/index.js

@@ -44,6 +44,7 @@ const store = new Vuex.Store({
 		vuex_carType: {}, // 选择的车辆品牌
 		deviceNo: "",
 		vuex_storeShelf: null, // 数字货架是否启用
+		vuex_rewardRule: null, // 红包活动信息
 		vuex_settleRecordDetail: null, // 结算记录详情
 		vuex_settleOrderDetail: null, // 结算记录订单详情
 		vuex_shelfChoosePart: [], // 数字货架临配选择配件