|
@@ -26,31 +26,10 @@ export default {
|
|
|
this.pageType = pageType;
|
|
this.pageType = pageType;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- onShow(){
|
|
|
|
|
- if(this.pageType == 'kd' && !this.$util.isEmpty(this.option.customId)){
|
|
|
|
|
- if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId) })
|
|
|
|
|
- }
|
|
|
|
|
- }else if(this.option.modifyProductKey){
|
|
|
|
|
- if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.option.modifyProductKey) })
|
|
|
|
|
- uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
|
|
- }
|
|
|
|
|
- }else{
|
|
|
|
|
- if(uni.getStorageSync('selectList'+this.pageType)){
|
|
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (this.autoLoad) {
|
|
|
|
|
- this.initData();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
onUnload() {},
|
|
onUnload() {},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapGetters(["getSelectInfo"]),
|
|
...mapGetters(["getSelectInfo"]),
|
|
|
- /**
|
|
|
|
|
- * 当前页面选中的商品列表
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ //当前页面选中的商品列表
|
|
|
selectList() {
|
|
selectList() {
|
|
|
return this.getSelectInfo[this.pageType] || [];
|
|
return this.getSelectInfo[this.pageType] || [];
|
|
|
},
|
|
},
|
|
@@ -132,11 +111,46 @@ export default {
|
|
|
return has;
|
|
return has;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ onShow(){
|
|
|
|
|
+ if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
|
|
+ if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId) })
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(this.option.modifyProductKey){
|
|
|
|
|
+ if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.option.modifyProductKey) })
|
|
|
|
|
+ uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(uni.getStorageSync('selectList'+this.pageType)){
|
|
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.autoLoad) {
|
|
|
|
|
+ this.initData();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
|
|
...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
|
|
|
- /**
|
|
|
|
|
- * 请求商品数据
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ //记忆已选的花材
|
|
|
|
|
+ rememberProduct(){
|
|
|
|
|
+ if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
|
|
+ //开单根据客户记住已选的花材
|
|
|
|
|
+ uni.setStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId, this.selectList)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ uni.setStorageSync('selectList'+this.pageType, this.selectList)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ //清除已记忆花材
|
|
|
|
|
+ removeMemory(customId){
|
|
|
|
|
+ if(customId){
|
|
|
|
|
+ uni.removeStorageSync('selectList'+this.pageType+'_custom_'+customId);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ uni.removeStorageSync('selectList'+this.pageType);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.resetSelectInfoByType(this.pageType);
|
|
|
|
|
+ },
|
|
|
|
|
+ //请求商品数据
|
|
|
async initData(extendInfo) {
|
|
async initData(extendInfo) {
|
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
|
try {
|
|
try {
|
|
@@ -349,24 +363,6 @@ export default {
|
|
|
this.rememberProduct()
|
|
this.rememberProduct()
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
- //记忆已选的花材
|
|
|
|
|
- rememberProduct(){
|
|
|
|
|
- if(this.pageType == 'kd' && !this.$util.isEmpty(this.option.customId)){
|
|
|
|
|
- //开单根据客户记住已选的花材
|
|
|
|
|
- uni.setStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId, this.selectList)
|
|
|
|
|
- }else{
|
|
|
|
|
- uni.setStorageSync('selectList'+this.pageType, this.selectList)
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- //清除已记忆花材
|
|
|
|
|
- removeMemory(customId){
|
|
|
|
|
- if(customId){
|
|
|
|
|
- uni.removeStorageSync('selectList'+this.pageType+'_custom_'+customId);
|
|
|
|
|
- }else{
|
|
|
|
|
- uni.removeStorageSync('selectList'+this.pageType);
|
|
|
|
|
- }
|
|
|
|
|
- this.resetSelectInfoByType(this.pageType);
|
|
|
|
|
- },
|
|
|
|
|
addCustomNumEvent(item,params1,type) {
|
|
addCustomNumEvent(item,params1,type) {
|
|
|
const list = this.selectList;
|
|
const list = this.selectList;
|
|
|
|
|
|