storeService.js
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import componentsMixin from "../../../../../mixins/componentsMixin";
import { defaultMerchantId } from "../../../../../api/environment";
import { equityApi } from "../../../../../api/api";
Component({
behaviors: [componentsMixin],
properties: {
isHome:Boolean
},
data: {
storePackageList: [],
showMorePack: false,
},
methods: {
// 获取门店套餐
getShopPackage() {
const merchantId = wx.$util.getStorageSync("srcm_shopmall_merchant_id");
const {isHome} = this.data
let newMerchantId = merchantId || defaultMerchantId;
let para = {
merchantId: newMerchantId,
};
equityApi.storePackage(para).then((res) => {
let arr = []
if(isHome&&res){
arr = res.filter(item=>{
return item.topFlag==1
})
}else{
arr = res
}
this.setData({
storePackageList: arr || [],
});
});
},
// 去套餐详情页
toPackageDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: "/packageEquity/pages/package/package?id=" + id,
});
},
openMorePack(e) {
const { show } = e.currentTarget.dataset;
this.setData({
showMorePack: !show,
});
},
},
lifetimes: {
attached() {
this.getShopPackage();
},
},
});