lilei il y a 10 mois
Parent
commit
0986321cac

+ 2 - 2
App.vue

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

+ 18 - 18
pages.json

@@ -101,14 +101,6 @@
                 "enablePullDownRefresh": false
             }
             
-        },{
-            "path" : "pages/stockQuery/stockQuery",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "库存查询",
-                "enablePullDownRefresh": false
-            }
-            
         },
         {
             "path" : "pages/storeManage/addPerson",
@@ -136,15 +128,6 @@
                 "enablePullDownRefresh": false
             }
             
-        }
-        ,{
-            "path" : "pages/morePage/redPacket",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "红包奖励",
-                "enablePullDownRefresh": false
-            }
-            
         }
         ,{
             "path" : "pages/storeManage/editIsManage",
@@ -418,7 +401,24 @@
 	},
 	{
 		"root": "pagesB",
-		"pages":[{
+		"pages":[
+		{
+            "path" : "stockQuery/stockQuery",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "库存查询",
+                "enablePullDownRefresh": false
+            }
+            
+        },{
+            "path" : "redPacket",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "红包奖励",
+                "enablePullDownRefresh": false
+            }
+            
+        },{
 			"path" : "promoDetail",
 			"style" : 
 			{

+ 2 - 2
pages/morePage/morePage.vue

@@ -2,7 +2,7 @@
 	<view>
 	<view class="morePages">
 		<view class="list-box" v-if="hasRedPacket&&hasShelf">
-			<view class="list-title flex align_center justify_between" @click="toPage('/pages/morePage/redPacket')">
+			<view class="list-title flex align_center justify_between" @click="toPage('/pagesB/redPacket')">
 				<view><u-icon size="34" color="#f10000" name="red-packet-fill"></u-icon> <text style="color: #ff0000;margin-left: 10rpx;">红包奖励</text></view>
 				<view>
 					<u-icon size="28" color="#969799" name="arrow-right"></u-icon>
@@ -22,7 +22,7 @@
 				<u-icon size="38" name="bag"></u-icon> <text>货品管理</text>
 			</view>
 			<u-cell-group :border="false">
-				<u-cell-item title="库存查询" v-if="$hasPermissions('M_stockQueryList_mini')" @click="toPage('/pages/stockQuery/stockQuery')" :title-style="{fontSize:'1em'}">
+				<u-cell-item title="库存查询" v-if="$hasPermissions('M_stockQueryList_mini')" @click="toPage('/pagesB/stockQuery/stockQuery')" :title-style="{fontSize:'1em'}">
 					<text slot="icon"></text>
 				</u-cell-item>
 				<u-cell-item title="补货记录" v-if="$hasPermissions('M_stockPut_mini')" @click="toPage('/pagesA/digitalShelf/stockPut')" :title-style="{fontSize:'1em'}">

+ 33 - 3
pagesB/promoDetail.vue

@@ -176,12 +176,29 @@
 			})
 			this.$store.state.vuex_tempData = null
 			this.promoActiveSn = opts.promoActiveSn
+			// 查询产品列表
 			this.pageInit()
 		},
+		onUnload() {
+			// 存储已选列表值
+			const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
+			if(hasCache){
+				hasCache.list = this.chooseList
+			}else{
+				this.$store.state.vuex_cartList.push({sn:this.promoActiveSn,list: this.chooseList})
+			}
+			this.$u.vuex('vuex_cartList', this.$store.state.vuex_cartList)
+		},
 		methods: {
 			// 初始化页面
 			pageInit(){
 				this.screenWidth = uni.getSystemInfoSync().windowWidth
+				// 购物车是否有缓存
+				const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
+				if(hasCache){
+					this.chooseList = hasCache.list
+				}
+				// 重置分页
 				this.total = 0
 				this.pageNo = 1
 				// 获取列表数据
@@ -193,8 +210,9 @@
 					item.checked = true
 					item.qty = 1
 					item.show = false
-					this.chooseList.unshift(item)
+					this.chooseList.unshift(this.$u.deepClone(item))
 				}else{
+					item.qty = item.qty + 1
 					// 已添加,则增加数量
 					const row = this.chooseList.find(key => key.id == item.id)
 					if(row){
@@ -252,6 +270,10 @@
 					const rindex = this.chooseList.findIndex(key => key.id == e.index)
 					this.chooseList[rindex].qty = e.value
 					this.chooseList.splice()
+					// 更新页面产品数据
+					const aindex = this.list.findIndex(key => key.id == e.index)
+					this.list[aindex].qty = e.value
+					this.list.splice()
 				}else{
 					// 数量为0时,删除
 					this.chooseClick(e.index,0)
@@ -262,7 +284,10 @@
 				if(btns == 0) {
 					// 更新列表已选状态
 					const row = this.list.find(item => item.id == index)
-					if(row){row.checked = false}
+					if(row){
+						row.checked = false
+						row.qty = 0
+					}
 					const rindex = this.chooseProductList.findIndex(item => item.id == index)
 					this.chooseProductList.splice(rindex, 1);
 					this.chooseList.splice(rindex, 1);
@@ -335,8 +360,13 @@
 			  queryPromoProductByPage(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
 				  const list = res.data.list||[]
+				  // 更新已选状态
 				  list.map(k => {
-					  k.checked = false
+					  const hasChecked = this.chooseList.find(s=>s.id == k.id)
+					  k.checked = hasChecked
+					  if(hasChecked){
+						  k.qty = hasChecked.qty
+					  }
 				  })
 				  _this.list = _this.list.concat(list)
 				  _this.total = res.data.count || 0

+ 1 - 1
pages/morePage/redPacket.vue → pagesB/redPacket.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		<view class="header-img">
-			<u-image src="/static/hbheader.jpg" width="750" height="578"></u-image>
+			<u-image src="/pagesB/static/hbheader.jpg" width="750" height="578"></u-image>
 			<!-- 滚动区域 -->
 			<view class="scroll-list" v-if="slist.length">
 				<scrollBox :list="slist" bgColor="rgba(250, 224, 188, 0.6)"></scrollBox>

+ 0 - 0
static/hbheader.jpg → pagesB/static/hbheader.jpg


+ 0 - 0
pages/stockQuery/stockQuery.vue → pagesB/stockQuery/stockQuery.vue


+ 2 - 1
store/index.js

@@ -15,7 +15,7 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['vuex_carBrandList','vuex_uuidTempData'];
+let saveStateKeys = ['vuex_carBrandList','vuex_uuidTempData','vuex_cartList'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value){
@@ -65,6 +65,7 @@ const store = new Vuex.Store({
 		vuex_tempData: null, // 临时数据
 		vuex_configPrice: null, // 价格显示配置
 		vuex_uuidTempData: lifeData.vuex_uuidTempData ? lifeData.vuex_uuidTempData : null, // 唯一码临时数据
+		vuex_cartList: lifeData.vuex_cartList ? lifeData.vuex_cartList : [], // 购物车列表按活动缓存
 		vuex_tabBarList: [
 			{
 				"pagePath": "/pages/index/index",