|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view class="video-pagesCons">
|
|
|
<view class="tab-search">
|
|
|
- <u-search placeholder="请输入产品名称/轮胎规格" shape="round" :clearabled="true" show-action v-model="queryWord" @clear="getRow" @search="getRow" @custom="getRow"></u-search>
|
|
|
+ <u-search placeholder="请输入产品名称/轮胎规格" shape="round" :clearabled="true" show-action v-model="queryWord" @clear="pageInit" @search="pageInit" @custom="pageInit"></u-search>
|
|
|
</view>
|
|
|
<view class="tab-body">
|
|
|
<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
|
|
@@ -176,6 +176,12 @@
|
|
|
})
|
|
|
this.$store.state.vuex_tempData = null
|
|
|
this.promoActiveSn = opts.promoActiveSn
|
|
|
+ // 购物车是否有缓存
|
|
|
+ const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
|
|
|
+ if(hasCache){
|
|
|
+ this.chooseList = hasCache.list
|
|
|
+ }
|
|
|
+ this.screenWidth = uni.getSystemInfoSync().windowWidth
|
|
|
// 查询产品列表
|
|
|
this.pageInit()
|
|
|
},
|
|
@@ -192,15 +198,10 @@
|
|
|
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
|
|
|
+ this.list = []
|
|
|
// 获取列表数据
|
|
|
this.getRow()
|
|
|
},
|
|
@@ -268,12 +269,16 @@
|
|
|
this.chooseProductList[rowIndex].qty = e.value
|
|
|
// 更新原始数据
|
|
|
const rindex = this.chooseList.findIndex(key => key.id == e.index)
|
|
|
- this.chooseList[rindex].qty = e.value
|
|
|
- this.chooseList.splice()
|
|
|
+ if(rindex>=0){
|
|
|
+ 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()
|
|
|
+ if(aindex>=0){
|
|
|
+ this.list[aindex].qty = e.value
|
|
|
+ this.list.splice()
|
|
|
+ }
|
|
|
}else{
|
|
|
// 数量为0时,删除
|
|
|
this.chooseClick(e.index,0)
|
|
@@ -289,8 +294,10 @@
|
|
|
row.qty = 0
|
|
|
}
|
|
|
const rindex = this.chooseProductList.findIndex(item => item.id == index)
|
|
|
- this.chooseProductList.splice(rindex, 1);
|
|
|
- this.chooseList.splice(rindex, 1);
|
|
|
+ if(rindex>=0){
|
|
|
+ this.chooseProductList.splice(rindex, 1);
|
|
|
+ this.chooseList.splice(rindex, 1);
|
|
|
+ }
|
|
|
this.$u.toast(`删除成功!`);
|
|
|
}
|
|
|
},
|
|
@@ -345,11 +352,8 @@
|
|
|
}
|
|
|
},
|
|
|
// 查询列表
|
|
|
- getRow (pageNo) {
|
|
|
+ getRow () {
|
|
|
let _this = this
|
|
|
- if (pageNo) {
|
|
|
- this.pageNo = pageNo
|
|
|
- }
|
|
|
let params = {
|
|
|
pageNo: this.pageNo,
|
|
|
pageSize: this.pageSize,
|