From 790d4e42ec8badadf916ed6679d192e130eec84d Mon Sep 17 00:00:00 2001
From: luo <17530855@qq.com>
Date: Mon, 26 Jun 2023 17:07:24 +0800
Subject: [PATCH] 门店组件
---
components/store_popup/store_popup.js | 32 ++++++++++++++++++++++----------
pages/user/user_spsy/user_spsy.js | 28 +++++++++++++++++++++++++++-
pages/user/user_spsy/user_spsy.wxml | 8 +++++---
3 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/components/store_popup/store_popup.js b/components/store_popup/store_popup.js
index 2fae57f..7cf9994 100644
--- a/components/store_popup/store_popup.js
+++ b/components/store_popup/store_popup.js
@@ -65,6 +65,7 @@ Component({
is_get_guide: 0,
keyword: '', //门店搜索
sec_i: -1,//选中分类门店 下标
+ old_all_sto:null, //分类门店数据
},
/**
@@ -314,7 +315,8 @@ Component({
},
close_popup() {
this.setData({
- store: 0
+ store: 0,
+ keyword:''
})
},
//选择更多门店
@@ -609,8 +611,14 @@ Component({
} else { //分类下搜索
let sec_i = this.data.sec_i
let all_sto = this.data.all_sto
+ let old_all_sto = this.data.old_all_sto
+ if (!old_all_sto) {
+ this.setData({
+ old_all_sto:JSON.parse(JSON.stringify(all_sto))
+ })
+ }
let sec_sto = this.data.sec_sto
- let sec_arr = sec_sto.s_arr
+ let sec_arr = this.data.old_all_sto[sec_i].s_arr
let keyword = this.data.keyword
let text = 'sec_sto.s_arr'
if (keyword) {
@@ -634,12 +642,15 @@ Component({
})
}
} else {
- console.error(sec_i);
- console.log(all_sto);
- console.error(all_sto[sec_i].s_arr);
- this.setData({
- [text]: all_sto[sec_i].s_arr
- })
+ if (this.data.old_all_sto) {
+ this.setData({
+ [text]: this.data.old_all_sto[sec_i].s_arr
+ })
+ }else{
+ this.setData({
+ [text]: all_sto[sec_i].s_arr
+ })
+ }
}
@@ -667,8 +678,9 @@ Component({
// if (!th.data.sele_g) return false;
- console.error('选中的门店');
- console.error(item);
+
+
+ this.triggerEvent('callback', item)
th.setData({
def_pick_store: item,
diff --git a/pages/user/user_spsy/user_spsy.js b/pages/user/user_spsy/user_spsy.js
index 51b524f..b8b6d69 100644
--- a/pages/user/user_spsy/user_spsy.js
+++ b/pages/user/user_spsy/user_spsy.js
@@ -5,7 +5,7 @@ var ut = require('../../../utils/util');
var regeneratorRuntime = require('../../../utils/runtime.js');
Page({
- /**
+ /**
* 页面的初始数据
*/
data: {
@@ -64,6 +64,32 @@ Page({
}
}
},
+ //门店回调
+ async callback(e){
+ let item = e.detail;
+ console.log('门店信息');
+ console.log(item);
+ if (item && item.pickup_no) {
+ let qr_code_object=this.data.qr_code_object
+ let data={
+ store_id:os.stoid,//商家编号
+ user_id:getApp().globalData.user_id, //会员编号
+ storageId:item.pickup_no, //门店编号
+ writeOffCode:qr_code_object.WriteOffCode,//核销码
+ }
+ let res = await getApp().request.promisePut("/api/weshop/users/grade/storage/update", {
+ data: data
+ });
+ console.log('门店更新');
+ console.log(res);
+ }else{
+ wx.showToast({
+ title: '门店选择失败',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ },
async requestData() {
if (this.data.no_more) return false;
if (this.data.isLoading) return false;
diff --git a/pages/user/user_spsy/user_spsy.wxml b/pages/user/user_spsy/user_spsy.wxml
index e680c3b..cc46ace 100644
--- a/pages/user/user_spsy/user_spsy.wxml
+++ b/pages/user/user_spsy/user_spsy.wxml
@@ -13,8 +13,10 @@
已使用{{list[0].freebh}}
-->
已使用
-
- 选门店
+
+ 立即使用
+ 选门店
+
@@ -23,4 +25,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
--
libgit2 0.21.4