Commit 63cf20ec0a0f07370444189f7f1fda7918e28d2b

Authored by 后端研发-苏明海
2 parents fe9c1965 5bce1f20

Merge branch 'qa' into 'master'

Qa

See merge request !989
Showing 150 changed files with 3310 additions and 1100 deletions

Too many changes.

To preserve performance only 100 of 150 files are displayed.

... ... @@ -51,7 +51,7 @@ App({
51 51 config: null, //门店参数
52 52 config2: null, //门店配置
53 53 code: null,
54   - user_id: null,//1564704,// 10153869,// 6453964,//5682094,6520044,6520119 qa 4687 6519901
  54 + user_id: null,//5682094,6520044,6520119 qa 4687 6519901
55 55 buy_now: null,
56 56 picklist: null, //门店列表
57 57 wuliuprice: null, //物流价格表
... ... @@ -205,6 +205,7 @@ App({
205 205 this.getConfig();
206 206 },
207 207  
  208 +
208 209 //---初始化第三方----
209 210 initExt: function () {
210 211 var tt = t;
... ... @@ -671,20 +672,29 @@ App({
671 672  
672 673 //清空登录时候缓存的值
673 674 onHide: function () {
674   - this.globalData.is_test = 0;
675   - this.globalData.guide_id = null; //导购清空
676   - this.globalData.first_leader = null; //分享的会员清空
677   - this.globalData.wuliu = null; //关闭要把物流清空
678   - this.globalData.room_id = null; //关闭要把房间号关闭
679   - this.globalData.room_goods_id = null; //关闭要把物流清空
680   - this.globalData.config2 = null; //清除config2的缓存
681   - this.globalData.config = null; //清除config的缓存
682   - this.globalData.gr_index = 0; //商品分组的序列
683   - this.globalData.pk_store = null;
684   - this.globalData.wxapp_buy_obj = null;
685   - this.globalData.dis_buy_obj = null; //等级卡的购买记录
686   - this.globalData.storeFooter = null; //底部的导航
687   - this.globalData.full_screen = null; //全屏
  675 + var th=this;
  676 + setTimeout(function () {
  677 + console.log("app onhide");
  678 + console.log(th.globalData.no_clear);
  679 + if(!th.globalData.no_clear) {
  680 + th.globalData.is_test = 0;
  681 + th.globalData.guide_id = null; //导购清空
  682 + th.globalData.first_leader = null; //分享的会员清空
  683 + th.globalData.wuliu = null; //关闭要把物流清空
  684 + th.globalData.room_id = null; //关闭要把房间号关闭
  685 + th.globalData.room_goods_id = null; //关闭要把物流清空
  686 + th.globalData.config2 = null; //清除config2的缓存
  687 + th.globalData.config = null; //清除config的缓存
  688 + th.globalData.gr_index = 0; //商品分组的序列
  689 + th.globalData.pk_store = null;
  690 + th.globalData.wxapp_buy_obj = null;
  691 + th.globalData.dis_buy_obj = null; //等级卡的购买记录
  692 + th.globalData.storeFooter = null; //底部的导航
  693 + th.globalData.full_screen = null; //全屏
  694 + }else{
  695 + th.globalData.no_clear=0;
  696 + }
  697 + },600)
688 698  
689 699 },
690 700  
... ... @@ -825,9 +835,92 @@ App({
825 835 }
826 836 },
827 837  
  838 + //重复函数,统一调用,
  839 + pre_img(path){
  840 + this.globalData.no_clear=1;
  841 + wx.previewImage({
  842 + //将图片预览出来
  843 + urls: [path]
  844 + });
  845 + },
  846 + //b是数组,t是wxml元素返回的
  847 + pre_img2(b,t){
  848 + this.globalData.no_clear=1;
  849 + wx.previewImage({
  850 + current: b[t.currentTarget.dataset.id],
  851 + urls: b
  852 + });
  853 + },
828 854  
  855 + con_wx(th){
  856 + var url=th.data.sys_switch.weapp_customertype_url;
  857 + var id=th.data.sys_switch.weapp_customertype_appid;
  858 + this.globalData.no_clear=1;
  859 + wx.openCustomerServiceChat({
  860 + extInfo: {url: url},
  861 + corpId: id,
  862 + success(res) {}
  863 + })
  864 + },
829 865  
830   -
  866 + con_Service(){
  867 + var th=this;
  868 + var oss= this.globalData.setting;
  869 + this.getConfig(function(t) {
  870 + if (t.store_tel == undefined) {
  871 + th.request.get("/api/weshop/store/get/" + oss.stoid, {
  872 + isShowLoading: 1,
  873 + data: {},
  874 + success: function(rs) {
  875 + th.globalData.config = rs.data.data;
  876 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
  877 + wx.showToast({
  878 + title: "商家未设置电话",
  879 + icon: 'none',
  880 + duration: 3000
  881 + })
  882 + return false;
  883 + }
  884 + th.globalData.no_clear=1;
  885 + wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, })
  886 + }
  887 + })
  888 + } else {
  889 + th.globalData.no_clear=1;
  890 + wx.makePhoneCall({ phoneNumber: t.store_tel, })
  891 + }
  892 + });
  893 + },
  894 +
  895 + com_call(self) {
  896 + self.getTel()
  897 + .then(() => {
  898 + if(self.data.store_tel) {
  899 + wx.showModal({
  900 + title: '联系客服',
  901 + content: '客服热线:' + self.data.store_tel,
  902 + confirmText: '拨打',
  903 + success(res) {
  904 + if(res.confirm) {
  905 + getApp().globalData.no_clear = 1;
  906 + wx.makePhoneCall({
  907 + phoneNumber: self.data.store_tel,
  908 + })
  909 + };
  910 + },
  911 + });
  912 + };
  913 + });
  914 + },
  915 +
  916 + //检验能不能分享
  917 + check_can_share(){
  918 + if(!this.globalData.user_id) wx.hideShareMenu();
  919 + else wx.showShareMenu();
  920 + }
  921 +
  922 +
  923 +
831 924  
832 925  
833 926 });
... ...
app.wxss
1 1 @import './utils/weapp-icon.wxss';
2 2 @import "./utils/wxParse/wxParse.wxss";
  3 +@import './components/com_servicer/com_servicer.wxss';
3 4  
4 5 .pdt4 {
5 6 padding-top: 4rpx;
... ... @@ -743,11 +744,20 @@ background: #ffe3e2;
743 744 /* 图标字体(ty) */
744 745 @font-face {
745 746 font-family: 'iconfont'; /* Project id 2054717 */
746   - src: url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff2?t=1645781927179') format('woff2'),
747   - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff?t=1645781927179') format('woff'),
748   - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.ttf?t=1645781927179') format('truetype');
  747 + src: url('//at.alicdn.com/t/font_2054717_aefpqs97v86.woff2?t=1647056245887') format('woff2'),
  748 + url('//at.alicdn.com/t/font_2054717_aefpqs97v86.woff?t=1647056245887') format('woff'),
  749 + url('//at.alicdn.com/t/font_2054717_aefpqs97v86.ttf?t=1647056245887') format('truetype');
749 750 }
750 751  
  752 +.icon-kefu1:before {
  753 + content: "\e651";
  754 +}
  755 +
  756 +.icon-dianhua:before {
  757 + content: "\e64b";
  758 +}
  759 +
  760 +
751 761 .icon-infofill:before {
752 762 content: "\e6e6";
753 763 }
... ...
components/com_servicer/com_servicer.wxml 0 → 100644
  1 +<!-- 联系客服操作菜单 -->
  2 +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}">
  3 + <view class="pd20 t-c pr">
  4 + <text class="bold">联系客服</text>
  5 + <text class="iconfont icon-guan" bindtap="closeCS"></text>
  6 + </view>
  7 + <!-- 客服热线 -->
  8 + <view class="pd20 bdt fs30 btn2" bindtap="contactService">
  9 + <text class="iconfont icon-dianhua"></text>客服热线:
  10 + <text class="c-red">{{store_tel}}</text>
  11 + </view>
  12 + <!-- 小程序客服 -->
  13 + <block wx:if="{{sys_switch.weapp_customertype == 1}}">
  14 + <button class="pd20 bdt fs30 btn2" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  15 + <text class="iconfont icon-kefu1"></text>在线客服
  16 + </button>
  17 + </block>
  18 + <!-- 微信客服 -->
  19 + <block wx:elif="{{sys_switch.weapp_customertype == 2}}">
  20 + <view class="pd20 bdt fs30 btn2" bindtap="con_weixin">
  21 + <text class="iconfont icon-kefu1"></text>在线客服
  22 + </view>
  23 + </block>
  24 +</view>
  25 +
  26 +<view class="mask2" bindtap="closeCS"></view>
0 27 \ No newline at end of file
... ...
components/com_servicer/com_servicer.wxss 0 → 100644
  1 +/* 联系客服操作菜单 */
  2 + .action {
  3 + position: fixed;
  4 + bottom: 100rpx;
  5 + z-index: 1;
  6 + width: 100%;
  7 + background-color: white;
  8 + border-radius: 20rpx 20rpx 0 0;
  9 + }
  10 +
  11 + .action .icon-guan {
  12 + position: absolute;
  13 + left: 20rpx !important;
  14 + right: auto !important;
  15 + padding: 10rpx 20rpx 10rpx 10rpx;
  16 + }
  17 +
  18 + .action .iconfont {
  19 + color: #ff7295;
  20 + margin-right: 10rpx;
  21 + }
  22 +
  23 + .action button {
  24 + text-align: left;
  25 + line-height: normal;
  26 + }
  27 +
  28 + .action button::after {
  29 + border-width: 0;
  30 + }
  31 +
  32 + .action .btn2 {
  33 + box-sizing: border-box;
  34 + height: 100rpx;
  35 + display: flex;
  36 + align-items: center;
  37 + }
  38 +
  39 + .mask2 {
  40 + display: none;
  41 + position: fixed;
  42 + left: 0;
  43 + right: 0;
  44 + top: 0;
  45 + bottom: 0;
  46 + background-color: rgba(0,0,0,.5);
  47 + }
  48 +
  49 + .action.active ~ .mask2 {
  50 + display: block;
  51 + }
0 52 \ No newline at end of file
... ...
components/diy_scan/diy_scan.js
... ... @@ -26,6 +26,7 @@ Component({
26 26 //-- 扫描成功之后 --
27 27 getScancode:function(){
28 28 var _this = this;
  29 + getApp().globalData.no_clear=1;
29 30 //-- 允许从相机和相册扫码 --
30 31 wx.scanCode({
31 32 success: (res) => {
... ...
components/diy_seckill/diy_seckill.js
... ... @@ -78,23 +78,26 @@ Component({
78 78 // 这里是一个自定义方法
79 79 customMethod: function () { },
80 80 init: function (g_id) {
81   - var th = this, app = getApp(), goodsidlist = "";
  81 + var th = this, app = getApp(), goodsidlist = "", idlist = "";
82 82 if (g_id.data_type == 2) {
83 83 if (g_id.data && g_id.data.length > 0) {
84 84 //--先把商品ID串起来--
85 85 g_id.data.forEach(function (val, ind) {
86 86 var item = {};
87 87 goodsidlist += val.goodsid + ",";
  88 + idlist += val.flashid + ",";
88 89 })
89 90 goodsidlist = ut.sub_last(goodsidlist);
  91 + idlist = ut.sub_last(idlist);
90 92  
91 93 var user_id=getApp().globalData.user_id;
92 94 if(!user_id){ user_id=0;}
93 95  
94 96 //--调用接口,读取秒杀--
95   - app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id="
96   - + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1", {}).then(res => {
97   - console.log(res);
  97 + // var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1";
  98 + var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&idlist=" + idlist + "&user_id="+user_id+"&type=1";
  99 + app.request.promiseGet(gUrl, {}).then(res => {
  100 +
98 101 //如果秒杀的数组为空的时候
99 102 var goodslist = res.data.data;
100 103 //就算是添加的活动已经过期,就要用最新的进行中活动
... ... @@ -153,16 +156,51 @@ Component({
153 156 for(let i in all_array){
154 157 let item=all_array[i];
155 158 if(item.user_price) item.price=item.user_price;
  159 + if(item.start_time > newTime) {
  160 + item.status = 0;
  161 + } else if(item.end_time > newTime) {
  162 + item.status = 1;
  163 + };
  164 +
156 165 }
  166 +
  167 +
  168 + var promisies = [];
  169 + for (const key in all_array) {
  170 + if (Object.hasOwnProperty.call(all_array, key)) {
  171 + const val = all_array[key];
  172 + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  173 + os.stoid + "/1/" + val.id,
  174 + {}
  175 + ).then(res => {
  176 + if (res.data.code == 0) {
  177 + if (res.data.data <= 0) all_array[key].status = 2;
  178 + };
  179 + });
  180 + }
  181 + }
157 182  
158   - var arr = new Array();
159   - //--三个三个一组---
160   - for (var i = 0; i < all_array.length; i += 3) {
161   - arr.push(all_array.slice(i, i + 3));
162   - }
163   - /*--熏染到前台--*/
164 183  
165   - th.setData({ goods_array: arr });
  184 + Promise.all(promisies).then(() => {
  185 +
  186 + // 判断活动是否结束
  187 + for(let i in all_array){
  188 + let item=all_array[i];
  189 + if(newTime > item.end_time) {
  190 + all_array[i].status = 3;
  191 + };
  192 +
  193 + }
  194 +
  195 + var arr = new Array();
  196 + //--三个三个一组---
  197 + for (var i = 0; i < all_array.length; i += 3) {
  198 + arr.push(all_array.slice(i, i + 3));
  199 + }
  200 + /*--熏染到前台--*/
  201 + th.setData({ goods_array: arr });
  202 + });
  203 +
166 204  
167 205 th.data.timer = setInterval(function () {
168 206 th.countDown2(th);
... ...
components/diy_seckill/diy_seckill.wxml
... ... @@ -16,17 +16,17 @@
16 16 <swiper-item class="s_it" wx:for="{{goods_array}}">
17 17 <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind">
18 18 <!-- <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&prom_type=1&prom_id={{aitem.id}}" class="s1_gk_a1"> -->
19   - <navigator url="{{aitem.goods_type == 0 ? ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id):('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id )}}" class="s1_gk_a1">
  19 + <navigator url="{{aitem.goods_type == 1 ? ('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id ) : ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id)}}" class="s1_gk_a1">
20 20 <view class='one'>
21 21 <view class='sp_top'>
22 22 <view class='po'></view>
23   - <block wx:if="{{aitem.start_time>newTime}}">
  23 + <block wx:if="{{aitem.status == 0}}">
24 24 <view class="rob" style="justify-content: flex-start">
25 25 <span class='s_top_kill' style="background-color: #ffe718;color: #3c3b31;font-weight: bold">即将开始</span>
26 26 </view>
27 27 </block>
28 28  
29   - <block wx:if="{{aitem.end_time<=newTime}}">
  29 + <!-- <block wx:if="{{aitem.end_time<=newTime}}">
30 30 <view class="rob" style="justify-content: flex-start">
31 31 <span class='s_top_kill gray'>活动已结束</span>
32 32 </view>
... ... @@ -42,7 +42,24 @@
42 42 <span class='s_top_kill gray'>已抢光</span>
43 43 </view>
44 44 </block>
  45 + </block> -->
  46 +
  47 +
  48 + <block wx:if="{{aitem.status == 1}}">
  49 + <view class="rob" style="justify-content: flex-start">
  50 + <span class='s_top_kill'>火热进行</span>
  51 + </view>
  52 + </block>
  53 + <block wx:if="{{aitem.status == 2}}">
  54 + <view class="rob" style="justify-content: flex-start">
  55 + <span class='s_top_kill gray'>已抢光</span>
  56 + </view>
45 57 </block>
  58 + <block wx:if="{{aitem.status == 3}}">
  59 + <view class="rob" style="justify-content: flex-start">
  60 + <span class='s_top_kill gray'>活动已结束</span>
  61 + </view>
  62 + </block>
46 63  
47 64  
48 65  
... ... @@ -81,7 +98,7 @@
81 98 <block wx:for="{{goods_array}}">
82 99 <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind">
83 100 <!-- <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&prom_type=1&prom_id={{aitem.id}}" class="s1_gk_a1"> -->
84   - <navigator url="{{aitem.goods_type == 0 ? ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id):('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id )}}" class="s1_gk_a1">
  101 + <navigator url="{{aitem.goods_type == 1 ? ('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id ) : ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id)}}" class="s1_gk_a1">
85 102 <view class='one1'>
86 103  
87 104 <view class="o1_img">
... ... @@ -101,25 +118,25 @@
101 118 <view class='sp_jg'>¥{{aitem.price}}</view>
102 119 <view class='sp_jgx'>¥{{aitem.market_price}}</view>
103 120 </view>
104   - <block wx:if="{{aitem.start_time>newTime}}">
  121 + <block wx:if="{{aitem.status == 0}}">
105 122 <view class="rob">
106 123 <view class="wo" style="background-color: #adadad">正在预热</view>
107 124 </view>
108 125 </block>
109 126  
110   - <block wx:if="{{aitem.end_time<newTime}}">
  127 + <block wx:if="{{aitem.status == 3}}">
111 128 <view class="rob">
112 129 <view class="wo" style="background-color: #adadad">已结束</view>
113 130 </view>
114 131 </block>
115 132 <block wx:else>
116   - <block wx:if="{{aitem.start_time<newTime && aitem.goods_num>aitem.buy_num}}">
  133 + <block wx:if="{{aitem.status == 1}}">
117 134 <view class="rob">
118 135 <view class="wo">我要抢</view>
119 136 </view>
120 137 </block>
121 138  
122   - <block wx:if="{{aitem.goods_num<=aitem.buy_num}}">
  139 + <block wx:if="{{aitem.status == 2}}">
123 140 <view class="rob">
124 141 <view class="wo" style="background-color: #adadad">已抢光</view>
125 142 </view>
... ...
components/diy_service/diy_service.js
... ... @@ -38,35 +38,16 @@ Component({
38 38  
39 39 //---------联系客服------------
40 40 contactService: function() {
41   - getApp().getConfig(function(t) {
42   - if (t.store_tel == undefined) {
43   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
44   - isShowLoading: 1,
45   - data: {},
46   - success: function(rs) {
47   - getApp().globalData.config = rs.data.data;
48   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
49   - getApp().my_warnning("商家未设置电话", 0, th);
50   - return false;
51   - }
52   - wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, })
53   - }
54   - })
55   - } else {
56   - wx.makePhoneCall({ phoneNumber: t.store_tel, })
57   - }
58   - });
59   - },
  41 + getApp().con_Service();
  42 + },
60 43  
61 44 //---------联系微信客服------------
62 45 con_weixin:function () {
63   - var url=this.data.sys_switch.weapp_customertype_url;
64   - var id=this.data.sys_switch.weapp_customertype_appid;
65   - wx.openCustomerServiceChat({
66   - extInfo: {url: url},
67   - corpId: id,
68   - success(res) {}
69   - })
  46 + getApp().con_wx(this);
  47 + },
  48 +
  49 + click_contact:function () {
  50 + getApp().globalData.no_clear=1;
70 51 }
71 52 }
72 53 })
... ...
components/diy_service/diy_service.wxml
... ... @@ -8,7 +8,7 @@
8 8 </view>
9 9 </view>
10 10  
11   - <button wx:else class="custom-service" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  11 + <button wx:else class="custom-service" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
12 12 <view style="text-align: center;">
13 13 <image class="cs-img" src="{{object.img}}"></image>
14 14 <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
... ...
components/nav_b/nav_b.wxss
... ... @@ -26,6 +26,9 @@
26 26 color: #ffff;
27 27 font-size: 50rpx;
28 28 background: none;
  29 + display: flex;
  30 + justify-content: center;
  31 + align-items: center;
29 32 }
30 33  
31 34 .box_main .dian image {
... ...
packageA/pages/activity_share/activity_share.js
... ... @@ -125,7 +125,7 @@ Page({
125 125 /**
126 126 * 生命周期函数--监听页面显示
127 127 */
128   - onShow: function () {},
  128 + onShow: function () { getApp().check_can_share(); },
129 129 /**
130 130 * 生命周期函数--监听页面隐藏
131 131 */
... ... @@ -141,9 +141,10 @@ Page({
141 141 /**
142 142 * 用户点击右上角分享
143 143 */
144   - onShareAppMessage: function () {
145   - console.log('abc');
146   - var th = this;
  144 + onShareAppMessage: function () {
  145 + getApp().globalData.no_clear=1;
  146 +
  147 + var th = this;
147 148 //礼包的转发
148 149 if(th.data.currentIndex==3) {
149 150 var lbid=th.data.hui_active.lbId;
... ... @@ -1054,10 +1055,8 @@ Page({
1054 1055 })
1055 1056 return false;
1056 1057 }
1057   - wx.previewImage({
1058   - //将图片预览出来
1059   - urls: [that.data.shareImgPath]
1060   - });
  1058 + getApp().pre_img(that.data.shareImgPath);
  1059 +
1061 1060 //-- 将商品清空 --
1062 1061 th.setData({share_good:null});
1063 1062  
... ...
packageA/pages/addCustomer/addCustomer.js
... ... @@ -26,7 +26,7 @@ Page({
26 26 * 生命周期函数--监听页面显示
27 27 */
28 28 onShow: function () {
29   -
  29 + getApp().check_can_share();
30 30 },
31 31  
32 32 /**
... ... @@ -60,7 +60,7 @@ Page({
60 60 /**
61 61 * 用户点击右上角分享
62 62 */
63   - onShareAppMessage: function () {
64   -
65   - }
  63 + onShareAppMessage: function () {
  64 + getApp().globalData.no_clear=1
  65 + }
66 66 })
67 67 \ No newline at end of file
... ...
packageA/pages/cardDetails/cardDetails.js
... ... @@ -39,6 +39,7 @@ Page({
39 39 * 生命周期函数--监听页面显示
40 40 */
41 41 onShow: function () {
  42 + getApp().check_can_share();
42 43 if(app.globalData.userInfo) {
43 44 if(!this.data.isLogin) {
44 45 this.setData({
... ... @@ -92,7 +93,7 @@ Page({
92 93 /**
93 94 * 用户点击右上角分享
94 95 */
95   - onShareAppMessage: function () {
  96 + onShareAppMessage: function () { getApp().globalData.no_clear=1
96 97  
97 98 }
98 99 })
99 100 \ No newline at end of file
... ...
packageA/pages/cardList/cardList.js
... ... @@ -52,6 +52,7 @@ Page({
52 52 * 生命周期函数--监听页面显示
53 53 */
54 54 onShow: function () {
  55 + getApp().check_can_share();
55 56 let url = '/api/weshop/serviceCard/page';
56 57 let currentQuery = this.data.currentQuery;
57 58 if(app.globalData.userInfo) {
... ... @@ -134,7 +135,7 @@ Page({
134 135 /**
135 136 * 用户点击右上角分享
136 137 */
137   - onShareAppMessage: function () {
  138 + onShareAppMessage: function () { getApp().globalData.no_clear=1
138 139  
139 140 },
140 141  
... ...
packageA/pages/cardList/cardList.wxml
... ... @@ -29,7 +29,7 @@
29 29 </block>
30 30 <!-- 一列和俩列 -->
31 31 <block wx:else>
32   - <view class="pd20 flex-set" style="background-color: #{{object.bg_color}};">
  32 + <view class="pd20 flex-set" style="background-color: {{object.bg_color}};">
33 33 <!-- 1列 2列 -->
34 34 <view wx:for="{{list.pageData}}" class="{{object.column=='1'?'w100':'w50'}} {{index%2==1?'ml':''}} bg-white"
35 35 bindtap="go_goods" data-gid="{{item.id}}"
... ...
packageA/pages/cart2_ser/cart2_ser.js
... ... @@ -477,14 +477,34 @@ Page({
477 477 getApp().showWarning("未找到门店");
478 478 return false;
479 479 }
480   - var goods = {
481   - 'card_id': gg.service_id,
482   - 'itemid': gg.erpItemID,
483   - 'qty': gg.goods_num,
484   - 'price': gg.money,
485   - 'pickup_id': gg.pick_id,
486   - 'pickup_keyid': list[i].keyid,
487   - };
  480 +
  481 +
  482 + if (gg.prom_type == 1 && gg.is_pd_normal == 0) {
  483 + // 秒杀活动购买
  484 + var goods = {
  485 + 'card_id': gg.service_id,
  486 + 'itemid': gg.erpItemID,
  487 + 'qty': gg.goods_num,
  488 + 'price': gg.money,
  489 + 'pickup_id': gg.pick_id,
  490 + 'pickup_keyid': list[i].keyid,
  491 + 'prom_type': gg.prom_type, //促销活动类型
  492 + 'prom_id': gg.prom_id, //促销活动id
  493 + };
  494 + } else {
  495 + // 普通购买
  496 + var goods = {
  497 + 'card_id': gg.service_id,
  498 + 'itemid': gg.erpItemID,
  499 + 'qty': gg.goods_num,
  500 + 'price': gg.money,
  501 + 'pickup_id': gg.pick_id,
  502 + 'pickup_keyid': list[i].keyid,
  503 + };
  504 + }
  505 +
  506 +
  507 +
488 508 //--导购分享过来的id--
489 509 if (gg.guide_id) {
490 510 goods.guide_id = gg.guide_id;
... ...
packageA/pages/chongzhi/chongzhi.js
... ... @@ -64,7 +64,7 @@ Page({
64 64 * 生命周期函数--监听页面显示
65 65 */
66 66 onShow: function () {
67   -
  67 + getApp().check_can_share();
68 68 },
69 69  
70 70 /**
... ... @@ -106,7 +106,7 @@ Page({
106 106 /**
107 107 * 用户点击右上角分享
108 108 */
109   - onShareAppMessage: function () {
  109 + onShareAppMessage: function () { getApp().globalData.no_clear=1
110 110  
111 111 },
112 112  
... ...
packageA/pages/chongzhiDetails/chongzhiDetails.js
... ... @@ -105,7 +105,7 @@ Page({
105 105 * 生命周期函数--监听页面显示
106 106 */
107 107 onShow: function () {
108   -
  108 + getApp().check_can_share();
109 109 },
110 110  
111 111 /**
... ... @@ -125,7 +125,7 @@ Page({
125 125 /**
126 126 * 用户点击右上角分享
127 127 */
128   - onShareAppMessage: function () {
  128 + onShareAppMessage: function () { getApp().globalData.no_clear=1
129 129  
130 130 },
131 131  
... ...
packageA/pages/choujiang/choujiang.js
... ... @@ -26,7 +26,7 @@ Page({
26 26 * 生命周期函数--监听页面显示
27 27 */
28 28 onShow: function () {
29   -
  29 + getApp().check_can_share();
30 30 },
31 31  
32 32 /**
... ... @@ -60,7 +60,7 @@ Page({
60 60 /**
61 61 * 用户点击右上角分享
62 62 */
63   - onShareAppMessage: function () {
  63 + onShareAppMessage: function () { getApp().globalData.no_clear=1
64 64  
65 65 }
66 66 })
67 67 \ No newline at end of file
... ...
packageA/pages/details_serviceCard/details_serviceCard.js
... ... @@ -42,6 +42,7 @@ Page({
42 42 * 生命周期函数--监听页面显示
43 43 */
44 44 onShow: function() {
  45 + getApp().check_can_share();
45 46 if (app.globalData.userInfo) {
46 47 if (!this.data.isLogin) {
47 48 this.setData({
... ... @@ -112,7 +113,7 @@ Page({
112 113 * 用户点击右上角分享
113 114 */
114 115 onShareAppMessage: function() {
115   -
  116 + getApp().globalData.no_clear=1
116 117 },
117 118  
118 119  
... ... @@ -163,6 +164,7 @@ Page({
163 164  
164 165 // 联系微信客服
165 166 contact_wx() {
  167 + getApp().globalData.no_clear=1;
166 168 var url = this.data.sys_switch.weapp_customertype_url;
167 169 var id = this.data.sys_switch.weapp_customertype_appid;
168 170 wx.openCustomerServiceChat({
... ... @@ -177,24 +179,7 @@ Page({
177 179  
178 180 // 联系电话客服
179 181 contactService() {
180   - app.getConfig(function(t) {
181   - if (t.store_tel == undefined) {
182   - app.request.get('/api/weshop/store/get/' + os.stoid, {
183   - isShowLoading: 1,
184   - data: {},
185   - success: function(rs) {
186   - app.globalData.config = rs.data.data;
187   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
188   - app.my_warnning('商家未设置电话', 0, self);
189   - return false;
190   - }
191   - app.confirmBox('请联系客服:' + rs.data.data.store_tel);
192   - }
193   - })
194   - } else {
195   - app.confirmBox('请联系客服:' + t.store_tel);
196   - }
197   - });
  182 + getApp().con_Service();
198 183 },
199 184  
200 185  
... ... @@ -243,7 +228,7 @@ Page({
243 228  
244 229  
245 230 // 再来一单
246   - buy2(t) {
  231 + buy2: async function(t) {
247 232 let details = this.data.details;
248 233 var th = this;
249 234 var ind = 1; // 1:加入购物车
... ... @@ -251,7 +236,7 @@ Page({
251 236 // var action= t.currentTarget.dataset.action;
252 237 var action = 'add'; //
253 238 // if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
254   -
  239 + var user_id = getApp().globalData.user_id;
255 240 th.setData({
256 241 open_ind_store: ind
257 242 });
... ... @@ -276,83 +261,172 @@ Page({
276 261 // th.buyNow(newd);
277 262 } else {
278 263  
279   - var newd = {
280   - // service_id: th.data.data.id,
281   - // service_sn:th.data.data.service_sn,
282   - // service_name:th.data.data.goods_name,
283   - // goods_num: th.data.goodsInputNum,
284   - // pick_id: th.data.sto_sele_id,
285   - // user_id:oo.user_id,
286   - // store_id:os.stoid,
287   - // money:th.data.data.shop_price,
288   -
289   - service_id: details.list[0].card_id,
290   - service_sn: details.list[0].service_sn,
291   - service_name: details.list[0].service_name,
292   - goods_num: details.list[0].qty,
293   - pick_id: details.list[0].pickup_id,
294   - user_id: this.data.userInfo.user_id,
295   - store_id: app.globalData.setting.stoid,
296   - money: details.list[0].price,
297   - };
298   - if (getApp().globalData.guide_id) {
299   - newd['guide_id'] = getApp().globalData.guide_id;
300   - newd['guide_type'] = 0;
301   - }
  264 + var len = details.list.length;
  265 + // 底导航购物车红点显示的数量
  266 + var c_num = 0;
  267 + // 多商品
  268 + for (let i = 0; i < len; i++) {
  269 +
  270 + var newd = {
  271 + // service_id: th.data.data.id,
  272 + // service_sn:th.data.data.service_sn,
  273 + // service_name:th.data.data.goods_name,
  274 + // goods_num: th.data.goodsInputNum,
  275 + // pick_id: th.data.sto_sele_id,
  276 + // user_id:oo.user_id,
  277 + // store_id:os.stoid,
  278 + // money:th.data.data.shop_price,
  279 +
  280 + service_id: details.list[i].card_id,
  281 + service_sn: details.list[i].service_sn,
  282 + service_name: details.list[i].service_name,
  283 + goods_num: details.list[i].qty,
  284 + pick_id: details.list[i].pickup_id,
  285 + user_id: user_id,
  286 + store_id: app.globalData.setting.stoid,
  287 + money: details.list[i].price,
  288 + };
  289 + if (getApp().globalData.guide_id) {
  290 + newd['guide_id'] = getApp().globalData.guide_id;
  291 + newd['guide_type'] = 0;
  292 + };
  293 + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
  294 + if(details.list[i].prom_type == 1) {
  295 + newd['prom_type'] = details.list[i].prom_type;
  296 + newd['prom_id'] = details.list[i].prom_id;
  297 + };
302 298  
303   - //----先看会员在购物车中是否加入了该商品-----
304   - app.request.get("/api/weshop/cartService/page", {
305   - data: {
306   - store_id: app.globalData.setting.stoid,
307   - user_id: this.data.userInfo.user_id,
308   - service_id: details.list[0].card_id,
309   - pick_id: details.list[0].pickup_id,
310   - },
311   - success: function(re) {
312   -
313   - //-------如果购物车中有相关的数据---------
314   - if (re.data.data.total > 0) {
315   - var item = re.data.data.pageData[0];
316   - var updata = {
317   - id: item.id,
318   - goods_num: details.list[0].qty + item.goods_num,
319   - money: details.list[0].price,
320   - store_id: app.globalData.setting.stoid,
321   - };
  299 + var prom_id = details.list[i].prom_id > 0 ? details.list[i].prom_id : 0;
  300 + var card_id = details.list[i].card_id;
  301 + var prom_type = details.list[i].prom_type > 0 ? details.list[i].prom_type : 0;
  302 + var is_pd_normal = details.list[i].is_pd_normal;
  303 + // 库存
  304 + var redisNums = 0;
  305 + // 限购数
  306 + var limitNum = 0;
  307 + // 已购买数量
  308 + var boughtNum = 0;
  309 +
  310 + // 秒杀活动中购买
  311 + if (prom_type == 1 && !is_pd_normal) {
  312 +
  313 + // 获取已购数量
  314 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+os.stoid+"&user_id="+getApp().globalData.user_id+"&card_id="+card_id+"&prom_type="+prom_type+"&prom_id="+prom_id, {
  315 + }).then(res => {
  316 + boughtNum = !res.data.data.promcardbuynum ? 0 : res.data.data.promcardbuynum;
  317 + });
  318 +
  319 + // 获取库存
  320 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => {
  321 + if (res.data.code == 0) {
  322 + redisNums = !res.data.data ? 0 : res.data.data;
  323 + };
  324 + });
322 325  
323   - if (getApp().globalData.guide_id) {
324   - updata['guide_id'] = getApp().globalData.guide_id;
325   - updata['guide_type'] = 1;
326   - }
327   - getApp().request.put("/api/weshop/cartService/update", {
328   - data: updata,
329   - success: function(t) {
330   - // getApp().my_warnning('加入购物车成功', 1, th, 450);
331   - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
332   - th.setData({
333   - cartGoodsNum: c_num
  326 + // 获取限购数
  327 + var is_end = 1;
  328 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, {}).then(res => {
  329 + if (res.data.code == 0) {
  330 + is_end = res.data.data.is_end;
  331 + limitNum = res.data.data.buy_limit;
  332 + }
  333 + });
  334 + // 判断活动是否结束
  335 + if (is_end == 1) {
  336 + wx.showModal({
  337 + title: details.list[i].service_name + '\n\t活动已经结束',
334 338 });
335   - app.goto('/pages/cart/cart/cart');
336   - // th.closeSpecModal();
  339 + return false;
337 340 }
338   - });
339   - } else {
340 341  
341   - getApp().request.post("/api/weshop/cartService/save", {
342   - data: newd,
343   - success: function(t) {
344   - // getApp().my_warnning('加入购物车成功', 1, th, 450);
345   - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
346   - th.setData({
347   - cartGoodsNum: c_num
  342 +
  343 + var snum = limitNum - boughtNum;
  344 + if (snum <= 0) {
  345 + wx.showModal({
  346 + title: '超出活动限购数量',
  347 + });
  348 + return false;
  349 + }
  350 +
  351 + }
  352 +
  353 +
  354 + //----先看会员在购物车中是否加入了该商品-----
  355 + app.request.get("/api/weshop/cartService/page", {
  356 + data: {
  357 + store_id: app.globalData.setting.stoid,
  358 + user_id: user_id,
  359 + service_id: details.list[i].card_id,
  360 + pick_id: details.list[i].pickup_id,
  361 + },
  362 + success: function(re) {
  363 + //-------如果购物车中有相关的数据---------
  364 + if (re.data.data.total > 0) {
  365 + var item = re.data.data.pageData[0];
  366 + var totalNum = details.list[i].qty + item.goods_num;
  367 +
  368 + if (prom_type == 1 && !is_pd_normal) {
  369 + // 秒杀购物车购买 修正数量 剩余购买数量
  370 + var snum = limitNum - boughtNum;
  371 +
  372 + if (totalNum >= redisNums){
  373 + if (redisNums > snum) {
  374 + totalNum = snum;
  375 + } else {
  376 + totalNum = redisNums;
  377 + }
  378 + } else {
  379 + if (totalNum > snum)
  380 + totalNum = snum;
  381 + }
  382 + }
  383 +
  384 + var updata = {
  385 + id: item.id,
  386 + goods_num: totalNum,
  387 + money: details.list[i].price,
  388 + store_id: app.globalData.setting.stoid,
  389 + };
  390 +
  391 + if (getApp().globalData.guide_id) {
  392 + updata['guide_id'] = getApp().globalData.guide_id;
  393 + updata['guide_type'] = 1;
  394 + }
  395 +
  396 + getApp().request.put("/api/weshop/cartService/update", {
  397 + data: updata,
  398 + success: function(t) {
  399 + // getApp().my_warnning('加入购物车成功', 1, th, 450);
  400 + c_num += th.data.cartGoodsNum + th.data.goodsInputNum;
  401 + th.setData({
  402 + cartGoodsNum: c_num
  403 + });
  404 +
  405 + // th.closeSpecModal();
  406 + }
  407 + });
  408 +
  409 +
  410 + } else {
  411 +
  412 + getApp().request.post("/api/weshop/cartService/save", {
  413 + data: newd,
  414 + success: function(t) {
  415 + // getApp().my_warnning('加入购物车成功', 1, th, 450);
  416 + c_num += th.data.cartGoodsNum + th.data.goodsInputNum;
  417 + th.setData({
  418 + cartGoodsNum: c_num
  419 + });
  420 +
  421 + // th.closeSpecModal();
  422 + }
348 423 });
349   - app.goto('/pages/cart/cart/cart');
350   - // th.closeSpecModal();
351 424 }
352   - });
353   - }
354   - }
355   - });
  425 + }
  426 + });
  427 +
  428 + }
  429 + app.goto('/pages/cart/cart/cart');
356 430  
357 431 }
358 432 },
... ... @@ -478,9 +552,9 @@ Page({
478 552 });
479 553 },
480 554  
481   -
482   -
483   -
  555 + click_contact:function () {
  556 + getApp().globalData.no_clear=1;
  557 + }
484 558  
485 559  
486 560  
... ...
packageA/pages/details_serviceCard/details_serviceCard.wxml
... ... @@ -57,7 +57,7 @@
57 57 <view class="flex t-c bdt">
58 58 <!-- 客服 -->
59 59 <block>
60   - <button class="f1" wx:if="{{sys_switch.weapp_customertype == 1}}" hover-class="none" open-type="contact"
  60 + <button class="f1" wx:if="{{sys_switch.weapp_customertype == 1}}" hover-class="none" open-type="contact" bindtap="click_contact"
61 61 session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"><text class="iconfont icon-kefu c29f pdr10 fs36"></text>联系客服</button>
62 62 <view class="f1 pd20" wx:elif="{{sys_switch.weapp_customertype== 2}}" bindtap="contact_wx"><text class="iconfont icon-kefu c29f pdr10 fs36"></text>联系客服</view>
63 63 <view class="f1 pd20" wx:else bindtap="contactService"><text class="iconfont icon-kefu c29f pdr10 fs36"></text>联系客服</view>
... ...
packageA/pages/distribution/card/card.js
... ... @@ -38,6 +38,7 @@ Page({
38 38 * 生命周期函数--监听页面显示
39 39 */
40 40 onShow: function () {
  41 + getApp().check_can_share();
41 42 if(app.globalData.userInfo) {
42 43 if(!this.data.isLogin) {
43 44 this.setData({
... ... @@ -92,7 +93,7 @@ Page({
92 93 /**
93 94 * 用户点击右上角分享
94 95 */
95   - onShareAppMessage: function () {
  96 + onShareAppMessage: function () { getApp().globalData.no_clear=1
96 97  
97 98 },
98 99  
... ...
packageA/pages/distribution/commision/commision.js
... ... @@ -74,6 +74,7 @@ Page({
74 74 * 生命周期函数--监听页面显示
75 75 */
76 76 onShow: function () {
  77 + getApp().check_can_share();
77 78  
78 79 if(app.globalData.userInfo) {
79 80 if(!this.data.isLogin) {
... ... @@ -149,7 +150,7 @@ Page({
149 150 /**
150 151 * 用户点击右上角分享
151 152 */
152   - onShareAppMessage: function () {
  153 + onShareAppMessage: function () { getApp().globalData.no_clear=1
153 154  
154 155 },
155 156  
... ...
packageA/pages/distribution/goods/goods.js
... ... @@ -97,6 +97,8 @@ Page({
97 97 * 生命周期函数--监听页面显示
98 98 */
99 99 onShow: function () {
  100 +
  101 + getApp().check_can_share();
100 102 let url = '/api/weshop/goods/page';
101 103 let currentQuery = this.data.currentQuery;
102 104 if(app.globalData.userInfo) {
... ... @@ -264,7 +266,7 @@ Page({
264 266 /**
265 267 * 用户点击右上角分享
266 268 */
267   - onShareAppMessage: function () {
  269 + onShareAppMessage: function () { getApp().globalData.no_clear=1
268 270  
269 271 },
270 272  
... ...
packageA/pages/distribution/myteam/myteam.js
... ... @@ -69,6 +69,7 @@ Page({
69 69 * 生命周期函数--监听页面显示
70 70 */
71 71 onShow: function () {
  72 + getApp().check_can_share();
72 73 if(app.globalData.userInfo) {
73 74 if(!this.data.isLogin) {
74 75 this.setData({
... ... @@ -157,7 +158,7 @@ Page({
157 158 /**
158 159 * 用户点击右上角分享
159 160 */
160   - onShareAppMessage: function () {
  161 + onShareAppMessage: function () { getApp().globalData.no_clear=1
161 162  
162 163 },
163 164  
... ...
packageA/pages/distribution/order/order.js
... ... @@ -78,6 +78,7 @@ Page({
78 78 * 生命周期函数--监听页面显示
79 79 */
80 80 onShow: function () {
  81 + getApp().check_can_share();
81 82 if(app.globalData.userInfo) {
82 83 if(!this.data.isLogin) {
83 84 this.setData({
... ... @@ -141,7 +142,7 @@ Page({
141 142 /**
142 143 * 用户点击右上角分享
143 144 */
144   - onShareAppMessage: function () {
  145 + onShareAppMessage: function () { getApp().globalData.no_clear=1
145 146  
146 147 },
147 148  
... ...
packageA/pages/distribution/rank/rank.js
... ... @@ -67,6 +67,7 @@ Page({
67 67 * 生命周期函数--监听页面显示
68 68 */
69 69 onShow: function () {
  70 + getApp().check_can_share();
70 71 if(app.globalData.userInfo) {
71 72 if(!this.data.isLogin) {
72 73 this.setData({
... ... @@ -151,7 +152,7 @@ Page({
151 152 /**
152 153 * 用户点击右上角分享
153 154 */
154   - onShareAppMessage: function () {
  155 + onShareAppMessage: function () { getApp().globalData.no_clear=1
155 156  
156 157 },
157 158  
... ...
packageA/pages/distribution/rookie/rookie.js
... ... @@ -58,6 +58,7 @@ Page({
58 58 * 生命周期函数--监听页面显示
59 59 */
60 60 onShow: function () {
  61 + getApp().check_can_share();
61 62 if(app.globalData.userInfo instanceof Object) {
62 63 this.setData({
63 64 userInfo: app.globalData.userInfo,
... ... @@ -112,7 +113,7 @@ Page({
112 113 /**
113 114 * 用户点击右上角分享
114 115 */
115   - onShareAppMessage: function () {
  116 + onShareAppMessage: function () { getApp().globalData.no_clear=1
116 117  
117 118 },
118 119  
... ...
packageA/pages/distribution/shop/shop.js
... ... @@ -95,6 +95,8 @@ Page({
95 95 * 生命周期函数--监听页面显示
96 96 */
97 97 onShow: function () {
  98 + getApp().check_can_share();
  99 +
98 100 //自己登录的
99 101 if (app.globalData.userInfo && !this.data.first_leader) {
100 102 if (!this.data.isLogin) {
... ... @@ -316,7 +318,7 @@ Page({
316 318 * 用户点击右上角分享
317 319 *--点击分享事件--分享我的小店
318 320 *--*/
319   - onShareAppMessage: function (t) {
  321 + onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
320 322  
321 323 var th = this;
322 324 var title = "我的小店";
... ...
packageA/pages/goodsInfo/buy_flash_normal.wxml 0 → 100644
  1 +<view bindtap="closeSpecModal_flash_normal" class="cover-layer"></view>
  2 + <view class="spec-model">
  3 + <view class="pding">
  4 + <icon bindtap="closeSpecModal_flash_normal" class="modal-close" color="black" size="22" type="cancel"></icon>
  5 + <view class="spec-goods">
  6 + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl + (data.image_url ? data.image_url:'miniapp/images/default_g_img.gif')}}" binderror="pop_err_img" data-errorimg="data.img_url"></image>
  7 + <view class="spec-goods-info">
  8 + <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view>
  9 + <view class="flex ai_end xc-val-money">
  10 + <view class="spec-goods-price">
  11 + <text class="fs20">¥</text>{{data.shop_price}}
  12 + <!-- 如果是等级会员,且有等级价 -->
  13 + <!-- <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}} </block> -->
  14 + <!-- <block wx:else>{{sele_g.shop_price}}</block> -->
  15 + </view>
  16 + </view>
  17 +
  18 + <!-- <view class="flex">
  19 + <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
  20 + <block wx:if="{{sales_rules==2}}">
  21 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view>
  22 + <view class="spec-goods-stock" wx:else>可售:0</view>
  23 + </block>
  24 + <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block>
  25 + </view> -->
  26 +
  27 +
  28 + </view>
  29 +
  30 + <!-- 选择门店模块 -->
  31 + <view class="flex-space-between address ai_end xc-width ">
  32 +
  33 + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  34 + <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
  35 + <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}">
  36 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
  37 +
  38 + </view>
  39 + </view>
  40 +
  41 + <!-- 没有门店的时候 -->
  42 + <view class="flex" bindtap="choice_store" wx:else>
  43 + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
  44 + <view class="fs30" style="color:black;">选择门店</view>
  45 + </view>
  46 +
  47 + <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view>
  48 + </view>
  49 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  50 + <block wx:else>
  51 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  52 + <block wx:else>
  53 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
  54 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
  55 + </block>
  56 + </block>
  57 + <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view>
  58 +
  59 +
  60 + <!--商品的属性项目-->
  61 + <!-- <view class="xc-goods-attribute">
  62 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
  63 + <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;">
  64 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g">
  65 + {{item.gg}}
  66 + </view>
  67 + </view>
  68 + </view> -->
  69 +
  70 + <view class="b_num">
  71 + <view>购买数量</view>
  72 + <view class="count">
  73 + <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view>
  74 + <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input>
  75 + <view bindtap="addCartNum" class="add">+</view>
  76 + </view>
  77 + </view>
  78 + </view>
  79 +
  80 +
  81 + <!-- 提示再买多少优惠 -->
  82 + <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition}}">
  83 + 再买{{hui_condition.need}}
  84 + <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text>
  85 + <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text>
  86 + <text wx:if="{{hui_condition.past==1}}">,包邮</text>
  87 + <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text>
  88 + <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text>
  89 + <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text>
  90 + <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text>
  91 + <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text>
  92 + </view>
  93 +
  94 +
  95 + <!-- 按钮部分 -->
  96 + <view class="spec-cart-btns">
  97 +
  98 + <!-- 根本就找不到门店 -->
  99 + <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
  100 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view>
  101 + </block>
  102 + <block wx:else>
  103 + <!-- 根本就找不到门店 -->
  104 + <block wx:if="{{!only_pk && !def_pickpu_list}}">
  105 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  106 + </block>
  107 + <block wx:else>
  108 +
  109 +
  110 + <block wx:if="{{only_pk.length && !only_pk.length}}">
  111 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  112 + </block>
  113 + <block wx:else>
  114 + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
  115 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  116 + </block>
  117 + <block wx:else>
  118 + <block wx:if="{{!def_pick_store}}">
  119 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
  120 + </block>
  121 + <block wx:else>
  122 + <block wx:if="{{data.store_count<=0}}">
  123 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  124 + </block>
  125 + <block wx:else>
  126 + <view class="flex jc_sb">
  127 + <view class="spec-cart-btn spec-buy w40" bindtap="addCart"
  128 + data-action="add" style="background-color: #ffb03f;">加入购物车</view>
  129 + <view class="spec-cart-btn spec-buy w40" bindtap="addCart"
  130 + data-action="buy">立即购买</view>
  131 + </view>
  132 + </block>
  133 +
  134 + </block>
  135 + </block>
  136 + </block>
  137 + </block>
  138 + </block>
  139 + </view>
  140 +
  141 + </view>
  142 + </view>
  143 + <view class="clear"></view>
0 144 \ No newline at end of file
... ...
packageA/pages/goodsInfo/goodsInfo.js
... ... @@ -8,6 +8,7 @@ var t = require(&quot;../../../utils/util.js&quot;),
8 8 oo = s.globalData,
9 9 o = s.globalData.setting,
10 10 os = o;
  11 +
11 12 let self = null;
12 13  
13 14 //评价加载更多
... ... @@ -50,7 +51,7 @@ Page({
50 51 supportPageScroll: !1,
51 52 address: {
52 53 address: "",
53   - district: 0
  54 + district: 0,
54 55 },
55 56 shipping: "",
56 57 shippingCost: 0,
... ... @@ -199,15 +200,19 @@ Page({
199 200 sales_rules:1, //默认是线上销售
200 201  
201 202 wait_for_user_store:null,
202   - poster:null, //自定义海报
203   - share_b_img:'', //自定义分享的背景
204   - showPoster: false,
205   - hui_condition:null,
206   - sto_sele_name_1:'',//分享的门店名称
  203 + poster:null, //自定义海报
  204 + share_b_img:'', //自定义分享的背景
  205 + showPoster: false,
  206 + hui_condition:null,
  207 + sto_sele_name_1:'',//分享的门店名称
207 208  
208 209 // 秒杀
209   - prom_st: 1,
  210 + prom_st: null,
210 211 prom_r_null: 0,
  212 +
  213 + hiddenCS: true, //控制客服操作菜单显示和控制
  214 +
  215 + openSpecModal_flash_normal: 0,
211 216 },
212 217  
213 218 //------初始化加载----------
... ... @@ -261,10 +266,10 @@ Page({
261 266 first_leader=gid_str[1];
262 267 }
263 268 //-- 如果有room_id的获取 --
264   - if(gid_str.length>2 && gid_str[2]){
  269 + if(gid_str.length>2 && gid_str[2]) {
265 270 room_id=gid_str[2];
266 271 room_user_share=1;
267   - }
  272 + };
268 273 };
269 274  
270 275 ee.setData({ gid: gid});
... ... @@ -278,14 +283,15 @@ Page({
278 283 }
279 284 })
280 285 }
  286 +
281 287 var c_guide_id=t.c_guide_id;
282 288 if(c_guide_id){
283 289 th.data.c_guide_id=c_guide_id;
284 290 }
285 291  
286   - getApp().getConfig(function(e) {
287   - ee.setData({sto_sele_name_1:e.store_name})
288   - })
  292 + getApp().getConfig(function(e) {
  293 + ee.setData({sto_sele_name_1:e.store_name})
  294 + })
289 295  
290 296 //----获取系统参数-----
291 297 getApp().getConfig2(function (e) {
... ... @@ -309,7 +315,7 @@ Page({
309 315 is_show_gb: 1
310 316 });
311 317 }
312   - console.log(e);
  318 + // console.log(e);
313 319 var json_d = JSON.parse(e.switch_list);
314 320 ee.setData({
315 321 store_config: e,
... ... @@ -318,6 +324,7 @@ Page({
318 324 is_newsales_rules: json_d.is_newsales_rules
319 325 });
320 326 ee.init(gid);
  327 +
321 328 //------几人评价-------
322 329 //n.init(th, "", "comments");
323 330  
... ... @@ -370,7 +377,7 @@ Page({
370 377  
371 378 //获取用户的默认门店
372 379 getApp().get_user_store(function(e) {
373   - if(!e) {
  380 + if(!e) {
374 381 th.data.fir_def_store={}; //赋值空对象
375 382 return false;
376 383 }
... ... @@ -431,7 +438,7 @@ Page({
431 438 appd.lat=that.data.lat;
432 439 appd.lon=that.data.lon;
433 440  
434   - }else{
  441 + } else {
435 442 if (e) {
436 443 e.distance = null;
437 444 that.data.fir_def_store=e;
... ... @@ -440,7 +447,7 @@ Page({
440 447 sto_sele_name: e.pickup_name,
441 448 sto_sele_id: e.pickup_id,
442 449 sto_sele_distr: e.distr_type,
443   - sto_sele_keyid:e.keyid,
  450 + sto_sele_keyid:e.keyid,
444 451 })
445 452 }
446 453 }
... ... @@ -449,14 +456,15 @@ Page({
449 456  
450 457 });
451 458  
452   - },
  459 +
  460 + },
453 461  
454 462  
455 463 onReady() {
456   -
457   - setTimeout(()=>{
  464 + // 用于控制保障服务折叠图标的显示
  465 + setTimeout(() => {
458 466 wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
459   - // console.log('node@@@@@@@', res);
  467 +
460 468 if(res.length != 0) {
461 469 this.setData({
462 470 showFold: res[0].height < res[1].height,
... ... @@ -517,13 +525,14 @@ Page({
517 525  
518 526 if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入
519 527 let prom_id = this.data.options.prom_id;
  528 + // 检查活动是否开始
520 529 this.check_prom(goods_id, prom_type, prom_id);
  530 +
521 531 } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数
522   - getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', {
  532 + getApp().request.promiseGet('/api/weshop/activitylist/listGoodActInfo2', {
523 533 data: {
524 534 store_id: os.stoid,
525   - goodsidlist: goods_id,
526   - is_detail: 1,
  535 + goods_id: goods_id,
527 536 goods_type: 1,
528 537 user_id: oo.user_id,
529 538 }
... ... @@ -537,26 +546,25 @@ Page({
537 546 let prom_id = result[0].act_id;
538 547 this.setData({
539 548 'options.prom_type': prom_type,
  549 + 'options.prom_id': prom_id,
540 550 });
  551 + // 检查活动是否开始
541 552 this.check_prom(goods_id, prom_type, prom_id);
542 553 } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动
543 554 this.setData({
544 555 actList: res.data.data,
545 556 });
546 557 };
547   -
548   - // console.log('!!!!!!~~~~~~~~~prom~~~~~~~~~~!!!!!!');
549   -
550   - // this.setData({
551   - // prom,
552   - // });
553   -
  558 +
554 559 };
555 560 });
556 561 };
557 562 // <---- 秒杀
558 563  
559 564  
  565 +
  566 +
  567 +
560 568  
561 569  
562 570  
... ... @@ -662,6 +670,9 @@ Page({
662 670 //---展示---
663 671 // gid 在onload阶段已经保存在this.data中
664 672 onShow: function() {
  673 +
  674 + getApp().check_can_share();
  675 +
665 676 var that=this;
666 677 var ee = this,gid = this.data.gid, i = getApp().request;
667 678 this.data.is_timer = 1;
... ... @@ -669,8 +680,6 @@ Page({
669 680  
670 681  
671 682  
672   -
673   -
674 683  
675 684 i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, {
676 685 failRollback: !0,
... ... @@ -700,6 +709,7 @@ Page({
700 709 that.setData({
701 710 'data.goods_name': t.data.data.serviceName,
702 711 'data.shop_price': t.data.data.money,
  712 + 'data.show_price': t.data.data.show_price,
703 713 'data.validDays': t.data.data.validDays,
704 714 'data.serviceContent': t.data.data.serviceContent,
705 715 'data.image_url': t.data.data.imgUrl,
... ... @@ -744,6 +754,9 @@ Page({
744 754 };
745 755 }
746 756 });
  757 +
  758 +
  759 +
747 760 this.data.enterAddressPage && (this.data.enterAddressPage = !1);
748 761 this.get_sto();
749 762  
... ... @@ -815,10 +828,11 @@ Page({
815 828 activeCategoryId: 1
816 829 });
817 830 },
  831 +
818 832  
819   -
  833 +
820 834 //------------加入购物车--------------
821   - addCart: function(t) {
  835 + addCart: async function(t) {
822 836 var th = this;
823 837 var ind = t.currentTarget.dataset.openSpecModal_ind;
824 838 var action= t.currentTarget.dataset.action;
... ... @@ -828,10 +842,98 @@ Page({
828 842 open_ind_store: ind
829 843 });
830 844  
831   - if(!th.data.sto_sele_name){
  845 + if(!th.data.sto_sele_name) {
832 846 getApp().my_warnning('请选择门店', 1, th, 450);
833 847 return false;
834   - }
  848 + };
  849 +
  850 + // 库存
  851 + var redisNums = 0;
  852 + // 限购数
  853 + var limitNum = 0;
  854 + // 已购买数量
  855 + var boughtNum = 0;
  856 +
  857 + // 秒杀活动
  858 + if(this.data.prom_type == 1) {
  859 + // 如果是秒杀活动下的单独购买,is_normal为1
  860 + if(this.data.openSpecModal_flash_normal) this.data.is_normal = 1;
  861 +
  862 + if(!this.data.is_normal) {// 秒杀购买
  863 +
  864 + // 获取redis当前可以购买的数量
  865 + // 如果数量为0,设置和显示已抢光
  866 + // 否则,进一步判断是否超出限购或超出库存
  867 + await this.getactLen().then(async function(res) {
  868 + redisNums = res;
  869 + let curNum = th.data.goodsInputNum;
  870 + // res: redis可购买数量
  871 + console.log('当前可以购买的数量:', res);
  872 + if(res <= 0) {
  873 + // 可购买数量<=0, 设置和显示已抢光
  874 + th.setData({
  875 + prom_r_null: 1,
  876 + });
  877 + wx.showModal({
  878 + title: '超出活动库存',
  879 + });
  880 + return false;
  881 + } else {
  882 + // 可购买数量>0
  883 + // 计算自己还可以购买的数量
  884 + // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b
  885 + // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存
  886 + // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购
  887 + let actInfo = th.data.sele_g;
  888 + await th.get_buy_num2().then(function (data) {
  889 + let limited = actInfo.buy_limit; // 限购数量a
  890 + let promcardbuynum = data.data.data.promcardbuynum;
  891 + let buyedNum = promcardbuynum; // 自己已经购买的数量b
  892 + let canBuyNum = limited - buyedNum; // 自己还可购买的数量c
  893 + limitNum = limited;
  894 + boughtNum = buyedNum;
  895 +
  896 + if(canBuyNum <= 0) {
  897 + canBuyNum = 0;
  898 + };
  899 +
  900 + if(limited > res) {
  901 + if(curNum > res) { // t当前增减的数量
  902 + wx.showModal({
  903 + title: '超出活动库存',
  904 + });
  905 + th.setData({
  906 + goodsInputNum: res,
  907 + });
  908 + return false;
  909 + };
  910 + };
  911 +
  912 + if(limited <= res) {
  913 + if(curNum > limited) {
  914 + wx.showModal({
  915 + title: '超出限购数量',
  916 + });
  917 + th.setData({
  918 + goodsInputNum: canBuyNum,
  919 + });
  920 + return false;
  921 + };
  922 + };
  923 +
  924 +
  925 + });
  926 +
  927 +
  928 +
  929 + };
  930 + });
  931 +
  932 + };
  933 +
  934 +
  935 + };
  936 +
835 937  
836 938  
837 939 if(action=="buy"){
... ... @@ -850,12 +952,17 @@ Page({
850 952 newd['prom_type'] = this.data.prom_type;
851 953 newd['prom_id'] = this.data.prom_id;
852 954 newd['prom_price'] = this.data.prom_price;
853   - }
  955 + };
  956 +
  957 + if(this.data.prom_type == 1 && this.data.openSpecModal_flash_normal) {
  958 + newd['prom_type'] = 0;
  959 + newd['prom_price'] = this.data.data.shop_price;
  960 + };
854 961  
855 962 // console.log('newd++++++++', newd);
856 963 th.buyNow(newd);
857 964 } else {
858   -
  965 +
859 966 var newd = {
860 967 service_id: th.data.data.id,
861 968 service_sn:th.data.data.service_sn,
... ... @@ -864,12 +971,24 @@ Page({
864 971 pick_id: th.data.sto_sele_id,
865 972 user_id:oo.user_id,
866 973 store_id:os.stoid,
867   - money:th.data.data.shop_price
  974 + money:th.data.data.shop_price,
868 975 };
869   - if(getApp().globalData.guide_id){
  976 + if(getApp().globalData.guide_id) {
870 977 newd['guide_id'] = getApp().globalData.guide_id;
871 978 newd['guide_type']=0;
872   - }
  979 + };
  980 + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
  981 + if(th.data.options.prom_type == 1) {
  982 + newd['prom_type'] = th.data.options.prom_type;
  983 + newd['prom_id'] = th.data.options.prom_id;
  984 + if(th.data.openSpecModal_flash_normal) {
  985 + newd['money'] = th.data.data.shop_price;
  986 + newd['is_pd_normal'] = 1;
  987 + } else {
  988 + newd['money'] = th.data.prom_price;
  989 + };
  990 + };
  991 +
873 992  
874 993 //----先看会员在购物车中是否加入了该商品-----
875 994 getApp().request.get("/api/weshop/cartService/page", {
... ... @@ -883,13 +1002,48 @@ Page({
883 1002  
884 1003 //-------如果购物车中有相关的数据---------
885 1004 if (re.data.data.total > 0) {
886   - var item = re.data.data.pageData[0];
  1005 + var item = re.data.data.pageData[0];
  1006 + var totalNum = th.data.goodsInputNum + item.goods_num;
  1007 +
  1008 + // 秒杀购物车购买 修正数量
  1009 + if (th.data.prom_type == 1 && !th.data.is_normal) {
  1010 + var snum = limitNum - boughtNum;
  1011 + if (snum <= 0) {
  1012 + wx.showModal({
  1013 + title: '超出限购数量',
  1014 + });
  1015 + return false;
  1016 + }
  1017 + if (totalNum >= redisNums){
  1018 + if (redisNums > snum) {
  1019 + totalNum = snum;
  1020 + } else {
  1021 + totalNum = redisNums;
  1022 + }
  1023 + } else {
  1024 + if (totalNum > snum)
  1025 + totalNum = snum;
  1026 + }
  1027 + }
  1028 +
887 1029 var updata = {
888 1030 id: item.id,
889   - goods_num: th.data.goodsInputNum + item.goods_num,
  1031 + goods_num: totalNum,
890 1032 money: th.data.data.shop_price,
891 1033 store_id: os.stoid,
892 1034 };
  1035 +
  1036 + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
  1037 + if(th.data.options.prom_type == 1) {
  1038 + // updata['prom_type'] = th.data.options.prom_type;
  1039 + // updata['prom_id'] = th.data.options.prom_id;
  1040 + if(th.data.openSpecModal_flash_normal) {
  1041 + updata['money'] = th.data.data.shop_price;
  1042 + updata['is_pd_normal'] = 1;
  1043 + } else {
  1044 + updata['money'] = th.data.prom_price;
  1045 + };
  1046 + };
893 1047  
894 1048 if (getApp().globalData.guide_id) {
895 1049 updata['guide_id'] = getApp().globalData.guide_id;
... ... @@ -923,17 +1077,22 @@ Page({
923 1077 }
924 1078 });
925 1079  
926   - }
  1080 + };
  1081 +
  1082 +
  1083 +
927 1084  
928 1085  
  1086 +
  1087 +
929 1088 },
930 1089  
931 1090 //----------立即购买-----------
932 1091 buyNow: function(e) {
933   - getApp().globalData.service_now=e;
934   - wx.redirectTo({
935   - url: "/packageA/pages/cart2_ser/cart2_ser",
936   - });
  1092 + getApp().globalData.service_now=e;
  1093 + wx.redirectTo({
  1094 + url: "/packageA/pages/cart2_ser/cart2_ser",
  1095 + });
937 1096 },
938 1097 //----------增加购买数量-----------
939 1098 addCartNum: function(t) {
... ... @@ -949,22 +1108,135 @@ Page({
949 1108 },
950 1109  
951 1110 //------检查数量是不是超出限购------
952   - checkCartNum: function(t) {
953   - if(t<=0) return false;
954   - var th = this;
955   - th.setData({goodsInputNum:t})
  1111 + checkCartNum: async function(t) {
  1112 + var th = this;
  1113 +
  1114 + if(!th.data.def_pick_store) {
  1115 + wx.showModal({title: '请选择门店',});
  1116 + return false;
  1117 + };
  1118 +
  1119 + // 非秒杀活动
  1120 + if(this.data.prom_type != 1) {
  1121 + this.setData({
  1122 + goodsInputNum: t,
  1123 + });
  1124 + };
  1125 +
  1126 + // 秒杀活动
  1127 + if(this.data.prom_type == 1) {
  1128 + // 如果是秒杀活动下的单独购买,is_normal为1
  1129 + if(this.data.openSpecModal_flash_normal) this.data.is_normal = 1;
  1130 +
  1131 + if(this.data.is_normal) {// 单独购买
  1132 + this.setData({
  1133 + goodsInputNum: t,
  1134 + });
  1135 + } else {// 秒杀购买
  1136 +
  1137 + // 获取redis当前可以购买的数量
  1138 + // 如果数量为0,设置和显示已抢光
  1139 + // 否则,进一步判断是否超出限购或超出库存
  1140 + await this.getactLen().then(async function(res) {
  1141 + // res: redis可购买数量
  1142 + console.log('当前可以购买的数量:', res);
  1143 + if(res <= 0) {
  1144 + // 可购买数量<=0, 设置和显示已抢光
  1145 + th.setData({
  1146 + prom_r_null: 1,
  1147 + });
  1148 + } else {
  1149 + // 可购买数量>0
  1150 + // 计算自己还可以购买的数量
  1151 + // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b
  1152 + // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存
  1153 + // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购
  1154 + let actInfo = th.data.sele_g;
  1155 + await th.get_buy_num2().then(function (data) {
  1156 + let limited = actInfo.buy_limit; // 限购数量a
  1157 + let promcardbuynum = data.data.data.promcardbuynum;
  1158 + let buyedNum = promcardbuynum; // 自己已经购买的数量b
  1159 + let canBuyNum = limited - buyedNum; // 自己还可购买的数量c
  1160 +
  1161 + if(canBuyNum <= 0) {
  1162 + canBuyNum = 0;
  1163 + };
  1164 +
  1165 + if(limited > res) {
  1166 + if(t > res) { // t当前增减的数量
  1167 + wx.showModal({
  1168 + title: '超出活动库存',
  1169 + });
  1170 + th.setData({
  1171 + goodsInputNum: res,
  1172 + });
  1173 + return false;
  1174 + };
  1175 + };
  1176 +
  1177 + if(limited <= res) {
  1178 + if(t>canBuyNum) {
  1179 + wx.showModal({
  1180 + title: '超出限购数量',
  1181 + });
  1182 + th.setData({
  1183 + goodsInputNum: canBuyNum,
  1184 + });
  1185 + return false;
  1186 + };
  1187 + };
  1188 +
  1189 + th.setData({
  1190 + goodsInputNum: t,
  1191 + });
  1192 + });
  1193 + };
  1194 + });
  1195 +
  1196 + }
  1197 +
  1198 +
  1199 + };
  1200 +
  1201 +
  1202 +
  1203 +
  1204 +
  1205 +
  1206 +
  1207 +
  1208 +
  1209 +
  1210 +
  1211 + // var e = th.data.sele_g.goods_num;
  1212 + // var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
  1213 + // if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) {
  1214 + // if (!th.data.def_pick_store) {
  1215 + // wx.showModal({title: '请选择门店',});
  1216 + // return false;
  1217 + // } else {
  1218 + // e = th.data.def_pick_store.CanOutQty;
  1219 + // }
  1220 + // }
  1221 +
  1222 +
  1223 + // th.setData({goodsInputNum: t});
  1224 +
  1225 + // });
  1226 +
  1227 +
956 1228 },
957 1229  
958 1230  
959 1231 closeSpecModal: function() {
960 1232 this.setData({
961 1233 openSpecModal: !1,
962   - openSpecModal_pt: !1
  1234 + openSpecModal_pt: !1,
  1235 + openSpecModal_flash_normal: !1,
963 1236 });
964 1237 },
965 1238  
966 1239 openSpecModel: function(t) {
967   - // console.log('****ttttttt***', t);
968 1240 var th=this;
969 1241 var open_store = t.currentTarget.dataset.ind;
970 1242 this.setData({
... ... @@ -1045,29 +1317,57 @@ Page({
1045 1317 });
1046 1318 }
1047 1319 }
1048   - },
1049   -
1050   - //---------联系客服------------
1051   - contactService: function() {
1052   - s.getConfig(function(t) {
1053   - if (t.store_tel == undefined) {
1054   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
1055   - isShowLoading: 1,
1056   - data: {},
1057   - success: function(rs) {
1058   - getApp().globalData.config = rs.data.data;
1059   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
1060   - getApp().my_warnning("商家未设置电话", 0, th);
1061   - return false;
1062   - }
1063   - s.confirmBox("请联系客服:" + rs.data.data.store_tel);
1064   - }
1065   - })
1066   - } else {
1067   - s.confirmBox("请联系客服:" + t.store_tel);
1068   - }
1069   - });
1070   - },
  1320 + },
  1321 + //---------联系客服------------
  1322 + contactService: function () {
  1323 + this.getTel()
  1324 + .then(() => {
  1325 + if(self.data.store_tel) {
  1326 + wx.showModal({
  1327 + title: '联系客服',
  1328 + content: '客服热线:' + self.data.store_tel,
  1329 + confirmText: '拨打',
  1330 + success(res) {
  1331 + if(res.confirm) {
  1332 + wx.makePhoneCall({
  1333 + phoneNumber: self.data.store_tel,
  1334 + })
  1335 + };
  1336 + },
  1337 + });
  1338 + };
  1339 + });
  1340 + },
  1341 + // 获取客服电话
  1342 + getTel() {
  1343 + return new Promise((resolve, reject) => {
  1344 + s.getConfig(function (t) {
  1345 + if (t.store_tel == undefined) {
  1346 + getApp().request.get("/api/weshop/store/get/" + os.stoid, {
  1347 + isShowLoading: 1,
  1348 + data: {},
  1349 + success: function (rs) {
  1350 + getApp().globalData.config = rs.data.data;
  1351 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
  1352 + getApp().my_warnning("商家未设置电话", 0, th);
  1353 + return false;
  1354 + }
  1355 + self.setData({
  1356 + store_tel: rs.data.data.store_tel,
  1357 + });
  1358 + // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
  1359 + }
  1360 + })
  1361 + } else {
  1362 + self.setData({
  1363 + store_tel: t.store_tel,
  1364 + });
  1365 + // s.confirmBox("请联系客服:" + t.store_tel);
  1366 + };
  1367 + resolve();
  1368 + });
  1369 + });
  1370 + },
1071 1371 //-------获取购物车数量----------
1072 1372 requestCardNum: function() {
1073 1373 var t = this;
... ... @@ -1122,10 +1422,12 @@ Page({
1122 1422 title=th.data.prom_act.share_title;
1123 1423 img=th.data.iurl+th.data.prom_act.share_imgurl;
1124 1424 }
  1425 +
  1426 +
1125 1427  
1126 1428  
1127 1429 var url="/packageA/pages/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
1128   - if(getApp().globalData.user_id){
  1430 + if(getApp().globalData.user_id) {
1129 1431 url+="&first_leader="+getApp().globalData.user_id;
1130 1432 }
1131 1433  
... ... @@ -1137,30 +1439,24 @@ Page({
1137 1439 url+="&room_id="+getApp().globalData.room_id+"&room_user_share=1";
1138 1440 }
1139 1441  
  1442 +
1140 1443 var ob={
1141 1444 title: price + "元 " +title,
1142 1445 path:url,
1143 1446 imageUrl: img,
1144   - };
1145   - // if(th.data.prom_type==6){
1146   - // title+='\n'+th.data.prom_act.share_remark;
1147   - // ob.title=title;
1148   - // ob.desc=th.data.prom_act.share_remark;
1149   - // }
1150   -
1151   - //如果是积分购的时候
1152   - // if(th.data.prom_type==4){
1153   - // var name = th.data.prom_act.name;
1154   - // //-- 积分购的 --
1155   - // var pri0 = th.data.prom_act.addmoney;
1156   - // var integral=th.data.prom_act.integral;
1157   - // var text="";
1158   - // if(integral){text=integral+"积分"; }
1159   - // if(pri0 && integral){ text+="+";}
1160   - // if(pri0){ text+="¥"+pri0;}
  1447 + };
1161 1448  
1162   - // ob.title= text+" "+name;
1163   - // }
  1449 + // 如果服务卡参加秒杀活动,且后台设置了分享标题和分享图片
  1450 + if(th.data.prom_type == 1) {
  1451 + if(th.data.sele_g && th.data.sele_g.share_title) {
  1452 + title = th.data.sele_g.share_title;
  1453 + ob.title = title;
  1454 + };
  1455 + if(th.data.sele_g && th.data.sele_g.share_imgurl) {
  1456 + img = th.data.iurl + th.data.sele_g.share_imgurl;
  1457 + ob.imageUrl = img;
  1458 + };
  1459 + };
1164 1460  
1165 1461 return ob;
1166 1462  
... ... @@ -2562,13 +2858,11 @@ Page({
2562 2858 },
2563 2859  
2564 2860 previewImage() {
2565   - wx.previewImage({
2566   - //将图片预览出来
2567   - urls: [this.data.shareImgPath]
2568   - });
  2861 + getApp().pre_img(this.data.shareImgPath);
2569 2862 },
2570 2863  
2571 2864 onShareTimeline() {
  2865 + getApp().globalData.no_clear=1
2572 2866 var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';
2573 2867 if(!store_name)
2574 2868 store_name=getApp().globalData.setting.appName;
... ... @@ -2913,45 +3207,50 @@ Page({
2913 3207 isshow: 1,
2914 3208 });
2915 3209 // this.get_sku(os.stoid, this.data.data, gid);
2916   - // this.get_sto();
  3210 + this.get_sto();
2917 3211 // this.check_is_youhui(gid, 1);
2918 3212 this.data.is_normal = 1;
2919 3213 },
2920 3214  
2921 3215  
  3216 + //获取redis中的数量
  3217 + async getactLen() {
  3218 + let prom_type = this.data.options.prom_type;
  3219 + let prom_id = this.data.options.prom_id;
  3220 + return await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
  3221 + 1: 1
  3222 + }).then(res => {
  3223 + if (res.data.code == 0) {
  3224 + // 当前可以购买的数量
  3225 + let r_num = res.data.data;
  3226 + return r_num;
  3227 + };
  3228 + })
  3229 + },
  3230 +
  3231 +
2922 3232  
2923 3233  
2924 3234 //--------检查是否活动,活动是否开始,或者是否结束-------
2925 3235 async check_prom(gid, prom_type, prom_id) {
2926   - console.log('check_prom');
2927 3236 var ee = this, th = ee;
2928 3237 var user_id = getApp().globalData.user_id;
2929 3238 if (!user_id) user_id = 0;
  3239 +
  3240 + if (prom_type == 1 && prom_id == 0) {
  3241 + this.setData({
  3242 + prom_type: 0, isshow: 1,
  3243 + });
2930 3244  
2931   - // if (prom_type == 3 || prom_type == 0 || prom_type == 5 || prom_type == 7 || prom_type == 9 || prom_type == 10) {
2932   - // this.setData({
2933   - // prom_type: 0, isshow: 1,
2934   - // });
2935   - // return false;
2936   - // }
2937   -
2938   -
2939   -
2940   - // if (prom_type == 1 && prom_id == 0) {
2941   - // this.setData({
2942   - // prom_type: 0, isshow: 1,
2943   - // });
2944   -
2945   - // //获取门店
2946   - // this.get_sto();
2947   - // this.get_sku(o.stoid, this.data.data, gid);
2948   - // this.check_has_flash();
2949   - // this.data.is_normal = 1;
2950   - // this.check_is_youhui(gid, 1);
2951   - // return false;
2952   - // }
  3245 + //获取门店
  3246 + this.get_sto();
  3247 + // this.get_sku(o.stoid, this.data.data, gid);
  3248 + this.check_has_flash();
  3249 + this.data.is_normal = 1;
  3250 + // this.check_is_youhui(gid, 1);
  3251 + return false;
  3252 + }
2953 3253  
2954   - //if (prom_type != 3 && prom_type!=0){
2955 3254 //---判断秒杀----
2956 3255 if (prom_type == 1 && prom_id > 0) {
2957 3256 //-------判断活动是否抢光---------
... ... @@ -2959,15 +3258,23 @@ Page({
2959 3258 1: 1
2960 3259 }).then(res => {
2961 3260 var em = res;
2962   - if (res.data.code == 0) {
2963   - // console.log('!!!!!!res!!!!', res);
2964   - if (res.data.data <= 0) ee.setData({
2965   - prom_r_null: 1
2966   - });
  3261 + if (em.data.code == 0) {
  3262 +
  3263 + if (em.data.data <= 0) {
  3264 + th.setData({
  3265 + prom_r_null: 1,
  3266 + goodsInputNum: res.data.data,
  3267 + });
  3268 +
  3269 + // th.setData({goodsInputNum: redis_num})
  3270 + };
2967 3271 //拿取价格并且判断时间--
2968 3272 getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, {
2969 3273 success: function (t) {
2970   - // console.log('!!!!!!t!!!!', t);
  3274 + th.setData({
  3275 + sele_g: t.data.data,
  3276 + });
  3277 +
2971 3278 if (t.data.code != 0) {
2972 3279 ee.get_normal(gid);
2973 3280 return false;
... ... @@ -2994,7 +3301,6 @@ Page({
2994 3301 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
2995 3302  
2996 3303 ee.setData({
2997   - 'data.shop_price': t.data.data.user_price,
2998 3304 prom_price: t.data.data.user_price,
2999 3305 prom_type: 1,
3000 3306 prom_id: prom_id,
... ... @@ -3026,60 +3332,60 @@ Page({
3026 3332 }
3027 3333  
3028 3334 //如果是进行中的话
3029   - // if (endTime1 < newTime) {
3030   - // //-- 获取秒杀活动的多少规格 --
3031   - // ee.get_more_flahs(function (list) {
3032   - // if (list && list.length > 1) {
3033   -
3034   - // var n_item = list[0];
3035   - // var ind = list.findIndex(function (ele) {
3036   - // return ele.goods_id == ee.data.data.goods_id;
3037   - // })
3038   - // if (ind < 0) return false;
3039   - // if (ind > 0) {
3040   - // n_item = JSON.parse(JSON.stringify(list[ind]));
3041   - // list.splice(ind, 1);
3042   - // list.unshift(n_item);
3043   - // }
3044   -
3045   - // ee.data.sele_g.viplimited = n_item.viplimited;
3046   - // ee.data.data.viplimited = n_item.viplimited;
3047   -
3048   - // var gb = 1;
3049   - // //-- 显示多规格 --
3050   - // for (let i in list) {
3051   - // let item = list[i];
3052   - // var gg = "";
3053   - // if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
3054   - // if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
3055   -
3056   - // if (item.goods_spec != "" && item.goods_color != "") {
3057   - // gg = item.goods_spec + "/" + item.goods_color;
3058   - // } else if (item.goods_spec != "" || item.goods_color != "") {
3059   - // gg = item.goods_spec + item.goods_color;
3060   - // } else {
3061   - // gg = "规格" + gb;
3062   - // gb++;
3063   - // }
3064   - // item.gg = gg;
3065   - // item.prom_id = item.prom_id;
3066   - // item.prom_type = 1;
3067   - // }
3068   -
3069   - // ee.setData({
3070   - // sku_g: list,
3071   - // });
3072   -
3073   - // }
3074   - // })
3075   - // }
  3335 + if (endTime1 < newTime) {
  3336 + //-- 获取秒杀活动的多少规格 --
  3337 + ee.get_more_flash(function (list) {
  3338 + if (list && list.length > 1) {
  3339 +
  3340 + var n_item = list[0];
  3341 + var ind = list.findIndex(function (ele) {
  3342 + return ele.goods_id == ee.data.data.goods_id;
  3343 + })
  3344 + if (ind < 0) return false;
  3345 + if (ind > 0) {
  3346 + n_item = JSON.parse(JSON.stringify(list[ind]));
  3347 + list.splice(ind, 1);
  3348 + list.unshift(n_item);
  3349 + }
  3350 +
  3351 + ee.data.sele_g.viplimited = n_item.viplimited;
  3352 + ee.data.data.viplimited = n_item.viplimited;
  3353 +
  3354 + var gb = 1;
  3355 + //-- 显示多规格 --
  3356 + for (let i in list) {
  3357 + let item = list[i];
  3358 + var gg = "";
  3359 + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
  3360 + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
  3361 +
  3362 + if (item.goods_spec != "" && item.goods_color != "") {
  3363 + gg = item.goods_spec + "/" + item.goods_color;
  3364 + } else if (item.goods_spec != "" || item.goods_color != "") {
  3365 + gg = item.goods_spec + item.goods_color;
  3366 + } else {
  3367 + gg = "规格" + gb;
  3368 + gb++;
  3369 + }
  3370 + item.gg = gg;
  3371 + item.prom_id = item.prom_id;
  3372 + item.prom_type = 1;
  3373 + }
  3374 +
  3375 + ee.setData({
  3376 + sku_g: list,
  3377 + });
  3378 +
  3379 + }
  3380 + })
  3381 + }
3076 3382  
3077 3383 }
3078 3384 });
3079 3385 }
3080 3386 })
3081 3387 }
3082   -
  3388 +
3083 3389 },
3084 3390  
3085 3391  
... ... @@ -3088,61 +3394,787 @@ Page({
3088 3394 let prom_type = e.currentTarget.dataset.promtype;
3089 3395 let prom_id = e.currentTarget.dataset.promid;
3090 3396 let goods_id = this.data.data.goods_id;
3091   - let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;
3092   - // console.log('url~~~~', url);
  3397 + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;s
3093 3398 getApp().goto(url);
3094 3399 },
3095 3400  
3096 3401  
3097 3402  
3098   -
3099   - //-- 检验商品的活动情况 --
3100   - check_gd_prom_new: function (func) {
3101   - var th = this;
  3403 + //获取更多秒杀
  3404 + get_more_flash: async function (func) {
  3405 + var f_more = false;
3102 3406 var user_id = getApp().globalData.user_id;
3103 3407 if (!user_id) user_id = 0;
3104 3408  
3105   - var url = '/api/weshop/activitylist/listGoodActInfo2';
3106   - var req_d = {
3107   - "store_id": os.stoid,
3108   - "goods_id": this.data.gid,
3109   - "user_id": user_id,
  3409 + var url = "/api/weshop/goods/listSkuFlash?store_id=" + os.stoid + "&goods_id=" + this.data.options.goods_id + "&user_id=" + user_id;
  3410 + //获取秒杀的多规格
  3411 + await getApp().request.promiseGet(url, {}).then(res => {
  3412 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  3413 + f_more = res.data.data;
  3414 + }
  3415 + })
  3416 + if (!f_more) {
  3417 + func(false);
  3418 + return false;
  3419 + }
  3420 + //-- 秒杀的价格要更新 --
  3421 + for (let i in f_more) {
  3422 +
  3423 + let item = f_more[i];
  3424 + f_more[i].prom_id = item.act_id;
  3425 + f_more[i].prom_type = 1;
  3426 + if (item.goods_id == this.data.data.goods_id) {
  3427 + continue;
  3428 + }
  3429 + var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id;
  3430 + await getApp().request.promiseGet(url, {}).then(rs => {
  3431 + if (rs.data.code == 0) {
  3432 + f_more[i].price = rs.data.data.user_price;
  3433 +
  3434 + }
  3435 + })
  3436 + }
  3437 + func(f_more);
  3438 +
  3439 + },
  3440 +
  3441 +
  3442 +
  3443 +
  3444 +
  3445 +
  3446 + //-------------获取购买数量的总函数----------------
  3447 + get_buy_num: function (gd, func) {
  3448 + // var map = this.data.g_buy_num,
  3449 + var th = this,
  3450 + user_id = getApp().globalData.user_id;
  3451 + if (user_id == null) {
  3452 + // map.set(gd.goods_id, 0);
  3453 + th.setData({
  3454 + // g_buy_num: map,
  3455 + prom_buy_num: 0,
  3456 + });
  3457 + "function" == typeof func && func();
  3458 + return false;
3110 3459 }
3111   - getApp().request.get(url, {
3112   - data: req_d,
3113   - success: function (e) {
3114   - if (e.data.code == 0 && e.data.data && e.data.data.length > 0) {
3115   - var arr = e.data.data;
3116   - var arr2 = arr.filter(function (e) {
3117   - return e.s_time < ut.gettimestamp();
  3460 +
  3461 + // if (map.has(gd.goods_id)) {
  3462 + // "function" == typeof func && func();
  3463 + // } else {
  3464 + //----获取商品购买数----
  3465 + if (th.data.prom_type == 1) {
  3466 + //----获取活动购买数----
  3467 + getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {
  3468 + data: {
  3469 + store_id: os.stoid,
  3470 + user_id: user_id,
  3471 + card_id: th.data.options.goods_id,
  3472 + prom_type: th.data.options.prom_type,
  3473 + prom_id: th.data.options.prom_id
  3474 + },
  3475 + //-----获取-----
  3476 + success: function (tt) {
  3477 + if (tt.data.code == 0) {
  3478 + // map.set(gd.goods_id, g_buy_num);
  3479 + th.setData({
  3480 + // g_buy_num: map,
  3481 + promcardbuynum: tt.data.data.promcardbuynum,
  3482 + cardbuynum: tt.data.data.cardbuynum,
  3483 + });
  3484 + "function" == typeof func && func();
  3485 + }
  3486 + }
  3487 + });
  3488 + } else {
  3489 + "function" == typeof func && func();
  3490 + };
  3491 +
  3492 + },
  3493 +
  3494 +
  3495 + get_buy_num2: async function () {
  3496 + // var map = this.data.g_buy_num,
  3497 + var th = this,
  3498 + user_id = getApp().globalData.user_id;
  3499 + // if (user_id == null) {
  3500 + // // map.set(gd.goods_id, 0);
  3501 + // th.setData({
  3502 + // // g_buy_num: map,
  3503 + // prom_buy_num: 0,
  3504 + // });
  3505 + // "function" == typeof func && func();
  3506 + // return false;
  3507 + // }
  3508 +
  3509 +
  3510 + //----获取商品购买数----
  3511 +
  3512 + //----获取活动购买数----
  3513 + return await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {
  3514 + data: {
  3515 + store_id: os.stoid,
  3516 + user_id: user_id,
  3517 + card_id: th.data.options.goods_id,
  3518 + prom_type: th.data.options.prom_type,
  3519 + prom_id: th.data.options.prom_id
  3520 + },
  3521 + //-----获取-----
  3522 + success: function (tt) {
  3523 + if (tt.data.code == 0) {
  3524 + // map.set(gd.goods_id, g_buy_num);
  3525 + th.setData({
  3526 + // g_buy_num: map,
  3527 + promcardbuynum: tt.data.data.promcardbuynum,
  3528 + cardbuynum: tt.data.data.cardbuynum,
  3529 + });
  3530 + }
  3531 + }
  3532 + });
  3533 +
  3534 +
  3535 + },
  3536 +
  3537 +
  3538 +
  3539 +
  3540 +
  3541 + // 促销 -> 送礼包 -> 查看详情
  3542 + viewLbDetails(e) {
  3543 + let id = e.currentTarget.dataset.id; // 获取礼包id
  3544 + let url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮
  3545 + // console.log('myurl', url);
  3546 + getApp().goto(url);
  3547 + },
  3548 +
  3549 + go_more_ladder: function (e) {
  3550 + var prom_id = e.currentTarget.dataset.id;
  3551 + getApp().goto("/pages/goods/goodsList/goodsList?ladder_id=" + prom_id);
  3552 + },
  3553 +
  3554 + getHistoryBuy() {
  3555 + let _this = this;
  3556 + let req_data = {
  3557 + store_id: os.stoid,
  3558 + goods_id: this.data.gid,
  3559 + pay_status: 1,
  3560 + rndid: 1
  3561 + };
  3562 + getApp().request.promiseGet('/api/weshop/ordergoods/list', {
  3563 + data: req_data,
  3564 + })
  3565 + .then(res => {
  3566 + if (t.ajax_ok(res)) {
  3567 + _this.setData({
  3568 + historyBuyInfo: res.data.data.pageData,
3118 3569 })
3119   - //-- 如果只有一个活动的话 --
3120   - if (arr.length == 1) {
3121   - th.data.prom_type = arr[0].prom_type;
3122   - th.data.prom_id = arr[0].act_id;
  3570 + }
  3571 + })
  3572 + },
  3573 +
  3574 +
  3575 +
  3576 + //-- 秒杀的普通购买 --
  3577 + openSpecModel_Nor: function () {
  3578 + this.data.g_buy_num = new Map();
  3579 + var th = this;
  3580 + this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4
  3581 +
  3582 + this.setData({openSpecModal_flash_normal: 1});
  3583 +
  3584 +
  3585 + // if (th.data.sku_g_pt) {
  3586 + // // this.get_sto(1)
  3587 + // this.setData({openSpecModal_flash_normal: 1});
  3588 + // } else {
  3589 + // th.get_sto(1);
  3590 + // th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
  3591 + // th.setData({
  3592 + // openSpecModal_flash_normal: 1
  3593 + // });
  3594 + // });
  3595 + // }
  3596 + // this.check_is_youhui(th.data.gid, 1);
  3597 + },
  3598 +
  3599 + closeSpecModal_flash_normal: function () {
  3600 + this.setData({openSpecModal_flash_normal: 0});
  3601 + },
  3602 +
  3603 +
  3604 + //打开客服操作菜单
  3605 + openCS() {
  3606 + // 判断会员状态
  3607 + let user_info = getApp().globalData.userInfo;
  3608 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
  3609 + wx.navigateTo({
  3610 + url: '/pages/togoin/togoin',
  3611 + })
  3612 + return false;
  3613 + };
  3614 + // csType/在线客服设置:
  3615 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  3616 + // 1小程序客服、
  3617 + // 2企业微信客服
  3618 + if(this.data.sys_switch) {
  3619 + let csType = this.data.sys_switch.weapp_customertype;
  3620 + if(csType == 0) {
  3621 + // 拨打电话号码
  3622 + this.contactService();
  3623 + } else {
  3624 + this.getTel()
  3625 + .then(() => {
  3626 + self.setData({
  3627 + hiddenCS: false,
  3628 + });
  3629 + });
  3630 + };
  3631 + };
  3632 +
  3633 + },
  3634 +
  3635 + //关闭客服操作菜单
  3636 + closeCS() {
  3637 + this.setData({
  3638 + hiddenCS: true,
  3639 + });
  3640 + },
  3641 +
  3642 +
  3643 +
  3644 +
  3645 +
  3646 +
  3647 +
  3648 + //-- 加入购物的函数 --
  3649 + add_cart_func: function (t) {
  3650 + var i = getApp().request;
  3651 + if (oo.user_id == null) {
  3652 + return s.my_warnning("还未登录!", 0, this);
  3653 + }
  3654 +
  3655 + if (!getApp().globalData.userInfo) {
  3656 + return s.my_warnning("还未登录!", 0, this);
  3657 + }
  3658 +
  3659 + var e = this,
  3660 + th = e,
  3661 + a = 0,
  3662 + o = this.data.sele_g;
  3663 + a = o.goods_id;
  3664 +
  3665 + //----------添加到购物车时,要判断限购数量,--------
  3666 + e.get_buy_num(o, function (ee) {
  3667 + //---判断商品是否超出限购---
  3668 + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  3669 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
  3670 + wx.showModal({
  3671 + title: '提示',
  3672 + content: '超出活动限购数量'
  3673 + });
  3674 + return false;
  3675 + }
  3676 + }
  3677 + //---判断商品是否超出活动限购---
  3678 + if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) {
  3679 + if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
  3680 + wx.showModal({
  3681 + title: '提示',
  3682 + content: '超出活动限购数量'
  3683 + });
  3684 + return false;
  3685 + }
  3686 + }
  3687 +
  3688 + if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
  3689 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  3690 + this.setData({
  3691 + sto_sele_name: ""
  3692 + });
  3693 + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  3694 +
  3695 + //--------------此时操作的数据------------
  3696 + var newd = {
  3697 + goods_id: o.goods_id,
  3698 + goods_num: th.data.goodsInputNum,
  3699 + pick_id: th.data.sto_sele_id,
  3700 + user_id: oo.user_id,
  3701 + store_id: th.data.stoid,
  3702 + goods_price: o.shop_price,
  3703 + member_goods_price: o.shop_price,
  3704 + goods_name: o.goods_name,
  3705 + goods_sn: o.goods_sn,
  3706 + sku: o.sku,
  3707 + prom_id: th.data.sele_g.prom_id,
  3708 + prom_type: th.data.sele_g.prom_type,
  3709 + };
  3710 +
  3711 + //---是不是从收藏夹出来的---
  3712 + if (th.data.c_guide_id) {
  3713 + newd['guide_id'] = th.data.c_guide_id;
  3714 + newd['guide_type'] = 2;
  3715 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;
  3716 + } else {
  3717 + if (getApp().globalData.guide_id) {
  3718 + newd['guide_id'] = getApp().globalData.guide_id;
  3719 + newd['guide_type'] = 0;
  3720 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;
  3721 + }
  3722 + }
  3723 +
  3724 + //让商品带上房间号
  3725 + //让商品带上房间号
  3726 + if (th.data.sys_switch.is_skuroom_id == 1) {
  3727 + if (th.data.data.goods_id == getApp().globalData.room_goods_id) {
  3728 + newd.room_id = getApp().globalData.room_id;
  3729 + }
  3730 + } else {
  3731 + if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
  3732 + }
  3733 +
  3734 + //如果是积分够,is_integral_normal就要有积分购普通购买字段
  3735 + if (o.prom_type == 4) {
  3736 + newd.is_integral_normal = 1;
  3737 + }
  3738 +
  3739 + //如果有线下取价
  3740 + if (o.offline_price) {
  3741 + newd.offline_price = o.offline_price;
  3742 + newd.pricing_type = o.pricing_type;
  3743 + }
  3744 +
  3745 + //-----如果是秒杀,团购,积分购,拼团-----
  3746 + if (th.data.prom_type == 1 || th.data.prom_type == 2) {
  3747 +
  3748 + if (th.data.openSpecModal_flash_normal) {
  3749 +
  3750 + newd.prom_type = 0;
  3751 + newd.prom_id = 0;
  3752 +
  3753 + //---如果是线下门店销售的时候---
  3754 + if (th.data.sales_rules == 2) {
  3755 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3756 + //---通过接口获取门店的线下库存信息--
  3757 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3758 + data: {
  3759 + storageNos: pick.pickup_no,
  3760 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3761 + storeId: os.stoid
  3762 + },
  3763 + success: function (res) {
  3764 + if (res.data.code == 0) {
  3765 + if (res.data.data.pageData.length > 0) {
  3766 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3767 + if (CanOutQty < e.data.goodsInputNum) {
  3768 + return s.my_warnning("库存不足!", 0, th);
  3769 + }
  3770 + //在调一次接口,读取商品的预出库的数量,lock
  3771 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3772 + data: {
  3773 + store_id: os.stoid,
  3774 + wareId: th.data.sele_g.goods_id,
  3775 + storageId: pick.pickup_id,
  3776 + pageSize: 1000
  3777 + },
  3778 + success: function (res_data) {
  3779 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3780 +
  3781 + var lock = 0;
  3782 + for (var i in res_data.data.data.pageData) {
  3783 + lock += res_data.data.data.pageData[i].outQty;
  3784 + }
  3785 +
  3786 + if (CanOutQty <= lock) {
  3787 + return s.my_warnning("库存不足!", 0, th);
  3788 + }
  3789 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3790 + } else {
  3791 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3792 + }
  3793 + }
  3794 + })
  3795 + } else {
  3796 + return s.my_warnning("库存不足!", 0, th);
  3797 + }
  3798 +
  3799 + }
  3800 + }
  3801 + })
  3802 + } else {
  3803 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3804 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3805 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
3123 3806 }
3124   - //-- 如果只有一个进行中的活动的话 --
3125   - else if (arr2.length == 1) {
3126   - th.data.prom_type = arr2[0].prom_type;
3127   - th.data.prom_id = arr2[0].act_id;
  3807 +
  3808 + return false;
  3809 + }
  3810 +
  3811 +
  3812 + newd.goods_price = th.data.prom_price;
  3813 + newd.member_goods_price = th.data.prom_price,
  3814 + newd.prom_type = th.data.prom_type;
  3815 + newd.prom_id = th.data.prom_id;
  3816 +
  3817 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3818 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3819 +
  3820 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3821 +
  3822 + } else if (o.prom_type == 7) {
  3823 +
  3824 + //判断进行中的活动,是不是要判断线下库存
  3825 + th.check_zh_acting(function (ee) {
  3826 + newd.prom_id = 0;
  3827 + newd.prom_type = 0;
  3828 + if (ee && th.data.sele_g.act) {
  3829 + newd.prom_id = th.data.sele_g.act.id;
  3830 + newd.prom_type = 7;
  3831 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3832 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3833 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3834 + return false;
  3835 + } else {
  3836 + //---如果是线下门店销售的时候---
  3837 + if (th.data.sales_rules == 2) {
  3838 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3839 + //---通过接口获取门店的线下库存信息--
  3840 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3841 + data: {
  3842 + storageNos: pick.pickup_no,
  3843 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3844 + storeId: os.stoid
  3845 + },
  3846 + success: function (res) {
  3847 + if (res.data.code == 0) {
  3848 + if (res.data.data.pageData.length > 0) {
  3849 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3850 + if (CanOutQty < e.data.goodsInputNum) {
  3851 + return s.my_warnning("库存不足!", 0, th);
  3852 + }
  3853 + //在调一次接口,读取商品的预出库的数量,lock
  3854 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3855 + data: {
  3856 + store_id: os.stoid,
  3857 + wareId: th.data.sele_g.goods_id,
  3858 + storageId: pick.pickup_id,
  3859 + pageSize: 1000
  3860 + },
  3861 + success: function (res_data) {
  3862 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3863 +
  3864 + var lock = 0;
  3865 + for (var i in res_data.data.data.pageData) {
  3866 + lock += res_data.data.data.pageData[i].outQty;
  3867 + }
  3868 +
  3869 + if (CanOutQty <= lock) {
  3870 + return s.my_warnning("库存不足!", 0, th);
  3871 + }
  3872 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3873 + } else {
  3874 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3875 + }
  3876 + }
  3877 + })
  3878 + } else {
  3879 + return s.my_warnning("库存不足!", 0, th);
  3880 + }
  3881 +
  3882 + }
  3883 + }
  3884 + })
  3885 + } else {
  3886 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3887 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3888 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3889 + }
3128 3890 }
  3891 + })
  3892 +
  3893 + }
  3894 + else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) {
  3895 + newd.prom_type = 0;
  3896 + newd.prom_id = 0;
  3897 +
  3898 + if (th.data.prom_type == 10) {
  3899 + newd.prom_type = th.data.prom_type;
  3900 + newd.prom_id = th.data.prom_id;
  3901 + }
  3902 +
  3903 + //---如果是线下门店销售的时候---
  3904 + if (th.data.sales_rules == 2) {
  3905 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3906 + //---通过接口获取门店的线下库存信息--
  3907 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3908 + data: {
  3909 + storageNos: pick.pickup_no,
  3910 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3911 + storeId: os.stoid
  3912 + },
  3913 + success: function (res) {
  3914 + if (res.data.code == 0) {
  3915 + if (res.data.data.pageData.length > 0) {
  3916 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3917 + if (CanOutQty < e.data.goodsInputNum) {
  3918 + return s.my_warnning("库存不足!", 0, th);
  3919 + }
  3920 + //在调一次接口,读取商品的预出库的数量,lock
  3921 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3922 + data: {
  3923 + store_id: os.stoid,
  3924 + wareId: th.data.sele_g.goods_id,
  3925 + storageId: pick.pickup_id,
  3926 + pageSize: 1000
  3927 + },
  3928 + success: function (res_data) {
  3929 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3930 +
  3931 + var lock = 0;
  3932 + for (var i in res_data.data.data.pageData) {
  3933 + lock += res_data.data.data.pageData[i].outQty;
  3934 + }
  3935 +
  3936 + if (CanOutQty <= lock) {
  3937 + return s.my_warnning("库存不足!", 0, th);
  3938 + }
  3939 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3940 + } else {
  3941 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3942 + }
  3943 + }
  3944 + })
  3945 + } else {
  3946 + return s.my_warnning("库存不足!", 0, th);
  3947 + }
  3948 +
  3949 + }
  3950 + }
  3951 + })
  3952 + } else {
  3953 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3954 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3955 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
3129 3956 }
3130   - //-- 调用回调 --
3131   - func();
3132 3957 }
3133   - });
  3958 + })
3134 3959 },
3135 3960  
  3961 + //---加入购物车的最后一步---
  3962 + add_cart_next(e, t, a, o, newd, CanOutQty) {
  3963 + var th = this, i = getApp().request;
  3964 + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
  3965 + if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) {
  3966 + var conf = th.data.bconfig;
  3967 + if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {
  3968 + var s_list = JSON.parse(conf.switch_list);
  3969 + var now = ut.gettimestamp();
3136 3970  
3137 3971  
  3972 + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');
  3973 + var end = new Date(str);
  3974 + end = Date.parse(end) / 1000;
3138 3975  
3139   -
  3976 + //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--
  3977 + if (parseInt(s_list.rank_switch) == 2 && end > now) {
  3978 + var card_price = o[getApp().globalData.userInfo['card_field']];
  3979 + //如果会员有等级价
  3980 + if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null
  3981 + && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {
  3982 + newd.goods_price = card_price;
  3983 + newd.member_goods_price = card_price;
  3984 + }
  3985 + }
  3986 + }
  3987 + }
  3988 +
  3989 + //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
  3990 + if ("add" == t.currentTarget.dataset.action) {
  3991 +
  3992 + if (th.data.prom_goods) {
  3993 + newd.prom_type = 3;
  3994 + newd.prom_id = th.data.prom_goods[0].prom_id;
  3995 + }
  3996 +
  3997 + //----先看会员在购物车中是否加入了该商品-----
  3998 + i.get("/api/weshop/cart/page", {
  3999 + data: {
  4000 + store_id: e.data.stoid,
  4001 + user_id: oo.user_id,
  4002 + goods_id: a,
  4003 + pick_id: e.data.sto_sele_id,
  4004 + state: 0
  4005 + },
  4006 + success: function (re) {
  4007 +
  4008 + //-------如果购物车中有相关的数据---------
  4009 + if (re.data.data.total > 0) {
  4010 +
  4011 + var item = re.data.data.pageData[0];
  4012 +
  4013 + //判断数量,要看下购物车中有没有该商品
  4014 + if (CanOutQty) {
  4015 + if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
  4016 + return s.my_warnning("库存不足!", 0, th);
  4017 + }
  4018 + } else {
  4019 + if (item.goods_num + th.data.goodsInputNum > o.store_count) {
  4020 + return s.my_warnning("库存不足!", 0, th);
  4021 + }
  4022 + }
  4023 +
  4024 + var updata = {
  4025 + id: item.id,
  4026 + goods_num: e.data.goodsInputNum + item.goods_num,
  4027 + goods_price: newd.goods_price,
  4028 + member_goods_price: newd.goods_price,
  4029 + store_id: th.data.stoid,
  4030 + };
  4031 +
  4032 + //---是不是从收藏夹出来的---
  4033 + if (th.data.c_guide_id) {
  4034 + updata['guide_id'] = th.data.c_guide_id;
  4035 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  4036 + } else {
  4037 + if (getApp().globalData.guide_id) {
  4038 + updata['guide_id'] = getApp().globalData.guide_id;
  4039 + updata['guide_type'] = 0;
  4040 + }
  4041 + }
  4042 +
  4043 + i.put("/api/weshop/cart/update", {
  4044 + data: updata,
  4045 + success: function (t) {
  4046 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  4047 + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
  4048 + th.setData({
  4049 + cartGoodsNum: c_num
  4050 + });
  4051 + th.closeSpecModal();
  4052 + }
  4053 + });
  4054 + } else {
  4055 +
  4056 +
  4057 + i.post("/api/weshop/cart/save", {
  4058 + data: newd,
  4059 + success: function (t) {
  4060 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  4061 + var c_num = th.data.cartGoodsNum + e.data.goodsInputNum;
  4062 + th.setData({
  4063 + cartGoodsNum: c_num
  4064 + });
  4065 + th.closeSpecModal();
  4066 + }
  4067 + });
  4068 + }
  4069 + }
  4070 + });
3140 4071  
  4072 + }
  4073 + else {
  4074 +
  4075 + //这一步主要是要让立即购买 走 购物车的逻辑 参与活动
  4076 + if (newd.prom_type == 10 || newd.prom_type == 7) {
  4077 + //----先看会员在购物车中是否加入了该商品,立即购买的-----
  4078 + getApp().request.get("/api/weshop/cart/page", {
  4079 + data: {
  4080 + store_id: e.data.stoid,
  4081 + user_id: oo.user_id,
  4082 + state: 1
  4083 + },
  4084 + success: function (res) {
  4085 + //-------如果购物车中有相关的数据---------
  4086 + if (res.data.code == 0 && res.data.data.total > 0) {
  4087 + for (let j in res.data.data.pageData) {
  4088 + let item_j = res.data.data.pageData[j];
  4089 + var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
  4090 + getApp().request.delete(url, {});
  4091 + }
  4092 + }
  4093 + newd.state = 1;
  4094 + getApp().request.post("/api/weshop/cart/save", {
  4095 + data: newd,
  4096 + success: function (t) {
  4097 + th.closeSpecModal();
  4098 + getApp().goto("/pages/cart/cart2/cart2?state=1");
  4099 + }
  4100 + });
  4101 + },
  4102 + })
  4103 + return false;
  4104 + }
3141 4105  
  4106 + if (th.data.prom_goods) {
  4107 + var prom_d = th.data.prom_goods;
  4108 + for (var i in prom_d) {
  4109 + //判断活动有俩种条件,0元 1件
  4110 + var condition_t = prom_d[i].prom_type;
  4111 + switch (condition_t) {
  4112 + case 0: //按钱
  4113 + if (newd.goods_price >= condition_t) {
  4114 + newd.prom_type = 3;
  4115 + newd.prom_id = prom_d[i].prom_id;
  4116 + }
  4117 + break
  4118 + case 1://按购买数量
  4119 + if (newd.goods_num >= condition_t) {
  4120 + newd.prom_type = 3;
  4121 + newd.prom_id = prom_d[i].prom_id;
  4122 + }
  4123 + break;
  4124 + }
  4125 + }
3142 4126  
  4127 + }
3143 4128  
  4129 + newd['pick_name'] = th.data.sto_sele_name;
  4130 + newd['pick_dis'] = th.data.sto_sele_distr;
  4131 + th.buyNow(newd);
  4132 + }
  4133 + },
3144 4134  
3145 4135  
  4136 + click_contact:function () {
  4137 + getApp().globalData.no_clear=1;
  4138 + },
  4139 +
  4140 + //打开客服操作菜单
  4141 + openCS() {
  4142 + // csType/在线客服设置:
  4143 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  4144 + // 1小程序客服、
  4145 + // 2企业微信客服
  4146 + let csType = this.data.sys_switch.weapp_customertype;
  4147 + if(csType == 0) {
  4148 + // 获取电话号码
  4149 + this.contactService();
  4150 + } else {
  4151 + this.getTel()
  4152 + .then(() => {
  4153 + self.setData({
  4154 + hiddenCS: false,
  4155 + });
  4156 + });
  4157 +
  4158 + };
  4159 + },
  4160 +
  4161 + //关闭客服操作菜单
  4162 + closeCS() {
  4163 + this.setData({
  4164 + hiddenCS: true,
  4165 + });
  4166 + },
  4167 +
  4168 +
  4169 +
  4170 +
  4171 +
  4172 +
  4173 +
  4174 +
  4175 +
  4176 +
  4177 +
3146 4178  
3147 4179  
3148 4180  
... ...
packageA/pages/goodsInfo/goodsInfo.wxml
... ... @@ -16,6 +16,7 @@
16 16 <view class="goods-detail">
17 17 <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}">
18 18  
  19 + <!-- 有视频和图片的情况 -->
19 20 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:if="{{mapurl}}">
20 21 <view class="xc-videos-picture rel">
21 22 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange">
... ... @@ -29,10 +30,11 @@
29 30 <video class="xc-videos" src="{{iurl+mapurl}}" id="{{index}}" wx:if="{{_index == index}}"></video>
30 31 </view>
31 32 </swiper-item>
32   - <swiper-item wx:for="{{gallery}}" wx:key="gallery">
33   - <view class="wh100 g_img_box" style="background-image:url({{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}});"></view>
  33 + <swiper-item wx:for="{{gallery}}" wx:key="gallery" class="sty">
  34 + <view class="wh100 g_img_box" style="background-image:url({{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}});"></view>
34 35 </swiper-item>
35 36 </swiper>
  37 +
36 38 <block wx:if="{{mapurl}}">
37 39 <view wx:if="{{hiddenn==1}}">
38 40 <view class="xc-imageCount">{{current}}/{{gallery.length}}</view>
... ... @@ -48,17 +50,18 @@
48 50 </view>
49 51 </view>
50 52 </block>
  53 +
51 54 </view>
52 55 </view>
53 56  
54 57  
55   -
  58 + <!-- 只有图片的情况 -->
56 59 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:else>
57 60 <view class="xc-videos-picture rel">
58 61 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}"
59 62 indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange">
60   - <swiper-item>
61   - <image class="wh100" src="{{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}}"
  63 + <swiper-item class="sty1">
  64 + <image class="wh100" src="{{iurl + (data.image_url?data.image_url:'miniapp/images/default_g_img.gif')}}"
62 65 binderror="bind_bnerr" mode="aspectFit" lazy-load="true" data-errorimg="gallery[{{index}}].image_url"></image>
63 66 </swiper-item>
64 67 </swiper>
... ... @@ -71,15 +74,13 @@
71 74 <!-- 即将开始 -->
72 75 <image class="secondkill-img" src='{{iurl+"/miniapp/images/blue_ks.png"}}' wx:if="{{prom_st==0}}"></image>
73 76 <!-- 进行中 -->
74   - <image class="secondkill-img" src='{{iurl+"/miniapp/images/red_jx.png"}}' wx:elif="{{prom_st!=0}}"></image>
  77 + <image class="secondkill-img" src='{{iurl+"/miniapp/images/red_jx.png"}}' wx:elif="{{prom_st!=0 && prom_st!=null}}"></image>
75 78 <image class="abs spike-img" src="{{iurl}}/miniapp/images/xsmiaosha.png"></image>
76 79 <view class="start fs26 abs" wx:if="{{prom_st==0}}">距活动开始还有</view>
77   - <view class="stop fs26 abs" wx:if="{{prom_st==1 || prom_st==3}}">距活动结束还有</view>
78   - <view class="secview flex abs fs24 xc-miaosha-time">
79   - <block wx:if="djs.day">
80   - <view class='day-val' style="color:{{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">{{djs.day}}</view>
81   - <view class="day white" style="color: {{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">天</view>
82   - </block>
  80 + <view class="stop fs26 abs" wx:elif="{{prom_st==1 || prom_st==3}}">距活动结束还有</view>
  81 + <view class="secview flex abs fs24 xc-miaosha-time" wx:if="{{prom_st!=null}}">
  82 + <view class='day-val' style="color:{{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">{{djs.day}}</view>
  83 + <view class="day white" style="color: {{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">天</view>
83 84 <view class='time-val white t-c' style=" background:{{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">{{djs.hou}}</view>
84 85 <view class="time" style="color: {{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">时</view>
85 86 <view class='time-val white t-c' style=" background:{{(prom_st==1 || prom_st==3)?'#d40022':'#0097e0'}}">{{djs.min}}</view>
... ... @@ -90,8 +91,7 @@
90 91 </view>
91 92  
92 93  
93   - <!-- <block> -->
94   -
  94 + <block>
95 95 <view class="goods-price rel">
96 96 <view class="co-red" style="overflow: hidden">
97 97 <view class="market-price" style="overflow: hidden"></view>
... ... @@ -99,21 +99,51 @@
99 99  
100 100 <view>
101 101 <!-- 秒杀价 -->
102   - <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> -->
  102 + <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view>
103 103 <!-- 手店价 -->
104   - <view class="co-red"><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view>
  104 + <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view>
  105 + <!-- <view class="word-line fs20 xc-qtunit-price">
  106 + 零售价¥{{filters.toFix(data.market_price,2)}}
  107 + </view> -->
105 108 <view class="goods-title">
106 109 <view class="goods-name elli">{{data.goods_name}}</view>
107 110 </view>
108 111 </view>
109 112  
110   - <view class="goods-num">
  113 +
  114 + <block wx:if="{{prom_type==1}}">
  115 + <view class="goods-num">
  116 + <block>
  117 + <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view>
  118 +
  119 + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view>
  120 + <view class="stock" wx:else>限购:不限</view>
  121 + <view class="sales">已售:{{prom_act.buy_num+prom_act.virtual}}件</view>
  122 +
  123 + <!-- <block wx:if="{{prom_st==0}}">
  124 + <view class="sales">已购:0件</view>
  125 + </block> -->
  126 +
  127 + <!-- <block wx:else>
  128 + <view class="sales">已购:{{prom_act.buy_num+prom_act.virtual}}件</view>
  129 + </block> -->
  130 + </block>
  131 + <!-- <block wx:else>
  132 + <view class="stock">总数量:{{prom_act.goods_num}}件</view>
  133 + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view>
  134 + <view class="stock" wx:else>限购:不限</view>
  135 + <view class="sales">已购:{{prom_act.buy_num}}件</view>
  136 + </block> -->
  137 + </view>
  138 + </block>
  139 +
  140 + <view class="goods-num" wx:else>
111 141 <view class="sales">销量:{{data.sales_sum}}</view>
112 142 <view class="sales">有效天数:{{data.validDays?data.validDays:'不限'}}</view>
113 143 </view>
114 144  
115 145 </view>
116   - <!-- </block> -->
  146 + </block>
117 147  
118 148  
119 149  
... ... @@ -186,6 +216,8 @@
186 216 </view>
187 217 </view>
188 218  
  219 +
  220 +
189 221  
190 222 <!-- 保障服务 -->
191 223 <view class="bz_view flex bdt16 ai_c" wx:if="{{store_config.service_bz}}">
... ... @@ -506,7 +538,7 @@
506 538 <view class="join-cart jc_sb ai_c">
507 539  
508 540 <view class="flex">
509   - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact"
  541 + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact"
510 542 session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
511 543 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
512 544 <view>客服</view>
... ... @@ -521,6 +553,11 @@
521 553 <view wx:else class="custom-service cart-ico new_split pdh20" bindtap="contactService" style="text-align: center">
522 554 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
523 555 <view>客服</view>
  556 + </view> -->
  557 +
  558 + <view class="custom-service cart-ico new_split pdh20" bindtap="openCS">
  559 + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
  560 + <view>客服</view>
524 561 </view>
525 562  
526 563 <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20">
... ... @@ -542,44 +579,45 @@
542 579 <view class="flex f1 btn-group">
543 580  
544 581 <!-- 从“秒杀”入口进入购买商品 -->
545   - <!-- <block wx:if="{{options.prom_type == 1}}"> -->
546   - <block wx:if="{{options.prom_type == 1}}">
547   - <block wx:if="{{prom_st==1 && !prom_r_null}}">
548   - <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>
549   - <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view>
550   - </block>
551   -
552   - <block wx:if="{{prom_st == 0 && !prom_r_null}}">
553   - <!-- 秒杀预热要单独购买 -->
554   - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
555   - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
556   - <view class="buy-btn cart-btn lanse">即将开始</view>
557   - </block>
558   - <block wx:else>
559   - <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view>
560   - </block>
561   - </block>
562   -
  582 + <block wx:if="{{options.prom_type == 1}}">
  583 + <!-- 活动正在开始,商品还没抢光 -->
  584 + <block wx:if="{{prom_st==1 && !prom_r_null}}">
  585 + <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>
  586 + <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view>
  587 + </block>
563 588  
564   - <block wx:if="{{prom_r_null}}">
  589 + <!-- 活动还没开始,商品还没抢光 -->
  590 + <block wx:if="{{prom_st == 0 && !prom_r_null}}">
  591 + <!-- 秒杀预热要单独购买 -->
  592 + <!-- is_shop_buy支持以原价购买 -->
  593 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  594 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  595 + <view class="buy-btn cart-btn lanse f1">即将开始</view>
  596 + </block>
  597 + <block wx:else>
  598 + <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view>
  599 + </block>
  600 + </block>
565 601  
566   - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
567   - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
568   - <view class="buy-btn cart-btn huise f1">已抢光</view>
569   - </block>
570   - <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">已抢光</view>
571   - </block>
572   -
573   - <block wx:if="{{prom_st==3 && !prom_r_null}}">
574   - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
575   - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
576   - <view class="buy-btn cart-btn huise f1">活动已经结束</view>
577   - </block>
  602 + <!-- 商品已被抢光 -->
  603 + <block wx:if="{{prom_r_null}}">
  604 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  605 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  606 + <view class="buy-btn cart-btn huise f1">已抢光</view>
  607 + </block>
  608 + <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">已抢光</view>
  609 + </block>
578 610  
579   - <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view>
580   - </block>
  611 + <!-- 活动已经结束,商品还没抢光 -->
  612 + <block wx:if="{{prom_st==3 && !prom_r_null}}">
  613 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  614 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  615 + <view class="buy-btn cart-btn huise f1">活动已经结束</view>
  616 + </block>
  617 + <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view>
581 618 </block>
582   - <!-- </block> -->
  619 +
  620 + </block>
583 621  
584 622  
585 623 <!-- 从“我的服务”入口进入购买商品 -->
... ... @@ -587,15 +625,9 @@
587 625 <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>
588 626 <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即购买</view>
589 627 </block>
590   -
591   -
592   -
  628 +
593 629 </view>
594 630  
595   -
596   -
597   -
598   -
599 631 </view>
600 632  
601 633 <!-- 制作一个圆球导航 -->
... ... @@ -607,28 +639,33 @@
607 639 <view bindtap="closeSpecModal" class="cover-layer"></view>
608 640 <view class="spec-model">
609 641 <view class="pding">
  642 +
610 643 <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
  644 +
  645 +
611 646 <view class="spec-goods">
612 647 <image class="wh100 spec-img" src="{{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}}"
613 648 binderror="pop_err_img" data-errorimg="data.image_url" />
614 649 <view class="spec-goods-info">
615 650 <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view>
616 651 <view class="flex ai_end xc-val-money">
617   - <view class="spec-goods-price"><text class="fs20">¥</text>
618   - <block wx>{{data.shop_price}}</block>
  652 + <view class="spec-goods-price">
  653 + <text class="fs20">¥</text>
  654 + <block wx:if="{{options.prom_type == 1}}">{{prom_price}}</block>
  655 + <block wx:else>{{data.shop_price}}</block>
619 656 </view>
620 657 </view>
621 658 </view>
622 659 </view>
623 660  
  661 +
  662 +
624 663 <!-- 选择门店模块 -->
625 664 <view class="flex-space-between address ai_end xc-width" style="padding-top: 30rpx;">
626 665 <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
627 666 <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
628 667 <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
629   - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
630   -
631   - </view>
  668 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}</view>
632 669 </view>
633 670  
634 671 <!-- 没有门店的时候 -->
... ... @@ -639,6 +676,9 @@
639 676  
640 677 <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view>
641 678 </view>
  679 +
  680 +
  681 +
642 682 <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
643 683 <block wx:else>
644 684 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
... ... @@ -693,10 +733,8 @@
693 733 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
694 734 </block>
695 735 <block wx:else>
696   - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32"
697   - data-action="add">加入购物车</view>
698   - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy"
699   - data-action="buy">
  736 + <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add">加入购物车</view>
  737 + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">
700 738 {{sele_g.offline_price?"券后购买":"立即购买"}}
701 739 </view>
702 740 </block>
... ... @@ -716,6 +754,7 @@
716 754 {{sele_g.offline_price?"券后购买":"立即购买"}}
717 755 </view>
718 756 </block>
  757 +
719 758 <!-- 普通商品 -->
720 759 <block wx:else>
721 760 <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy {{!sto_sele_name?'gray':''}}"
... ... @@ -723,6 +762,7 @@
723 762 {{sele_g.offline_price?"券后购买":"立即购买"}}
724 763 </view>
725 764 </block>
  765 +
726 766 </block>
727 767 </block>
728 768 </block>
... ... @@ -902,3 +942,36 @@
902 942 </view>
903 943 </view>
904 944 </view>
  945 +
  946 +<!-- 弹起来,购买预热商品的普通购买 -->
  947 +<view hidden="{{!openSpecModal_flash_normal}}">
  948 + <include src="buy_flash_normal.wxml" />
  949 +</view>
  950 +
  951 +
  952 +<!-- 联系客服操作菜单 -->
  953 +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}">
  954 + <view class="pd20 t-c pr">
  955 + <text class="bold">联系客服</text>
  956 + <text class="iconfont icon-guan" bindtap="closeCS"></text>
  957 + </view>
  958 + <!-- 客服热线 -->
  959 + <view class="pd20 bdt fs30 btn2" bindtap="contactService">
  960 + <text class="iconfont icon-dianhua"></text>客服热线:
  961 + <text class="c-red">{{store_tel}}</text>
  962 + </view>
  963 + <!-- 小程序客服 -->
  964 + <block wx:if="{{sys_switch.weapp_customertype == 1}}">
  965 + <button class="pd20 bdt fs30 btn2" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  966 + <text class="iconfont icon-kefu1"></text>在线客服
  967 + </button>
  968 + </block>
  969 + <!-- 微信客服 -->
  970 + <block wx:elif="{{sys_switch.weapp_customertype == 2}}">
  971 + <view class="pd20 bdt fs30 btn2" bindtap="con_weixin">
  972 + <text class="iconfont icon-kefu1"></text>在线客服
  973 + </view>
  974 + </block>
  975 +</view>
  976 +
  977 +<view class="mask2" bindtap="closeCS"></view>
... ...
packageA/pages/goodsInfo/goodsInfo.wxss
... ... @@ -562,7 +562,7 @@ view.cart-btn-lg {
562 562 .spec-model {
563 563 position: fixed;
564 564 bottom: 0;
565   - z-index: 20;
  565 + z-index: 19;
566 566 background: white;
567 567 width: 100%;
568 568 /* padding: 0 30rpx; */
... ... @@ -2968,3 +2968,5 @@ button.custom-service::after{
2968 2968 left: -1000px;
2969 2969 top: -1000px;
2970 2970 }
  2971 +
  2972 +
... ...
packageA/pages/goods_share/goods_share.js
... ... @@ -123,9 +123,9 @@ Page({
123 123  
124 124 /*** 生命周期函数--监听页面显示***/
125 125 onShow: function () {
  126 + getApp().check_can_share();
126 127 var th=this;
127   -
128   -
  128 +
129 129 if(app.globalData.userInfo) {
130 130 this.setData({
131 131 //用来判断是否是分销商,是分销商才显示分成佣金
... ... @@ -177,7 +177,8 @@ Page({
177 177 /**e
178 178 * 用户点击右上角分享
179 179 */
180   - onShareAppMessage: function () {
  180 + onShareAppMessage: function () {
  181 + getApp().globalData.no_clear=1;
181 182 var th = this;
182 183 var item=this.data.share_good;
183 184 var price = item.shop_price;
... ... @@ -732,10 +733,7 @@ Page({
732 733 })
733 734 return false;
734 735 }
735   - wx.previewImage({
736   - //将图片预览出来
737   - urls: [that.data.shareImgPath]
738   - });
  736 + getApp().pre_img(that.data.shareImgPath);
739 737 wx.hideLoading();
740 738 }
741 739 })
... ...
packageA/pages/hongBao/hongBao.js
... ... @@ -76,10 +76,9 @@ Page({
76 76 */
77 77 onShow: function () {
78 78 console.log('onshow');
  79 + getApp().check_can_share();
79 80  
80   -
81   -
82   -
  81 +
83 82 },
84 83  
85 84 /**
... ... @@ -113,7 +112,7 @@ Page({
113 112 /**
114 113 * 用户点击右上角分享
115 114 */
116   - onShareAppMessage: function () {
  115 + onShareAppMessage: function () { getApp().globalData.no_clear=1
117 116  
118 117 },
119 118  
... ...
packageA/pages/hongBaoDetails/hongBaoDetails.js
... ... @@ -64,7 +64,7 @@ Page({
64 64 * 生命周期函数--监听页面显示
65 65 */
66 66 onShow: function () {
67   -
  67 + getApp().check_can_share();
68 68 },
69 69  
70 70 /**
... ... @@ -98,7 +98,7 @@ Page({
98 98 /**
99 99 * 用户点击右上角分享
100 100 */
101   - onShareAppMessage: function () {
  101 + onShareAppMessage: function () { getApp().globalData.no_clear=1
102 102  
103 103 },
104 104  
... ...
packageA/pages/jfbuy/jfbuy.js
... ... @@ -169,7 +169,7 @@ Page({
169 169 /**
170 170 * 生命周期函数--监听页面显示
171 171 */
172   - onShow: function () {},
  172 + onShow: function () { getApp().check_can_share(); },
173 173 /**
174 174 * 生命周期函数--监听页面隐藏
175 175 */
... ... @@ -187,8 +187,8 @@ Page({
187 187 /**
188 188 * 用户点击右上角分享
189 189 */
190   - onShareAppMessage: function () {
191   -
  190 + onShareAppMessage: function () {
  191 + getApp().globalData.no_clear=1;
192 192 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:'';
193 193  
194 194 var pagePath = this.route; //当前页面url
... ... @@ -270,6 +270,7 @@ Page({
270 270  
271 271  
272 272 onShareTimeline() {
  273 + getApp().globalData.no_clear=1;
273 274 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:'';
274 275  
275 276 var pagePath = this.route; //当前页面url
... ...
packageA/pages/liveStream/liveStream.js
... ... @@ -208,9 +208,10 @@ Page({
208 208 * 生命周期函数--监听页面加载
209 209 */
210 210 onLoad: function (options) {
  211 + self=this;
211 212 getApp().is_Single_page(this,function(){
212 213 app.isLogin().then(function(data) {//进入页面前已经授权登录成功
213   - this.setData({
  214 + self.setData({
214 215 userInfo: data,
215 216 });
216 217 });
... ... @@ -229,6 +230,8 @@ Page({
229 230 * 生命周期函数--监听页面显示
230 231 */
231 232 onShow: function () {
  233 +
  234 + getApp().check_can_share();
232 235 if(app.globalData.userInfo) {
233 236 if(!this.data.isLogin) {
234 237 this.setData({
... ... @@ -247,6 +250,9 @@ Page({
247 250 self.setData({
248 251 living: self.data.list,
249 252 });
  253 +
  254 +
  255 + console.log(self.data.living);
250 256  
251 257 //直播中列表请求完后,请求即将开始列表
252 258 self.getData(true, '/api/weshop/wx/livelist/page', {
... ... @@ -348,7 +354,7 @@ Page({
348 354 /**
349 355 * 用户点击右上角分享
350 356 */
351   - onShareAppMessage: function () {
  357 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
352 358 if (res.from === 'button') {
353 359 // 来自页面内转发按钮
354 360 // console.log(res.target)
... ... @@ -360,6 +366,7 @@ Page({
360 366 },
361 367  
362 368 onShareTimeline: function (res) {
  369 + getApp().globalData.no_clear=1;
363 370 if (res.from === 'button') {
364 371 // 来自页面内转发按钮
365 372 // console.log(res.target)
... ...
packageA/pages/liveStream/liveStream.wxml
... ... @@ -29,7 +29,7 @@
29 29 <block wx:if="{{living.pageData.length > 0}}">
30 30 <view class="title">直播中</view>
31 31 <view class="list">
32   - <block wx:for="{{liveing.pageData}}" wx:key="item">
  32 + <block wx:for="{{living.pageData}}" wx:key="item">
33 33 <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing">
34 34 <view class="list-item-left">
35 35 <image src="{{item.share_img}}" class="item-pic" mode="aspectFit"></image>
... ...
packageA/pages/liveStreamDetails/liveStreamDetails.js
... ... @@ -53,6 +53,11 @@ Page({
53 53  
54 54 // 分享操作表
55 55 clickShare: function () {
  56 +
  57 + if(!getApp().globalData.user_id){
  58 + getApp().goto("/pages/togoin/togoin");
  59 + return false;
  60 + }
56 61 this.setData({
57 62 showActionSheet: !this.data.showActionSheet
58 63 })
... ... @@ -570,7 +575,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un
570 575 * 生命周期函数--监听页面显示
571 576 */
572 577 onShow: function () {
573   -
  578 + getApp().check_can_share();
574 579 },
575 580  
576 581 /**
... ... @@ -605,6 +610,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un
605 610 * 用户点击右上角分享
606 611 */
607 612 onShareAppMessage: function (res) {
  613 + getApp().globalData.clear=1;
608 614 this.setData({
609 615 showActionSheet: 'false'
610 616 })
... ... @@ -625,6 +631,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un
625 631 },
626 632  
627 633 onShareTimeline: function (res) {
  634 + getApp().globalData.no_clear=1;
628 635 if (res.from === 'button') {
629 636 // 来自页面内转发按钮
630 637 console.log(res.target)
... ...
packageA/pages/live_share/live_share.js
... ... @@ -44,7 +44,7 @@ Page({
44 44 * 生命周期函数--监听页面显示
45 45 */
46 46 onShow: function () {
47   -
  47 + getApp().check_can_share();
48 48 },
49 49  
50 50 /**
... ... @@ -71,7 +71,7 @@ Page({
71 71 /**
72 72 * 用户点击右上角分享
73 73 */
74   - onShareAppMessage: function () {
  74 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
75 75 var th=this;
76 76 var id=th.data.hui_active.id;
77 77 var url='/packageA/pages/liveStreamDetails/liveStreamDetails?id=' + id + '&live=ing';
... ...
packageA/pages/myGift/myGift.js
... ... @@ -67,6 +67,8 @@ Page({
67 67 * 生命周期函数--监听页面显示
68 68 */
69 69 onShow: function () {
  70 +
  71 + getApp().check_can_share();
70 72 if(app.globalData.userInfo) {
71 73 if(!this.data.isLogin) {
72 74 this.setData({
... ... @@ -147,7 +149,7 @@ Page({
147 149 /**
148 150 * 用户点击右上角分享
149 151 */
150   - onShareAppMessage: function () {
  152 + onShareAppMessage: function () { getApp().globalData.no_clear=1
151 153  
152 154 },
153 155  
... ...
packageA/pages/myGiftDetails/myGiftDetails.js
... ... @@ -57,6 +57,7 @@ Page({
57 57 * 生命周期函数--监听页面显示
58 58 */
59 59 onShow: function () {
  60 + getApp().check_can_share();
60 61 if(app.globalData.userInfo) {
61 62 if(!this.data.isLogin) {
62 63 this.setData({
... ... @@ -192,7 +193,7 @@ Page({
192 193 /**
193 194 * 用户点击右上角分享
194 195 */
195   - onShareAppMessage: function () {
  196 + onShareAppMessage: function () { getApp().globalData.no_clear=1
196 197  
197 198 },
198 199  
... ...
packageA/pages/my_service/beauty_deta.js
... ... @@ -394,6 +394,7 @@ Page({
394 394 previewImage: function(e) {
395 395 var th = this;
396 396 var current = e.currentTarget.dataset.src;
  397 + getApp().globalData.no_clear=1;
397 398 wx.previewImage({
398 399 current: current, // 当前显示图片的http链接
399 400 urls: [th.data.head_img] // 需要预览的图片http链接列表
... ...
packageA/pages/my_service2/beauty_deta.js
... ... @@ -394,6 +394,7 @@ Page({
394 394 previewImage: function(e) {
395 395 var th = this;
396 396 var current = e.currentTarget.dataset.src;
  397 + getApp().globalData.no_clear=1;
397 398 wx.previewImage({
398 399 current: current, // 当前显示图片的http链接
399 400 urls: [th.data.head_img] // 需要预览的图片http链接列表
... ...
packageA/pages/parseHtml/parseHtml.js
... ... @@ -286,7 +286,7 @@ Page({
286 286 * 生命周期函数--监听页面显示
287 287 */
288 288 onShow: function () {
289   -
  289 + getApp().check_can_share();
290 290 },
291 291  
292 292 /**
... ... @@ -320,7 +320,7 @@ Page({
320 320 /**
321 321 * 用户点击右上角分享
322 322 */
323   - onShareAppMessage: function () {
  323 + onShareAppMessage: function () { getApp().globalData.no_clear=1
324 324  
325 325 },
326 326  
... ...
packageA/pages/profile/profile.js
... ... @@ -688,6 +688,9 @@ Page({
688 688 },
689 689  
690 690 onShow: function() {
  691 +
  692 + getApp().check_can_share();
  693 +
691 694 var e = this;
692 695 if (this.data.is_zy) return false;
693 696 this.wait_for_store_config();
... ... @@ -875,6 +878,7 @@ Page({
875 878  
876 879 //--点击分享事件---
877 880 onShareAppMessage: function(t) {
  881 + getApp().globalData.no_clear=1
878 882 return o.share;
879 883 },
880 884  
... ...
packageA/pages/prom_list/prom_list.js
... ... @@ -162,6 +162,9 @@ Page({
162 162  
163 163 //---展示---
164 164 onShow: function() {
  165 +
  166 + getApp().check_can_share();
  167 +
165 168 var ee=this,th=ee,that=ee;
166 169 var gid = this.data.gid,i = getApp().request;
167 170 ee.data.g_buy_num = new Map();
... ... @@ -711,6 +714,7 @@ Page({
711 714  
712 715 //--点击分享事件---
713 716 onShareAppMessage: function(t) {
  717 + getApp().globalData.no_clear=1
714 718 var curPage=this;
715 719 var pagePath = curPage.route; //当前页面url
716 720 if (pagePath.indexOf('/') != 0) {
... ...
packageA/pages/quan/quan.js
... ... @@ -48,7 +48,7 @@ Page({
48 48 /**
49 49 * 生命周期函数--监听页面显示
50 50 */
51   - onShow: function () { },
  51 + onShow: function () { getApp().check_can_share(); },
52 52  
53 53 /**
54 54 * 生命周期函数--监听页面隐藏
... ... @@ -73,7 +73,7 @@ Page({
73 73 /**
74 74 * 用户点击右上角分享
75 75 */
76   - onShareAppMessage: function () {
  76 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
77 77 var th=this;
78 78 var id=th.data.hui_active.id;
79 79 var url="/packageA/pages/quan_pro/quan_pro?id="+id;
... ...
packageA/pages/service_share/service_share.js
... ... @@ -97,6 +97,8 @@ Page({
97 97  
98 98 /*** 生命周期函数--监听页面显示***/
99 99 onShow: function () {
  100 + getApp().check_can_share();
  101 +
100 102 var th=this;
101 103 getApp().getConfig2(function(rs){
102 104 //计算等级价相关
... ... @@ -141,7 +143,7 @@ Page({
141 143 /**e
142 144 * 用户点击右上角分享
143 145 */
144   - onShareAppMessage: function () {
  146 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
145 147 var th = this;
146 148 var item=this.data.share_good;
147 149 var price = item.money;
... ... @@ -709,10 +711,7 @@ Page({
709 711 })
710 712 return false;
711 713 }
712   - wx.previewImage({
713   - //将图片预览出来
714   - urls: [that.data.shareImgPath]
715   - });
  714 + getApp().pre_img(that.data.shareImgPath);
716 715 wx.hideLoading();
717 716 }
718 717 })
... ...
packageA/pages/text/text.js deleted
1   -// packageA//pages/text/text.js
2   -Page({
3   -
4   - /**
5   - * 页面的初始数据
6   - */
7   - data: {
8   -
9   - },
10   -
11   - /**
12   - * 生命周期函数--监听页面加载
13   - */
14   - onLoad: function (options) {
15   -
16   - },
17   -
18   - /**
19   - * 生命周期函数--监听页面初次渲染完成
20   - */
21   - onReady: function () {
22   -
23   - },
24   -
25   - /**
26   - * 生命周期函数--监听页面显示
27   - */
28   - onShow: function () {
29   -
30   - },
31   -
32   - /**
33   - * 生命周期函数--监听页面隐藏
34   - */
35   - onHide: function () {
36   -
37   - },
38   -
39   - /**
40   - * 生命周期函数--监听页面卸载
41   - */
42   - onUnload: function () {
43   -
44   - },
45   -
46   - /**
47   - * 页面相关事件处理函数--监听用户下拉动作
48   - */
49   - onPullDownRefresh: function () {
50   -
51   - },
52   -
53   - /**
54   - * 页面上拉触底事件的处理函数
55   - */
56   - onReachBottom: function () {
57   -
58   - },
59   -
60   - /**
61   - * 用户点击右上角分享
62   - */
63   - onShareAppMessage: function () {
64   -
65   - }
66   -})
67 0 \ No newline at end of file
packageA/pages/text/text.json deleted
1   -{
2   - "usingComponents": {}
3   -}
4 0 \ No newline at end of file
packageA/pages/text/text.wxml deleted
1   -<!--packageA//pages/text/text.wxml-->
2   -<text>packageA//pages/text/text.wxml</text>
packageA/pages/text/text.wxss deleted
1   -/* packageA//pages/text/text.wxss */
2 0 \ No newline at end of file
packageA/pages/user/my_service2/appment_main.js
... ... @@ -26,7 +26,7 @@ Page({
26 26 * 生命周期函数--监听页面显示
27 27 */
28 28 onShow: function () {
29   -
  29 + getApp().check_can_share();
30 30 },
31 31  
32 32 /**
... ... @@ -60,7 +60,7 @@ Page({
60 60 /**
61 61 * 用户点击右上角分享
62 62 */
63   - onShareAppMessage: function () {
  63 + onShareAppMessage: function () { getApp().globalData.no_clear=1
64 64  
65 65 }
66 66 })
67 67 \ No newline at end of file
... ...
packageB/pages/boxes-details/boxes-details.js
... ... @@ -51,6 +51,8 @@ Page({
51 51 * 生命周期函数--监听页面显示
52 52 */
53 53 onShow: function() {
  54 + getApp().check_can_share();
  55 +
54 56 // console.log('show~~~');
55 57 if (app.globalData.userInfo) {
56 58 if (!this.data.isLogin) {
... ... @@ -124,7 +126,7 @@ Page({
124 126 * 用户点击右上角分享
125 127 */
126 128 onShareAppMessage: function() {
127   -
  129 + getApp().globalData.no_clear=1
128 130 },
129 131  
130 132  
... ...
packageB/pages/boxes-list/boxes-list.js
... ... @@ -9,7 +9,9 @@ Page({
9 9 currentTabIndex: 0,
10 10  
11 11 isLogin: false,
12   - list: null,
  12 + list: {
  13 + pageData: [],
  14 + },
13 15 isLoading: false, // 检测是否已经发送请求,防止重复发送请求
14 16 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据
15 17 pageNum: 1, // 当前页数
... ... @@ -103,6 +105,14 @@ Page({
103 105 },
104 106  
105 107 clickTab(e) {
  108 + // 判断会员状态
  109 + let user_info = getApp().globalData.userInfo;
  110 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
  111 + wx.navigateTo({
  112 + url: '/pages/togoin/togoin',
  113 + })
  114 + return false;
  115 + };
106 116 this.debounce(this.handleTab.bind(this, e), 200)();
107 117 },
108 118  
... ...
packageB/pages/luckactivity/index/index.js
... ... @@ -69,6 +69,8 @@ Page({
69 69 * 生命周期函数--监听页面显示
70 70 */
71 71 onShow: function () {
  72 + getApp().check_can_share();
  73 +
72 74 if(app.globalData.userInfo) {
73 75 if(!this.data.isLogin) {
74 76 this.setData({
... ... @@ -166,7 +168,7 @@ Page({
166 168 /**
167 169 * 用户点击右上角分享
168 170 */
169   - onShareAppMessage: function () {
  171 + onShareAppMessage: function () { getApp().globalData.no_clear=1
170 172  
171 173 },
172 174  
... ...
packageB/pages/user/Change_phone/Change_phone.js
... ... @@ -211,7 +211,7 @@ Page({
211 211 * 生命周期函数--监听页面显示
212 212 */
213 213 onShow: function() {
214   -
  214 + getApp().check_can_share();
215 215 },
216 216  
217 217 /**
... ... @@ -246,6 +246,6 @@ Page({
246 246 * 用户点击右上角分享
247 247 */
248 248 onShareAppMessage: function() {
249   -
  249 + getApp().globalData.no_clear=1
250 250 }
251 251 })
... ...
packageB/pages/user/add_comment/add_comment.js
... ... @@ -220,6 +220,7 @@ Page({
220 220  
221 221 var imgs = this.data.imgs;
222 222  
  223 + getApp().globalData.no_clear=1;
223 224 wx.chooseImage({
224 225 count: 1, // 默认9
225 226 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
... ... @@ -259,6 +260,7 @@ Page({
259 260 var index = e.currentTarget.dataset.index;
260 261 //所有图片
261 262 var imgs = this.data.imgs;
  263 + getApp().globalData.no_clear=1;
262 264 wx.previewImage({
263 265 //当前显示图片
264 266 current: imgs[index],
... ...
packageB/pages/user/binding_info/binding_info.js
... ... @@ -26,7 +26,7 @@ Page({
26 26 * 生命周期函数--监听页面显示
27 27 */
28 28 onShow: function () {
29   -
  29 + getApp().check_can_share();
30 30 },
31 31  
32 32 /**
... ... @@ -60,7 +60,7 @@ Page({
60 60 /**
61 61 * 用户点击右上角分享
62 62 */
63   - onShareAppMessage: function () {
  63 + onShareAppMessage: function () { getApp().globalData.no_clear=1
64 64  
65 65 }
66 66 })
67 67 \ No newline at end of file
... ...
packageB/pages/user/buyDetails/buyDetails.js
... ... @@ -40,6 +40,7 @@ Page({
40 40 * 生命周期函数--监听页面显示
41 41 */
42 42 onShow: function () {
  43 + getApp().check_can_share();
43 44 if(app.globalData.userInfo) {
44 45 if(!this.data.isLogin) {
45 46 this.setData({
... ... @@ -106,7 +107,7 @@ Page({
106 107 /**
107 108 * 用户点击右上角分享
108 109 */
109   - onShareAppMessage: function () {
  110 + onShareAppMessage: function () { getApp().globalData.no_clear=1
110 111  
111 112 },
112 113  
... ...
packageB/pages/user/choice_guide/choice_guide.js
... ... @@ -19,6 +19,7 @@ Page({
19 19 onLoad: function(t) {},
20 20  
21 21 onShow: function() {
  22 + getApp().check_can_share();
22 23 this.data.ismore=0;this.data.isload=0;
23 24 this.setData({list:null});
24 25 this.get_list();
... ... @@ -26,6 +27,7 @@ Page({
26 27  
27 28 //--点击分享事件---
28 29 onShareAppMessage: function(t) {
  30 + getApp().globalData.no_clear=1
29 31 return o.share;
30 32 },
31 33 get_list: function() {
... ...
packageB/pages/user/comment/comment.js
... ... @@ -161,6 +161,7 @@ Page({
161 161 } else {
162 162 image = imgArr[index].weapp_img[sindex];
163 163 }
  164 + getApp().globalData.no_clear=1;
164 165 wx.previewImage({
165 166 current: image,
166 167 //当前图片地址
... ...
packageB/pages/user/view_comment/view_comment.js
... ... @@ -112,6 +112,7 @@ Page({
112 112 var iurl = th.data.iurl;
113 113 if (image != "") {
114 114 image = imgArr[0].weapp_img[index];
  115 + getApp().globalData.no_clear=1;
115 116 wx.previewImage({
116 117 current: image,
117 118 //当前图片地址
... ... @@ -119,6 +120,7 @@ Page({
119 120 })
120 121 } else {
121 122 image = imgArr[0].img[index];
  123 + getApp().globalData.no_clear=1;
122 124 wx.previewImage({
123 125 current: iurl + image,
124 126 //当前图片地址
... ...
packageB/pages/video/index.js
... ... @@ -7,6 +7,7 @@ Page({
7 7 },
8 8 bindButtonTap: function() {
9 9 var that = this
  10 + getApp().globalData.no_clear=1;
10 11 wx.chooseVideo({
11 12 sourceType: ['album', 'camera'],
12 13 maxDuration: 60,
... ... @@ -25,6 +26,8 @@ Page({
25 26 })
26 27 },
27 28 onShow:function(){
  29 + getApp().check_can_share();
  30 +
28 31 var goods_list = this.selectComponent("#goods_list"); //组件的id
29 32 goods_list.init();
30 33 setTimeout(function() {
... ... @@ -34,6 +37,7 @@ Page({
34 37  
35 38 //---------分享配置--------
36 39 onShareAppMessage: function (e) {
  40 + getApp().globalData.no_clear=1
37 41 return {
38 42 title: "直播视频回放",
39 43 }
... ...
packageB/pages/zuhegou/index/index.js
... ... @@ -160,6 +160,8 @@ Page({
160 160 * 生命周期函数--监听页面显示
161 161 */
162 162 onShow: function () {
  163 + getApp().check_can_share();
  164 +
163 165 getApp().is_Single_page(this, function () {
164 166 var th = this,
165 167 that = this,
... ... @@ -446,7 +448,7 @@ Page({
446 448 /**
447 449 * 用户点击右上角分享
448 450 */
449   - onShareAppMessage: function () {
  451 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
450 452 var title = this.data.act.name;
451 453 var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
452 454 if (getApp().globalData.user_id) {
... ... @@ -465,6 +467,7 @@ Page({
465 467 * 用户分享朋友圈
466 468 */
467 469 onShareTimeline() {
  470 + getApp().globalData.no_clear=1;
468 471 var title = this.data.act.name;
469 472 var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
470 473 if (getApp().globalData.user_id) {
... ...
packageB/pages/zuhegou/list/list.js
... ... @@ -65,7 +65,10 @@ Page({
65 65 },
66 66  
67 67  
68   - onShow: function(t) {
  68 + onShow: function(t) {
  69 +
  70 + getApp().check_can_share();
  71 +
69 72 this.data.ismore=1;
70 73 this.data.is_timer=1;
71 74 this.data.currentPage=1;
... ... @@ -198,6 +201,7 @@ Page({
198 201  
199 202 //---------分享配置--------
200 203 onShareAppMessage: function (e) {
  204 + getApp().globalData.no_clear=1
201 205 var curPage=this;
202 206 var pagePath = curPage.route; //当前页面url
203 207 if (pagePath.indexOf('/') != 0) {
... ...
packageB/pages/zuhegou/preindex/index.js
... ... @@ -159,6 +159,8 @@ Page({
159 159 * 生命周期函数--监听页面显示
160 160 */
161 161 onShow: function () {
  162 + getApp().check_can_share();
  163 +
162 164 getApp().is_Single_page(this, function () {
163 165 var th = this,
164 166 that = this,
... ... @@ -447,7 +449,7 @@ Page({
447 449 /**
448 450 * 用户点击右上角分享
449 451 */
450   - onShareAppMessage: function () {
  452 + onShareAppMessage: function () { getApp().globalData.no_clear=1;
451 453 var title = this.data.act.name;
452 454 var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
453 455 if (getApp().globalData.user_id) {
... ... @@ -466,6 +468,7 @@ Page({
466 468 * 用户分享朋友圈
467 469 */
468 470 onShareTimeline() {
  471 + getApp().globalData.no_clear=1;
469 472 var title = this.data.act.name;
470 473 var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
471 474 if (getApp().globalData.user_id) {
... ...
packageC/pages/goods/distributionCategoryList/index.js
... ... @@ -231,6 +231,8 @@ Page({
231 231 })
232 232 },
233 233 onShow: function () {
  234 +
  235 + getApp().check_can_share();
234 236 if (t.globalData.userInfo) {
235 237 let currentData = {
236 238 store_id: t.globalData.setting.stoid,
... ... @@ -404,6 +406,7 @@ Page({
404 406 },
405 407 //---------分享配置--------
406 408 onShareAppMessage: function (e) {
  409 + getApp().globalData.no_clear=1
407 410  
408 411 var url = "pages/goods/categoryList/categoryList";
409 412 var userInfo = getApp().globalData.userInfo;
... ... @@ -639,9 +642,9 @@ Page({
639 642 //扫一扫
640 643 getScancode: function () {
641 644 // 允许从相机和相册扫码
  645 + getApp().globalData.no_clear=1;
642 646 wx.scanCode({
643 647 success: (res) => {
644   - console.log(res);
645 648 var key_word = res.result;
646 649 wx.navigateBack({
647 650 delta: 1
... ...
packageC/pages/goods/goodsList/goodsList.js
... ... @@ -119,6 +119,11 @@ Page({
119 119 }
120 120 });
121 121 },
  122 +
  123 + onShow:function () {
  124 + getApp().check_can_share();
  125 + },
  126 +
122 127 //设置优惠券的
123 128 set_prom_list: async function (arr) {
124 129 var th = this;
... ... @@ -240,6 +245,7 @@ Page({
240 245 },
241 246 //---------分享配置--------
242 247 onShareAppMessage: function (e) {
  248 + getApp().globalData.no_clear=1
243 249 var curPage = this;
244 250 var pagePath = curPage.route; //当前页面url
245 251 if (pagePath.indexOf('/') != 0) {
... ... @@ -312,4 +318,6 @@ Page({
312 318 },
313 319  
314 320  
  321 +
  322 +
315 323 });
316 324 \ No newline at end of file
... ...
packageC/pages/goods/search/search.js
... ... @@ -31,6 +31,10 @@ Page({
31 31 is_his: 0,
32 32 },
33 33  
  34 + onShow:function () {
  35 + getApp().check_can_share();
  36 + },
  37 +
34 38 onLoad: function (t) {
35 39 this.data.rq_data = t;
36 40  
... ... @@ -235,6 +239,7 @@ Page({
235 239  
236 240 //---------分享配置--------
237 241 onShareAppMessage: function (e) {
  242 + getApp().globalData.no_clear=1
238 243 var curPage = this;
239 244 var pagePath = curPage.route; //当前页面url
240 245 if (pagePath.indexOf('/') != 0) {
... ...
packageC/pages/group_list/group_list.js
... ... @@ -44,6 +44,7 @@ Page({
44 44 * 生命周期函数--监听页面显示
45 45 */
46 46 onShow: function () {
  47 + getApp().check_can_share();
47 48 if(app.globalData.userInfo) {
48 49 if(!this.data.isLogin) {
49 50 this.setData({
... ... @@ -147,7 +148,7 @@ Page({
147 148 /**
148 149 * 用户点击右上角分享
149 150 */
150   - onShareAppMessage: function () {
  151 + onShareAppMessage: function () { getApp().globalData.no_clear=1
151 152  
152 153 },
153 154  
... ...
packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js
... ... @@ -35,6 +35,7 @@ Page({
35 35 },
36 36  
37 37 onShow: function() {
  38 + getApp().check_can_share();
38 39 if(app.globalData.userInfo) {
39 40 if(!this.data.isLogin) {
40 41 this.setData({
... ... @@ -191,6 +192,7 @@ Page({
191 192 * 用户点击右上角分享
192 193 */
193 194 onShareAppMessage: function (e) {
  195 + getApp().globalData.no_clear=1
194 196 var pagePath = this.route; //当前页面url
195 197 if (pagePath.indexOf('/') != 0) {
196 198 pagePath = '/' + pagePath;
... ...
packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
... ... @@ -106,6 +106,7 @@ Page({
106 106 },
107 107  
108 108 onShow: function() {
  109 + getApp().check_can_share();
109 110 this.get_team_info();
110 111 },
111 112  
... ... @@ -972,6 +973,7 @@ Page({
972 973  
973 974 //------ 分享配置 --------
974 975 onShareAppMessage: function (e) {
  976 + getApp().globalData.no_clear=1
975 977 var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.param.goods_id}&prom_type=9&group_id=${this.data.param.group_id}`; //当前页面url
976 978 // console.log('pagePath=====xxxxxx>', pagePath);
977 979 var imgPath = this.data.iurl + this.data.luckyGoInfo.original_img;
... ... @@ -1008,6 +1010,10 @@ Page({
1008 1010 // },
1009 1011  
1010 1012 clickShare() {
  1013 + if(!getApp().globalData.user_id){
  1014 + getApp().goto("/pages/togoin/togoin");
  1015 + return false;
  1016 + }
1011 1017 this.setData({
1012 1018 share_hidden: true,
1013 1019 });
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -8,6 +8,7 @@ var t = require(&quot;../../../../utils/util.js&quot;),
8 8 oo = s.globalData,
9 9 o = s.globalData.setting,
10 10 os = o;
  11 +let self = null;
11 12  
12 13 //评价加载更多
13 14 var more = function (e) {
... ... @@ -281,11 +282,13 @@ Page({
281 282 surplus: 0,
282 283 canBuy: false,
283 284 btnHidden: false,
  285 +
  286 + hiddenCS: true,
284 287 },
285 288  
286 289 //------初始化加载----------
287 290 onLoad: function (t) {
288   -
  291 + self = this;
289 292 // console.log('onload');
290 293 if (t && t.group_id) {
291 294 this.data.group_id = t.group_id;
... ... @@ -753,6 +756,8 @@ Page({
753 756  
754 757 //---展示---
755 758 onShow: async function () {
  759 +
  760 + getApp().check_can_share();
756 761 // console.log('onshow');
757 762 var goods_list = null, th = this, that = this;
758 763 var show_prew_img = this.data.show_prew_img
... ... @@ -2248,24 +2253,37 @@ Page({
2248 2253  
2249 2254 //---------联系客服------------
2250 2255 contactService: function () {
2251   - s.getConfig(function (t) {
2252   - if (t.store_tel == undefined) {
2253   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
2254   - isShowLoading: 1,
2255   - data: {},
2256   - success: function (rs) {
2257   - getApp().globalData.config = rs.data.data;
2258   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
2259   - getApp().my_warnning("商家未设置电话", 0, th);
2260   - return false;
2261   - }
2262   - s.confirmBox("请联系客服:" + rs.data.data.store_tel);
2263   - }
2264   - })
2265   - } else {
2266   - s.confirmBox("请联系客服:" + t.store_tel);
2267   - }
2268   - });
  2256 + getApp().com_call(this);
  2257 + },
  2258 + // 获取客服电话
  2259 + getTel() {
  2260 + return new Promise((resolve, reject) => {
  2261 + s.getConfig(function (t) {
  2262 + if (t.store_tel == undefined) {
  2263 + getApp().request.get("/api/weshop/store/get/" + os.stoid, {
  2264 + isShowLoading: 1,
  2265 + data: {},
  2266 + success: function (rs) {
  2267 + getApp().globalData.config = rs.data.data;
  2268 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
  2269 + getApp().my_warnning("商家未设置电话", 0, th);
  2270 + return false;
  2271 + }
  2272 + self.setData({
  2273 + store_tel: rs.data.data.store_tel,
  2274 + });
  2275 + // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
  2276 + }
  2277 + })
  2278 + } else {
  2279 + self.setData({
  2280 + store_tel: t.store_tel,
  2281 + });
  2282 + // s.confirmBox("请联系客服:" + t.store_tel);
  2283 + };
  2284 + resolve();
  2285 + });
  2286 + });
2269 2287 },
2270 2288 //-------获取购物车数量----------
2271 2289 requestCardNum: function () {
... ... @@ -2306,11 +2324,7 @@ Page({
2306 2324 b[i] = this.data.iurl + e[i];
2307 2325 }
2308 2326 this.data.show_prew_img = 1;
2309   -
2310   - wx.previewImage({
2311   - current: b[t.currentTarget.dataset.id],
2312   - urls: b
2313   - });
  2327 + getApp().pre_img2(b,t);
2314 2328 },
2315 2329  
2316 2330 previewCommentImgs_w: function (t) {
... ... @@ -2320,21 +2334,16 @@ Page({
2320 2334 b[i] = this.data.iurl + e[i];
2321 2335 }
2322 2336 this.data.show_prew_img = 1;
2323   - wx.previewImage({
2324   - current: b[t.currentTarget.dataset.id],
2325   - urls: b
2326   - });
  2337 + getApp().pre_img2(b,t);
2327 2338 },
2328 2339  
2329 2340 previewGoodsCommentImgs: function (t) {
2330 2341 var e = this,
2331 2342 a = this.data.data.comment[t.currentTarget.dataset.cidx].img;
  2343 + getApp().globalData.no_clear=1;
2332 2344 a = a.map(function (t) {
2333 2345 return e.data.url + t;
2334   - }), wx.previewImage({
2335   - current: a[t.currentTarget.dataset.id],
2336   - urls: a
2337   - });
  2346 + }), getApp().pre_img2(a,t);
2338 2347 this.data.show_prew_img = 1;
2339 2348 },
2340 2349 closePromModal: function () {
... ... @@ -2349,7 +2358,7 @@ Page({
2349 2358 },
2350 2359  
2351 2360 //--点击分享事件---
2352   - onShareAppMessage: function (t) {
  2361 + onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
2353 2362  
2354 2363 // var th = this;
2355 2364 // var price = th.data.sele_g.shop_price;
... ... @@ -6095,11 +6104,8 @@ Page({
6095 6104 },
6096 6105  
6097 6106 previewImage() {
6098   - this.data.show_prew_img = 1;
6099   - wx.previewImage({
6100   - //将图片预览出来
6101   - urls: [this.data.sele_g.original_img]
6102   - });
  6107 + this.data.show_prew_img = 1;
  6108 + getApp().pre_img(this.data.sele_g.original_img);
6103 6109 },
6104 6110  
6105 6111 is_show_more_buy: function () {
... ... @@ -6175,6 +6181,7 @@ Page({
6175 6181 },
6176 6182  
6177 6183 onShareTimeline() {
  6184 + getApp().globalData.no_clear=1;
6178 6185 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
6179 6186 if (!store_name)
6180 6187 store_name = getApp().globalData.setting.appName;
... ... @@ -6192,6 +6199,10 @@ Page({
6192 6199 },
6193 6200  
6194 6201 clickShare() {
  6202 + if(!getApp().globalData.user_id){
  6203 + getApp().goto("/pages/togoin/togoin");
  6204 + return false;
  6205 + }
6195 6206 this.setData({
6196 6207 share_hidden: true,
6197 6208 });
... ... @@ -6327,13 +6338,7 @@ Page({
6327 6338 },
6328 6339  
6329 6340 con_weixin: function () {
6330   - var url = this.data.sys_switch.weapp_customertype_url;
6331   - var id = this.data.sys_switch.weapp_customertype_appid;
6332   - wx.openCustomerServiceChat({
6333   - extInfo: { url: url },
6334   - corpId: id,
6335   - success(res) { }
6336   - })
  6341 + getApp().con_wx(this);
6337 6342 },
6338 6343  
6339 6344  
... ... @@ -6486,6 +6491,7 @@ Page({
6486 6491  
6487 6492 // 预览海报
6488 6493 previewPoster() {
  6494 + getApp().globalData.no_clear=1;
6489 6495 wx.previewImage({
6490 6496 current: this.data.shareImgPath, // 当前显示图片的http链接
6491 6497 urls: [this.data.shareImgPath],// 需要预览的图片http链接列表
... ... @@ -6493,4 +6499,47 @@ Page({
6493 6499 },
6494 6500  
6495 6501  
  6502 + click_contact:function () {
  6503 + getApp().globalData.no_clear=1;
  6504 + },
  6505 +
  6506 + //打开客服操作菜单
  6507 + openCS() {
  6508 + // 判断会员状态
  6509 + let user_info = getApp().globalData.userInfo;
  6510 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
  6511 + wx.navigateTo({
  6512 + url: '/pages/togoin/togoin',
  6513 + })
  6514 + return false;
  6515 + };
  6516 + // csType/在线客服设置:
  6517 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  6518 + // 1小程序客服、
  6519 + // 2企业微信客服
  6520 + if(this.data.sys_switch) {
  6521 + let csType = this.data.sys_switch.weapp_customertype;
  6522 + if(csType == 0) {
  6523 + // 拨打电话号码
  6524 + this.contactService();
  6525 + } else {
  6526 + this.getTel()
  6527 + .then(() => {
  6528 + self.setData({
  6529 + hiddenCS: false,
  6530 + });
  6531 + });
  6532 + };
  6533 + };
  6534 +
  6535 + },
  6536 +
  6537 + //关闭客服操作菜单
  6538 + closeCS() {
  6539 + this.setData({
  6540 + hiddenCS: true,
  6541 + });
  6542 + },
  6543 +
  6544 +
6496 6545 });
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... ... @@ -871,7 +871,7 @@
871 871 <!-- -----------------底部按钮------------------ -->
872 872 <view class="join-cart">
873 873 <!-- bindtap="contactService" -->
874   - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  874 + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
875 875 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
876 876 <view>客服</view>
877 877 </button>
... ... @@ -884,7 +884,12 @@
884 884 <view wx:else class="custom-service cart-ico new_split" bindtap="contactService">
885 885 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
886 886 <view>客服</view>
887   - </view>
  887 + </view> -->
  888 +
  889 + <view class="custom-service cart-ico new_split" bindtap="openCS">
  890 + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
  891 + <view>客服</view>
  892 + </view>
888 893  
889 894 <view bindtap="collectGoods" class="custom-service cart-ico new_split">
890 895 <image hidden="{{is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart.png"></image>
... ... @@ -1647,4 +1652,7 @@
1647 1652  
1648 1653 <!-- 制作一个圆球导航 -->
1649 1654 <nav_box></nav_box>
  1655 +
  1656 +<include src="../../../../components/com_servicer/com_servicer.wxml"></include>
  1657 +
1650 1658  
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
... ... @@ -3115,4 +3115,5 @@ button.custom-service::after{
3115 3115 .popup-content {
3116 3116 max-height: 600rpx;
3117 3117 overflow-y: auto;
3118   - }
3119 3118 \ No newline at end of file
  3119 + }
  3120 +
... ...
packageC/pages/luckyGo/luckyGo_members/luckyGo_members.js
... ... @@ -34,6 +34,7 @@ Page({
34 34 * 生命周期函数--监听页面显示
35 35 */
36 36 onShow: function () {
  37 + getApp().check_can_share();
37 38 if(app.globalData.userInfo) {
38 39 if(!this.data.isLogin) {
39 40 this.setData({
... ... @@ -92,7 +93,7 @@ Page({
92 93 /**
93 94 * 用户点击右上角分享
94 95 */
95   - onShareAppMessage: function () {
  96 + onShareAppMessage: function () { getApp().globalData.no_clear=1
96 97  
97 98 },
98 99  
... ...
packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js
... ... @@ -237,24 +237,7 @@ Page({
237 237 },
238 238 /*-----联系客户------*/
239 239 contactService: function() {
240   - e.getConfig(function(t) {
241   - if (t.store_tel == undefined) {
242   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
243   - isShowLoading: 1,
244   - data: {},
245   - success: function (rs) {
246   - getApp().globalData.config = rs.data.data;
247   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
248   - getApp().showWarning("商家未设置电话");
249   - return false;
250   - }
251   - e.confirmBox("请联系客服:" + rs.data.data.store_tel);
252   - }
253   - })
254   - } else {
255   - e.confirmBox("请联系客服:" + t.store_tel);
256   - }
257   - });
  240 + getApp().con_Service();
258 241 },
259 242  
260 243 //--------取消订单---------
... ... @@ -1074,13 +1057,7 @@ Page({
1074 1057 },
1075 1058  
1076 1059 con_weixin:function () {
1077   - var url=this.data.sys_switch.weapp_customertype_url;
1078   - var id=this.data.sys_switch.weapp_customertype_appid;
1079   - wx.openCustomerServiceChat({
1080   - extInfo: {url: url},
1081   - corpId: id,
1082   - success(res) {}
1083   - })
  1060 + getApp().con_wx(this);
1084 1061 },
1085 1062  
1086 1063 //跳转到商品
... ... @@ -1115,6 +1092,11 @@ Page({
1115 1092 // }
1116 1093 // })
1117 1094 },
  1095 +
  1096 +
  1097 + click_contact:function () {
  1098 + getApp().globalData.no_clear=1;
  1099 + }
1118 1100  
1119 1101  
1120 1102  
... ...
packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml
... ... @@ -61,7 +61,7 @@
61 61 <view bindtap="checkTeam" class="contact-us check-btn" wx:if="{{optionIsGoup}}">查看拼团详情</view>
62 62 <view>
63 63  
64   - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="contact-us goods-btn" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">联系客服</button>
  64 + <button wx:if="{{sys_switch.weapp_customertype==1}}" class="contact-us goods-btn" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">联系客服</button>
65 65  
66 66 <view wx:elif="{{sys_switch.weapp_customertype==2}}" bindtap="con_weixin" class="contact-us goods-btn">联系客服</view>
67 67 <view wx:else bindtap="contactService" class="contact-us goods-btn">联系客服</view>
... ...
packageC/pages/luckyGo/luckyGo_winners/luckyGo_winners.js
... ... @@ -38,6 +38,7 @@ Page({
38 38 * 生命周期函数--监听页面显示
39 39 */
40 40 onShow: function () {
  41 + getApp().check_can_share();
41 42 if(app.globalData.userInfo) {
42 43 if(!this.data.isLogin) {
43 44 this.setData({
... ... @@ -114,7 +115,7 @@ Page({
114 115 /**
115 116 * 用户点击右上角分享
116 117 */
117   - onShareAppMessage: function () {
  118 + onShareAppMessage: function () { getApp().globalData.no_clear=1
118 119  
119 120 },
120 121  
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -2601,35 +2601,12 @@ Page({
2601 2601  
2602 2602 //---------联系客服------------
2603 2603 contactService: function () {
2604   - getApp().getConfig(function (t) {
2605   - if (t.store_tel == undefined) {
2606   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
2607   - isShowLoading: 1,
2608   - data: {},
2609   - success: function (rs) {
2610   - getApp().globalData.config = rs.data.data;
2611   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
2612   - getApp().my_warnning("商家未设置电话", 0, th);
2613   - return false;
2614   - }
2615   - wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, })
2616   - }
2617   - })
2618   - } else {
2619   - wx.makePhoneCall({ phoneNumber: t.store_tel, })
2620   - }
2621   - });
  2604 + getApp().con_Service();
2622 2605 },
2623 2606  
2624 2607 //---------联系微信客服------------
2625 2608 con_weixin: function () {
2626   - var url = this.data.sys_switch.weapp_customertype_url;
2627   - var id = this.data.sys_switch.weapp_customertype_appid;
2628   - wx.openCustomerServiceChat({
2629   - extInfo: { url: url },
2630   - corpId: id,
2631   - success(res) { }
2632   - })
  2609 + getApp().con_wx(this);
2633 2610 }
2634 2611  
2635 2612  
... ...
packageC/pages/presell/goodsInfo/goodsInfo.js
... ... @@ -17,6 +17,8 @@ var more = function (e) {
17 17 var utils = require('../../../../utils/util.js');
18 18 var regeneratorRuntime = require('../../../../utils/runtime.js');
19 19  
  20 +let self = null;
  21 +
20 22 Page({
21 23 data: {
22 24 start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始)
... ... @@ -248,10 +250,13 @@ Page({
248 250  
249 251 share_hidden: false,
250 252 pre_arr: null,
  253 +
  254 + hiddenCS: true,
251 255 },
252 256  
253 257 //------初始化加载----------
254 258 onLoad: function (t) {
  259 + self = this;
255 260 var ee = this, that = ee, th = ee,
256 261 pre_id = t.pre_id,
257 262 gid = t.goods_id,
... ... @@ -588,6 +593,7 @@ Page({
588 593  
589 594 //---展示---
590 595 onShow: function () {
  596 + getApp().check_can_share();
591 597 var goods_list = null, th = this, that = this;
592 598  
593 599 //-- 如果是预览图片,页面不重新更新 --
... ... @@ -1430,25 +1436,40 @@ Page({
1430 1436  
1431 1437 //---------联系客服------------
1432 1438 contactService: function () {
1433   - s.getConfig(function (t) {
1434   - if (t.store_tel == undefined) {
1435   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
1436   - isShowLoading: 1,
1437   - data: {},
1438   - success: function (rs) {
1439   - getApp().globalData.config = rs.data.data;
1440   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
1441   - getApp().my_warnning("商家未设置电话", 0, th);
1442   - return false;
1443   - }
1444   - s.confirmBox("请联系客服:" + rs.data.data.store_tel);
1445   - }
1446   - })
1447   - } else {
1448   - s.confirmBox("请联系客服:" + t.store_tel);
1449   - }
1450   - });
  1439 + getApp().com_call(this);
1451 1440 },
  1441 +
  1442 + // 获取客服电话
  1443 + getTel() {
  1444 + return new Promise((resolve, reject) => {
  1445 + s.getConfig(function (t) {
  1446 + if (t.store_tel == undefined) {
  1447 + getApp().request.get("/api/weshop/store/get/" + os.stoid, {
  1448 + isShowLoading: 1,
  1449 + data: {},
  1450 + success: function (rs) {
  1451 + getApp().globalData.config = rs.data.data;
  1452 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
  1453 + getApp().my_warnning("商家未设置电话", 0, th);
  1454 + return false;
  1455 + }
  1456 + self.setData({
  1457 + store_tel: rs.data.data.store_tel,
  1458 + });
  1459 + // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
  1460 + }
  1461 + })
  1462 + } else {
  1463 + self.setData({
  1464 + store_tel: t.store_tel,
  1465 + });
  1466 + // s.confirmBox("请联系客服:" + t.store_tel);
  1467 + };
  1468 + resolve();
  1469 + });
  1470 + });
  1471 + },
  1472 +
1452 1473 //-------获取购物车数量----------
1453 1474 requestCardNum: function () {
1454 1475 var t = this;
... ... @@ -1488,11 +1509,8 @@ Page({
1488 1509 b[i] = this.data.iurl + e[i];
1489 1510 }
1490 1511 this.data.show_prew_img = 1;
  1512 + getApp().pre_img2(b,t)
1491 1513  
1492   - wx.previewImage({
1493   - current: b[t.currentTarget.dataset.id],
1494   - urls: b
1495   - });
1496 1514 },
1497 1515  
1498 1516 previewCommentImgs_w: function (t) {
... ... @@ -1502,21 +1520,16 @@ Page({
1502 1520 b[i] = this.data.iurl + e[i];
1503 1521 }
1504 1522 this.data.show_prew_img = 1;
1505   - wx.previewImage({
1506   - current: b[t.currentTarget.dataset.id],
1507   - urls: b
1508   - });
  1523 + getApp().pre_img2(b,t)
1509 1524 },
1510 1525  
1511 1526 previewGoodsCommentImgs: function (t) {
1512 1527 var e = this,
1513 1528 a = this.data.data.comment[t.currentTarget.dataset.cidx].img;
  1529 + getApp().globalData.no_clear=1;
1514 1530 a = a.map(function (t) {
1515 1531 return e.data.url + t;
1516   - }), wx.previewImage({
1517   - current: a[t.currentTarget.dataset.id],
1518   - urls: a
1519   - });
  1532 + }), getApp().pre_img2(a,t);
1520 1533 this.data.show_prew_img = 1;
1521 1534 },
1522 1535 closePromModal: function () {
... ... @@ -1531,7 +1544,7 @@ Page({
1531 1544 },
1532 1545  
1533 1546 //--点击分享事件---
1534   - onShareAppMessage: function (t) {
  1547 + onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
1535 1548  
1536 1549 var th = this;
1537 1550 var price = th.data.pre_arr.presell_price;
... ... @@ -3813,14 +3826,12 @@ Page({
3813 3826  
3814 3827 previewImage() {
3815 3828 this.data.show_prew_img = 1;
3816   - wx.previewImage({
3817   - //将图片预览出来
3818   - urls: [this.data.shareImgPath]
3819   - });
  3829 + getApp().pre_img(this.data.shareImgPath);
3820 3830 },
3821 3831  
3822 3832  
3823 3833 onShareTimeline() {
  3834 + getApp().globalData.no_clear=1;
3824 3835 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
3825 3836 if (!store_name)
3826 3837 store_name = getApp().globalData.setting.appName;
... ... @@ -3835,6 +3846,10 @@ Page({
3835 3846 },
3836 3847  
3837 3848 clickShare() {
  3849 + if(!getApp().globalData.user_id){
  3850 + getApp().goto("/pages/togoin/togoin");
  3851 + return false;
  3852 + }
3838 3853 this.setData({ share_hidden: true, });
3839 3854 },
3840 3855  
... ... @@ -4012,21 +4027,59 @@ Page({
4012 4027 },
4013 4028  
4014 4029 con_weixin:function () {
4015   - var url=this.data.sys_switch.weapp_customertype_url;
4016   - var id=this.data.sys_switch.weapp_customertype_appid;
4017   - wx.openCustomerServiceChat({
4018   - extInfo: {url: url},
4019   - corpId: id,
4020   - success(res) {}
4021   - })
  4030 + getApp().con_wx(this);
4022 4031 },
4023 4032  
4024 4033 // 预览海报
4025 4034 previewPoster() {
  4035 + getApp().globalData.no_clear=1;
4026 4036 wx.previewImage({
4027 4037 current: this.data.shareImgPath, // 当前显示图片的http链接
4028 4038 urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表
4029 4039 });
4030 4040 },
4031 4041  
  4042 +
  4043 + click_contact:function () {
  4044 + getApp().globalData.no_clear=1;
  4045 + },
  4046 +
  4047 + //打开客服操作菜单
  4048 + openCS() {
  4049 + // 判断会员状态
  4050 + let user_info = getApp().globalData.userInfo;
  4051 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
  4052 + wx.navigateTo({
  4053 + url: '/pages/togoin/togoin',
  4054 + })
  4055 + return false;
  4056 + };
  4057 + // csType/在线客服设置:
  4058 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  4059 + // 1小程序客服、
  4060 + // 2企业微信客服
  4061 + if(this.data.sys_switch) {
  4062 + let csType = this.data.sys_switch.weapp_customertype;
  4063 + if(csType == 0) {
  4064 + // 拨打电话号码
  4065 + this.contactService();
  4066 + } else {
  4067 + this.getTel()
  4068 + .then(() => {
  4069 + self.setData({
  4070 + hiddenCS: false,
  4071 + });
  4072 + });
  4073 + };
  4074 + };
  4075 +
  4076 + },
  4077 +
  4078 + //关闭客服操作菜单
  4079 + closeCS() {
  4080 + this.setData({
  4081 + hiddenCS: true,
  4082 + });
  4083 + },
  4084 +
4032 4085 });
... ...
packageC/pages/presell/goodsInfo/goodsInfo.wxml
... ... @@ -495,7 +495,7 @@
495 495 <!-- -----------------底部按钮------------------ -->
496 496 <view class="join-cart">
497 497 <!-- bindtap="contactService" -->
498   - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  498 + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
499 499 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
500 500 <view>客服</view>
501 501 </button>
... ... @@ -508,7 +508,13 @@
508 508 <view wx:else class="custom-service cart-ico new_split" bindtap="contactService">
509 509 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
510 510 <view>客服</view>
511   - </view>
  511 + </view> -->
  512 +
  513 + <view class="custom-service cart-ico new_split" bindtap="openCS">
  514 + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
  515 + <view>客服</view>
  516 + </view>
  517 +
512 518 <view bindtap="collectGoods" class="custom-service cart-ico new_split">
513 519 <image hidden="{{is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart.png"></image>
514 520 <image hidden="{{!is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart-h.png"></image>
... ... @@ -949,3 +955,6 @@
949 955 </view>
950 956 </view>
951 957  
  958 +<include src="../../../../components/com_servicer/com_servicer.wxml"/>
  959 +
  960 +
... ...
packageC/pages/presell/pregoodsInfo/goodsInfo.js
... ... @@ -590,6 +590,8 @@ Page({
590 590  
591 591 //---展示---
592 592 onShow: function () {
  593 +
  594 + getApp().check_can_share();
593 595 var goods_list = null, th = this, that = this;
594 596  
595 597 //-- 如果是预览图片,页面不重新更新 --
... ... @@ -1431,24 +1433,7 @@ Page({
1431 1433  
1432 1434 //---------联系客服------------
1433 1435 contactService: function () {
1434   - s.getConfig(function (t) {
1435   - if (t.store_tel == undefined) {
1436   - getApp().request.get("/api/weshop/store/get/" + os.stoid, {
1437   - isShowLoading: 1,
1438   - data: {},
1439   - success: function (rs) {
1440   - getApp().globalData.config = rs.data.data;
1441   - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
1442   - getApp().my_warnning("商家未设置电话", 0, th);
1443   - return false;
1444   - }
1445   - s.confirmBox("请联系客服:" + rs.data.data.store_tel);
1446   - }
1447   - })
1448   - } else {
1449   - s.confirmBox("请联系客服:" + t.store_tel);
1450   - }
1451   - });
  1436 + getApp().con_Service();
1452 1437 },
1453 1438 //-------获取购物车数量----------
1454 1439 requestCardNum: function () {
... ... @@ -1489,11 +1474,7 @@ Page({
1489 1474 b[i] = this.data.iurl + e[i];
1490 1475 }
1491 1476 this.data.show_prew_img = 1;
1492   -
1493   - wx.previewImage({
1494   - current: b[t.currentTarget.dataset.id],
1495   - urls: b
1496   - });
  1477 + getApp().pre_img2(b,t)
1497 1478 },
1498 1479  
1499 1480 previewCommentImgs_w: function (t) {
... ... @@ -1503,21 +1484,16 @@ Page({
1503 1484 b[i] = this.data.iurl + e[i];
1504 1485 }
1505 1486 this.data.show_prew_img = 1;
1506   - wx.previewImage({
1507   - current: b[t.currentTarget.dataset.id],
1508   - urls: b
1509   - });
  1487 + getApp().pre_img2(b,t)
1510 1488 },
1511 1489  
1512 1490 previewGoodsCommentImgs: function (t) {
1513 1491 var e = this,
1514 1492 a = this.data.data.comment[t.currentTarget.dataset.cidx].img;
  1493 + getApp().globalData.no_clear=1;
1515 1494 a = a.map(function (t) {
1516 1495 return e.data.url + t;
1517   - }), wx.previewImage({
1518   - current: a[t.currentTarget.dataset.id],
1519   - urls: a
1520   - });
  1496 + }), getApp().pre_img2(a,t);
1521 1497 this.data.show_prew_img = 1;
1522 1498 },
1523 1499 closePromModal: function () {
... ... @@ -1532,7 +1508,7 @@ Page({
1532 1508 },
1533 1509  
1534 1510 //--点击分享事件---
1535   - onShareAppMessage: function (t) {
  1511 + onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
1536 1512  
1537 1513 var th = this;
1538 1514 var price = th.data.pre_arr.presell_price;
... ... @@ -3814,14 +3790,12 @@ Page({
3814 3790  
3815 3791 previewImage() {
3816 3792 this.data.show_prew_img = 1;
3817   - wx.previewImage({
3818   - //将图片预览出来
3819   - urls: [this.data.shareImgPath]
3820   - });
  3793 + getApp().pre_img(this.data.shareImgPath);
3821 3794 },
3822 3795  
3823 3796  
3824 3797 onShareTimeline() {
  3798 + getApp().globalData.no_clear=1;
3825 3799 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
3826 3800 if (!store_name)
3827 3801 store_name = getApp().globalData.setting.appName;
... ... @@ -3836,7 +3810,11 @@ Page({
3836 3810 },
3837 3811  
3838 3812 clickShare() {
3839   - this.setData({ share_hidden: true, });
  3813 + if(!getApp().globalData.user_id){
  3814 + getApp().goto("/pages/togoin/togoin");
  3815 + return false;
  3816 + }
  3817 + this.setData({ share_hidden: true, });
3840 3818 },
3841 3819  
3842 3820 send() {
... ... @@ -4014,13 +3992,12 @@ Page({
4014 3992 },
4015 3993  
4016 3994 con_weixin:function () {
4017   - var url=this.data.sys_switch.weapp_customertype_url;
4018   - var id=this.data.sys_switch.weapp_customertype_appid;
4019   - wx.openCustomerServiceChat({
4020   - extInfo: {url: url},
4021   - corpId: id,
4022   - success(res) {}
4023   - })
  3995 + getApp().con_wx(this);
  3996 + },
  3997 +
  3998 +
  3999 + click_contact:function () {
  4000 + getApp().globalData.no_clear=1;
4024 4001 }
4025 4002  
4026 4003 });
... ...
packageC/pages/presell/pregoodsInfo/goodsInfo.wxml
... ... @@ -495,7 +495,7 @@
495 495 <!-- -----------------底部按钮------------------ -->
496 496 <view class="join-cart">
497 497 <!-- bindtap="contactService" -->
498   - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  498 + <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
499 499 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
500 500 <view>客服</view>
501 501 </button>
... ...
packageD/pages/AI-test-skin/history_record/history_record.js
... ... @@ -304,7 +304,7 @@ Page({
304 304 * 生命周期函数--监听页面显示
305 305 */
306 306 onShow: function () {
307   -
  307 + getApp().check_can_share();
308 308 },
309 309 go_result(e) {
310 310 let id = e.currentTarget.dataset.id;
... ... @@ -344,7 +344,7 @@ Page({
344 344 /**
345 345 * 用户点击右上角分享
346 346 */
347   - onShareAppMessage: function () {
  347 + onShareAppMessage: function () { getApp().globalData.no_clear=1
348 348  
349 349 }
350 350 })
351 351 \ No newline at end of file
... ...
packageD/pages/AI-test-skin/index/aiskin.js
... ... @@ -43,6 +43,7 @@ Page({
43 43 * 生命周期函数--监听页面显示
44 44 */
45 45 onShow: function () {
  46 + getApp().check_can_share();
46 47 this.getHistoryData();
47 48 },
48 49  
... ... @@ -101,7 +102,7 @@ Page({
101 102 /**
102 103 * 用户点击右上角分享
103 104 */
104   - onShareAppMessage: function () {
  105 + onShareAppMessage: function () { getApp().globalData.no_clear=1
105 106  
106 107 },
107 108  
... ...
packageD/pages/AI-test-skin/select_photo/select_photo.js
... ... @@ -52,6 +52,7 @@ Page({
52 52 //-- 重新从相册中选择图片 --
53 53 show_pai_pop: function () {
54 54 var th = this;
  55 + getApp().globalData.no_clear=1;
55 56 //选择和拍照一张图片
56 57 wx.chooseImage({
57 58 count: 1,
... ... @@ -70,6 +71,7 @@ Page({
70 71 //选择图片
71 72 takePhoto() {
72 73 var that = this;
  74 + getApp().globalData.no_clear=1;
73 75 wx.chooseImage({
74 76 count: 1,
75 77 sizeType: ['compressed'],
... ...
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
... ... @@ -36,6 +36,7 @@ Page({
36 36 * 生命周期函数--监听页面显示
37 37 */
38 38 onShow: function () {
  39 + getApp().check_can_share();
39 40 let th = this;
40 41 setTimeout(() => {
41 42 th.setData({
... ... @@ -68,13 +69,14 @@ Page({
68 69 /**
69 70 * 用户点击右上角分享
70 71 */
71   - onShareAppMessage: function () {
  72 + onShareAppMessage: function () { getApp().globalData.no_clear=1
72 73  
73 74 },
74 75  
75 76 //从相册中选择图片
76 77 show_pai_pop: function () {
77 78 let th = this;
  79 + getApp().globalData.no_clear=1;
78 80 //选择和拍照一张图片
79 81 wx.chooseImage({
80 82 count: 1,
... ... @@ -98,7 +100,8 @@ Page({
98 100 //选择图片
99 101 takePhoto() {
100 102 var that = this;
101   -
  103 + getApp().globalData.no_clear=1;
  104 + that.setData({selecting:1});
102 105 wx.chooseImage({
103 106 count: 1,
104 107 sizeType: ['compressed'],
... ... @@ -118,6 +121,7 @@ Page({
118 121  
119 122 },
120 123 fail(err) {
  124 + that.setData({selecting:0})
121 125 console.log(err);
122 126 }
123 127 })
... ... @@ -143,6 +147,7 @@ Page({
143 147 var that = this;
144 148 //size小于100kb 时 直接转码识别
145 149 if (size < 1024) {
  150 + that.setData({selecting:0})
146 151 getApp().globalData.skin_img_info = {
147 152 path:img,
148 153 size,
... ... @@ -153,12 +158,15 @@ Page({
153 158 return;
154 159 }
155 160  
  161 + wx.showLoading({
  162 + title:'处理中',
  163 + mask: true
  164 + });
156 165 //先获取图片 然后根据长宽 缩小 之后获取图片
157 166 wx.getImageInfo({
158 167 src: img,
159 168 success(res) {
160   - console.log(res.width)
161   - console.log(res.height)
  169 +
162 170 var ratio = size / 1024;
163 171 size1 = size1 / ratio;
164 172 var canvasWidth = res.width //图片原始长宽
... ... @@ -183,7 +191,7 @@ Page({
183 191 destHeight: canvasHeight,
184 192 fileType: 'jpg',
185 193 success: function (res) {
186   - console.log(res.tempFilePath)//最终图片路径
  194 + wx.hideLoading();
187 195 that.setData({
188 196 canvasImgUrl: res.tempFilePath
189 197 });
... ... @@ -195,9 +203,8 @@ Page({
195 203 app.goto(url);
196 204 },
197 205 fail: function (res) {
198   - console.log("缩放图片失败");
199   - console.log(res.errMsg)
200 206 wx.hideLoading();
  207 + that.setData({selecting:0})
201 208 wx.showToast({
202 209 title: '识别图片失败',
203 210 image: '../../utils/img/wrong.png',
... ... @@ -211,9 +218,8 @@ Page({
211 218 }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty
212 219 },
213 220 fail: function (res) {
214   - console.log("获取图片失败");
215   - console.log(res.errMsg)
216 221 wx.hideLoading();
  222 + that.setData({selecting:0})
217 223 wx.showToast({
218 224 title: '识别图片失败',
219 225 image: '../../utils/img/wrong.png',
... ...
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml
... ... @@ -55,7 +55,7 @@
55 55  
56 56 <view style="height: 300rpx;background-color: #e7f5fb;">
57 57 <view class="btn_fixed">
58   - <view class="btn" bindtap="takePhoto">准备闭眼拍摄</view>
  58 + <botton disabled="{{selecting}}" class="btn" bindtap="takePhoto">准备闭眼拍摄</botton>
59 59 <view class="notice" style="display:flex;justify-content:center;align-items: center;">
60 60 <text class="iconfont icon-info" style="margin-right: 10rpx;font-size: 26rpx"></text>
61 61 <text>如无闭眼,将导致图片分析失败</text>
... ...
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss
... ... @@ -103,6 +103,7 @@ page {
103 103 text-align: center;
104 104 border-radius: 50rpx;
105 105 color: #fff;
  106 + display: block;
106 107 }
107 108  
108 109 .btn_fixed {
... ...
packageD/pages/AI-test-skin/success_result/goods.wxml
... ... @@ -9,9 +9,9 @@
9 9 <!-- 显示正确的商品价格 -->
10 10 <view style="display: flex;justify-content: space-between;">
11 11 <block wx:if="{{(item.prom_price>0 || item.prom_integral>0) && item.prom_id>0 && item.prom_type!=7 && item.prom_type!=10}}">
12   - <text wx:if="{{item.prom_integral}}"><text class="fs35" style="font-weight: bold;">{{item.prom_integral}}</text>积分</text>
13   - <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
14 12 <text wx:if="{{item.prom_price}}" class="bold">¥{{item.shop_price}}</text>
  13 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  14 +
15 15 </block>
16 16 <block wx:else>
17 17 <block wx:if="{{s_filter.is_has_rank(rank_switch,item)}}">
... ... @@ -36,4 +36,5 @@
36 36  
37 37 <view class="mm"><text class="iconfont icon-gouwuche"></text></view>
38 38 </view>
  39 + <view wx:if="{{item.prom_integral}}"><text style="font-weight: bold;">{{item.prom_integral}}</text>积分</view>
39 40 </view>
40 41 \ No newline at end of file
... ...
packageD/pages/AI-test-skin/success_result/success_result.js
... ... @@ -83,7 +83,29 @@ Page({
83 83 this.init();
84 84 //var face_result=getApp().globalData.face_result;
85 85 //var face_data=face_result.face_list[0];
86   - this.data.id = options.id;
  86 + var id=options.id;
  87 + var first_leader = options.first_leader;
  88 +
  89 + if (id == undefined || id == null || id == "") {
  90 + var gid_str = decodeURIComponent(options.scene);
  91 + gid_str = gid_str.split("_");
  92 + id=gid_str[0];
  93 + if (gid_str.length > 1) {
  94 + first_leader = gid_str[1];
  95 + }
  96 + }
  97 +
  98 + this.data.id=id;
  99 + if (first_leader) {
  100 + console.log("log---".first_leader);
  101 + getApp().globalData.first_leader = first_leader;
  102 + //调用接口判断是不是会员
  103 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + setting.stoid + "/" + first_leader, {}).then(res => {
  104 + if (res.data.code == 0) {
  105 + getApp().globalData.guide_id = res.data.data.id;
  106 + }
  107 + })
  108 + }
87 109  
88 110 //用异步的获取比较准一点
89 111 wx.getSystemInfo({
... ... @@ -280,6 +302,7 @@ Page({
280 302 //-- 获取一下分享要用的图片 --
281 303 th.set_share_img();
282 304 acne.get_goods(th, setting.stoid);
  305 +
283 306 // let { heightRecord, tab } = th.data;
284 307 // tab.forEach(item => {
285 308 // console.log(2);
... ... @@ -457,7 +480,9 @@ Page({
457 480 /**
458 481 * 生命周期函数--监听页面显示
459 482 */
460   - onShow: function () { },
  483 + onShow: function () {
  484 + getApp().check_can_share();
  485 + },
461 486  
462 487 clickTab(e) {
463 488 let { index, tab_id } = e.currentTarget.dataset;
... ... @@ -590,7 +615,15 @@ Page({
590 615 * 用户点击右上角分享
591 616 */
592 617 onShareAppMessage: function () {
  618 + getApp().globalData.no_clear=1;
  619 + var url="packageD/pages/AI-test-skin/success_result/success_result?id="+this.data.id+"&first_leader="+getApp().globalData.user_id;
593 620  
  621 + var ob = {
  622 + title: "测肤报告",
  623 + path: url,
  624 + };
  625 +
  626 + return ob;
594 627 },
595 628  
596 629 //商品页面跳转
... ... @@ -748,8 +781,8 @@ Page({
748 781 }
749 782 ///二微码
750 783 var path3 = setting.url + "/api/wx/open/app/user/getWeAppEwm/" +
751   - setting.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
752   -
  784 + setting.stoid + "?sceneValue=" + scene + "&pageValue=packageD/pages/AI-test-skin/success_result/success_result";
  785 +
753 786 // 读取文件成功则OK--
754 787 wx.getImageInfo({
755 788 src: path3,
... ... @@ -763,21 +796,21 @@ Page({
763 796 context.fillStyle = '#ebf6f8';
764 797 // 灰色实心矩形
765 798 // 1. 语法: x坐标, y坐标, 宽度, 高度
766   - context.fillRect(0, 0, 750 * rpx, 1338 * rpx);
  799 + context.fillRect(0, 0, 750 * rpx, 1320 * rpx);
767 800  
768 801 context.setFontSize(20 * rpx)
769 802 context.setFillStyle("#00d8e9")
770   - context.fillText("官方检测认证", 28 * b * rpx, 80 * b * rpx);
  803 + context.fillText("官方检测认证", 32 * b * rpx, 80 * b * rpx);
771 804  
772 805 //两个底部颜色
773 806 context.fillStyle = '#a7ecf5';
774   - context.fillRect(28 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx);
775   - context.fillRect(28 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx);
  807 + context.fillRect(32 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx);
  808 + context.fillRect(32 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx);
776 809  
777 810 context.setFontSize(42 * b * rpx)
778 811 context.setFillStyle("#070609")
779   - context.fillText("我的肌底强韧", 30 * b * rpx, 140 * b * rpx);
780   - context.fillText("肌肤鲜活润泽", 30 * b * rpx, 196 * b * rpx);
  812 + context.fillText("我的肌底强韧", 32 * b * rpx, 140 * b * rpx);
  813 + context.fillText("肌肤鲜活润泽", 32 * b * rpx, 196 * b * rpx);
781 814  
782 815 //先画一个圆形
783 816 th.circle(context, 110 * b * rpx, 280 * b * rpx, 140 * b * rpx, "#e7f3f8");
... ... @@ -786,35 +819,35 @@ Page({
786 819 context.drawImage(th.data.share_head, 132 * b * rpx, 310 * b * rpx, 230 * b * rpx, 230 * b * rpx);
787 820  
788 821 //左右俩个框并填充文字
789   - th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
790   - th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
791   - context.setFontSize(20 * b * rpx)
  822 + th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 120 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
  823 + th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 120 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
  824 + context.setFontSize(18 * b * rpx)
792 825 context.setFillStyle("black")
793   - context.fillText("黑眼圈 重度", 50 * b * rpx, 368 * b * rpx);
794   - context.fillText("毛孔 " + th.data.pore_num, 336 * b * rpx, 368 * b * rpx);
  826 + context.fillText("黑眼圈 重度", 50 * b * rpx, 363 * b * rpx);
  827 + context.fillText("毛孔 " + th.data.pore_num, 340 * b * rpx, 363 * b * rpx);
795 828  
796 829 //左右俩个框并填充文字
797   - th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
798   - th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
  830 + th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
  831 + th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
799 832 context.setFillStyle("black")
800   - context.fillText("黑头 " + th.data.blackhead_num, 52 * b * rpx, 440 * b * rpx);
801   - context.fillText("色斑 " + th.data.speckle_num, 354 * b * rpx, 440 * b * rpx);
  833 + context.fillText("黑头 " + th.data.blackhead_num, 60 * b * rpx, 434 * b * rpx);
  834 + context.fillText("色斑 " + th.data.speckle_num, 362 * b * rpx, 434 * b * rpx);
802 835  
803 836 //左右俩个框并填充文字
804   - th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
805   - th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context);
  837 + th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
  838 + th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context);
806 839 context.setFillStyle("black")
807   - context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 510 * b * rpx);
808   - context.fillText("痤疮 " + th.data.acne_num, 344 * b * rpx, 510 * b * rpx);
  840 + context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 506 * b * rpx);
  841 + context.fillText("痤疮 " + th.data.acne_num, 350 * b * rpx, 506 * b * rpx);
809 842  
810 843 //底部的绘制
811 844 th.darwRoundRect(38 * b * rpx, 650 * b * rpx, 430 * b * rpx, 160 * b * rpx, 10 * b * rpx, context);
812 845 //绘制二维码
813 846 context.drawImage(vpath, 60 * b * rpx, 672 * b * rpx, 120 * b * rpx, 120 * b * rpx);
814 847 context.setFillStyle("black")
815   - context.setFontSize(32 * b * rpx)
  848 + context.setFontSize(27 * b * rpx)
816 849 context.fillText("美肤管家AI测肤", 200 * b * rpx, 726 * b * rpx);
817   - context.setFontSize(22 * b * rpx)
  850 + context.setFontSize(19 * b * rpx)
818 851 context.fillText("科学了解皮肤的真实状态", 200 * b * rpx, 766 * b * rpx);
819 852  
820 853 //把画板内容绘制成图片,并回调 画板图片路径
... ... @@ -824,7 +857,7 @@ Page({
824 857 x: 0,
825 858 y: 0,
826 859 width: 750,
827   - height: 1338,
  860 + height: 1320,
828 861 destWidth: 1.4 * 750 * 750 / th.data.screenWidth,
829 862 destHeight: 1.4 * 750 * 750 / th.data.screenWidth,
830 863 canvasId: 'share',
... ...
packageD/pages/AI-test-skin/success_result/success_result.wxml
... ... @@ -378,12 +378,12 @@
378 378  
379 379  
380 380 <!-- 二维码显示页面 -->
381   -<canvas canvas-id='share' style='width:750rpx;height:1338rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas>
  381 +<canvas canvas-id='share' style='width:750rpx;height:1320rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas>
382 382 <!-- 展示分享图 -->
383 383 <view id="share_show" wx:if="{{share_show}}">
384 384 <view class="cover-layer" bindtap="close_share" style="z-index: 77777"></view>
385 385 <view class="share_content">
386   - <view class="sh_close" bindtap="close_share"><text class="iconfont icon-guan"></text></view>
  386 + <view class="sh_close" bindtap="close_share"><text class="iconfont icon-guan" style="font-size: 22rpx;"></text></view>
387 387 <image src="{{shareImgPath}}" style="width: 100%" mode="widthFix"></image>
388 388 <view class="share_save_btn" bindtap="savePic">保存到相册</view>
389 389 </view>
... ... @@ -412,7 +412,7 @@
412 412 </scroll-view>
413 413 </view>
414 414 <view class="close_icon" bindtap="close_yiwen">
415   - <text class="iconfont icon-guan"></text>
  415 + <text class="iconfont icon-guan" ></text>
416 416 </view>
417 417 </view>
418 418 <!-- 提示 -->
... ...
packageD/pages/AI-test-skin/success_result/success_result.wxss
... ... @@ -384,13 +384,15 @@ page {
384 384 font-size: 28rpx;
385 385 }
386 386  
387   -.analyse_classify_foot .product_item {
388   - display: flex;
  387 +.analyse_classify_foot .product_item:nth-child(1) {
389 388 margin-right: 30rpx;
  389 +}
  390 +.analyse_classify_foot .product_item{
  391 + display: flex;
390 392 flex-direction: column;
391 393 border-radius: 30rpx;
392 394 width: 40%;
393   - padding: 5%;
  395 + padding: 5% ;
394 396 background-color: #fff;
395 397 }
396 398  
... ... @@ -592,8 +594,7 @@ page {
592 594 .xc-coupon-frame {
593 595 width: 100%;
594 596 max-height: 560rpx;
595   - overflow: auto;
596   -
  597 + /* overflow: auto; */
597 598 }
598 599  
599 600 .xc-coupon-frame .rel:not(:first-child) {
... ... @@ -727,7 +728,7 @@ page {
727 728 z-index: 999999;
728 729 top: 50%;
729 730 left: 50%;
730   - width: 70%;
  731 + width: 75%;
731 732 transform: translate(-50%, -50%);
732 733 }
733 734  
... ... @@ -742,10 +743,10 @@ page {
742 743  
743 744 .sh_close {
744 745 position: absolute;
745   - right: 20rpx;
746   - top: 20rpx;
747   - width: 70rpx;
748   - height: 70rpx;
  746 + right: 34rpx;
  747 + top: 36rpx;
  748 + width: 65rpx;
  749 + height: 65rpx;
749 750 display: flex;
750 751 justify-content: center;
751 752 align-items: center;
... ...
pages/activity/pind_list/pind_list.js
... ... @@ -65,6 +65,7 @@ Page({
65 65 },
66 66  
67 67 onShow: function (t) {
  68 + getApp().check_can_share();
68 69 this.data.is_timer = 1;
69 70 this.data.currentPage = 1;
70 71 this.data.ismore = 1;
... ... @@ -195,6 +196,7 @@ Page({
195 196  
196 197 //---------分享配置--------
197 198 onShareAppMessage: function (e) {
  199 + getApp().globalData.no_clear=1;
198 200 var curPage = this;
199 201 var pagePath = curPage.route; //当前页面url
200 202 if (pagePath.indexOf('/') != 0) {
... ... @@ -248,6 +250,7 @@ Page({
248 250 },
249 251  
250 252 onShareTimeline() {
  253 + getApp().globalData.no_clear=1;
251 254 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
252 255 if (!store_name)
253 256 store_name = getApp().globalData.setting.appName;
... ...
pages/activity/seckill_list/seckill_list.js
... ... @@ -73,6 +73,7 @@ Page({
73 73  
74 74  
75 75 onShow: function (t) {
  76 + getApp().check_can_share();
76 77 this.data.is_timer = 1;
77 78 this.data.currentPage = 1;
78 79 var th = this;
... ... @@ -233,6 +234,7 @@ Page({
233 234  
234 235 //---------分享配置--------
235 236 onShareAppMessage: function (e) {
  237 + getApp().globalData.no_clear=1;
236 238 var curPage = this;
237 239 var pagePath = curPage.route; //当前页面url
238 240 if (pagePath.indexOf('/') != 0) {
... ... @@ -266,6 +268,7 @@ Page({
266 268 },
267 269  
268 270 onShareTimeline() {
  271 + getApp().globalData.no_clear=1;
269 272 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
270 273 if (!store_name)
271 274 store_name = getApp().globalData.setting.appName;
... ...
pages/cart/cart/cart.js
... ... @@ -69,6 +69,7 @@ Page({
69 69 //每次显示都清空
70 70 this.data.in_zhact_gdmap = {};
71 71  
  72 +
72 73 if (typeof this.getTabBar === 'function' && this.getTabBar()) {
73 74 var index = getApp().getPageIndex(this);
74 75 this.getTabBar().setData({
... ... @@ -1078,10 +1079,23 @@ Page({
1078 1079 if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
1079 1080 var s = {
1080 1081 goods_num: a,
1081   - goods_id: e.goods_id,
  1082 + goods_id: e.service_id,
1082 1083 id: e.id,
1083   - store_id: oo.stoid
  1084 + store_id: oo.stoid,
  1085 + is_pd_normal: e.is_pd_normal
1084 1086 };
  1087 + if(e.prom_type) {
  1088 + s.prom_type = e.prom_type;
  1089 + };
  1090 + if(e.prom_id) {
  1091 + s.prom_id = e.prom_id;
  1092 + };
  1093 + if(e.is_pd_normal) {
  1094 + s.is_pd_normal = e.is_pd_normal;
  1095 + };
  1096 + if(e.service_id) {
  1097 + s.card_id = e.service_id;
  1098 + };
1085 1099 th.postCardList_ser(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
1086 1100 }
1087 1101 },
... ... @@ -1089,7 +1103,7 @@ Page({
1089 1103 addNum_ser: function (t) {
1090 1104 if (!this.data.is_load) return false;
1091 1105 if (this.data.up_dating == 1) return false;
1092   - this.data.up_dating = 1;
  1106 + // this.data.up_dating = 1;
1093 1107  
1094 1108 var a = t.currentTarget.dataset.item;
1095 1109 var b = t.currentTarget.dataset.pitems;
... ... @@ -1098,18 +1112,32 @@ Page({
1098 1112 var e = {
1099 1113 goods_num: a.goods_num + 1,
1100 1114 id: a.id,
1101   - goods_id: a.goods_id,
1102   - store_id: oo.stoid
  1115 + goods_id: a.service_id,
  1116 + store_id: oo.stoid,
  1117 + is_pd_normal: a.is_pd_normal
1103 1118 };
  1119 + if(a.prom_type) {
  1120 + e.prom_type = a.prom_type;
  1121 + };
  1122 + if(a.prom_id) {
  1123 + e.prom_id = a.prom_id;
  1124 + };
  1125 + if(a.is_pd_normal) {
  1126 + e.is_pd_normal = a.is_pd_normal;
  1127 + };
  1128 + if(a.service_id) {
  1129 + e.card_id = a.service_id;
  1130 + };
1104 1131 this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
1105 1132  
1106 1133 },
1107 1134 //-------------减数量---------------------
1108 1135 subNum_ser: function (t) {
  1136 +
1109 1137 if (!this.data.is_load) return false;
1110 1138 if (this.data.up_dating == 1) return false;
1111   - this.data.up_dating = 1;
1112   -
  1139 + // this.data.up_dating = 1;
  1140 +
1113 1141 var a = t.currentTarget.dataset.item;
1114 1142 var b = t.currentTarget.dataset.pitems;
1115 1143 a = this.data.service_data[b].goods[a];
... ... @@ -1124,9 +1152,11 @@ Page({
1124 1152 var e = {
1125 1153 goods_num: a.goods_num - 1,
1126 1154 id: a.id,
1127   - goods_id: a.goods_id,
1128   - store_id: oo.stoid
  1155 + goods_id: a.service_id,
  1156 + store_id: oo.stoid,
  1157 + is_pd_normal: a.is_pd_normal
1129 1158 };
  1159 +
1130 1160 this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
1131 1161 }
1132 1162 },
... ... @@ -1297,8 +1327,9 @@ Page({
1297 1327 for (var j = 0; j < item.length; j++) {
1298 1328 var txt = "service_data[" + i + "].goods[" + j + "].selected"
1299 1329 e.setData({
1300   - [txt]: !e.data.checkAllToggle,
  1330 + [txt]: !e.data.checkAllToggle ? 1 : 0,
1301 1331 })
  1332 +
1302 1333 if (!e.data.checkAllToggle) {
1303 1334 tfeel += item[j].goods_num * item[j].money;
1304 1335 t_num += item[j].goods_num;
... ... @@ -1509,7 +1540,8 @@ Page({
1509 1540 var e = this,
1510 1541 item = t.currentTarget.dataset.item,
1511 1542 pitems = t.currentTarget.dataset.pitems;
1512   - a = this.data.service_data[pitems].goods[item];
  1543 + a = this.data.service_data[pitems].goods[item]; // 选中的商品
  1544 +
1513 1545 var isok = 1,
1514 1546 fir = 0;
1515 1547 var iarr = e.data.service_data[pitems].goods;
... ... @@ -1541,6 +1573,7 @@ Page({
1541 1573 e.setData({
1542 1574 [txt]: Number(!a.selected),
1543 1575 });
  1576 +
1544 1577 this.doCheckAll();
1545 1578 },
1546 1579  
... ... @@ -1987,17 +2020,241 @@ Page({
1987 2020 },
1988 2021  
1989 2022 //----------------------更新购物数量,加减,调用接口---------------------
1990   - postCardList_ser: function (t, item, pitem) {
  2023 + postCardList_ser: async function (t, item, pitem) {
1991 2024 var e = this,
1992 2025 th = e;
1993 2026 var user_id = getApp().globalData.user_id;
1994 2027 var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
  2028 +
1995 2029 e.setData({
1996 2030 [txt]: t.goods_num
1997 2031 });
1998   - e.doCheckAll();
1999   - e.update_cart_ser(t, pitem, item);
  2032 +
  2033 + // 1.秒杀活动
  2034 + // 2.活动开始
  2035 + if(t.prom_type == 1 && t.is_pd_normal == 0) {
  2036 + var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
  2037 + var redis_num = 0;
  2038 +
  2039 + // 获取其他门店,同类商品的数量
  2040 + var cartGoodsNum = 0;
  2041 + await getApp().request.promiseGet("/api/weshop/cartService/page?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&service_id="+t.goods_id,
  2042 + { }).then(res => {
  2043 + if (res.data.data.pageData.length > 0) {
  2044 + const tmpObj = res.data.data.pageData;
  2045 + tmpObj.forEach(v => {
  2046 + if (t.id != v.id) {
  2047 + cartGoodsNum += parseInt(v.goods_num);
  2048 + }
  2049 +
  2050 + });
  2051 + }
  2052 + });
  2053 + // 当前商品数量包括其他门店
  2054 + var totalNum = 0
  2055 + if (cartGoodsNum > 0) {
  2056 + totalNum = t.goods_num + cartGoodsNum;
  2057 + } else {
  2058 + totalNum = t.goods_num;
  2059 + }
  2060 +
  2061 + //获取当前商品活动库存
  2062 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  2063 + t.store_id + "/" + t.prom_type + "/" + t.prom_id, {
  2064 + 1: 1
  2065 + }).then(res => {
  2066 + redis_num = res.data.data;
  2067 + });
  2068 +
  2069 + // 检测库存
  2070 + if(redis_num == 0) {
  2071 + wx.showToast({
  2072 + title: '超出活动库存',
  2073 + icon: 'none',
  2074 + });
  2075 + th.setData({[txt]: redis_num});
  2076 + t.goods_num = redis_num;
  2077 + await th.doCheckAll();
  2078 + await th.update_cart_ser(t, pitem, item);
  2079 + return false;
  2080 + };
  2081 +
  2082 + // 限购数量
  2083 + var buylimit = 0
  2084 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, {
  2085 +
  2086 + }).then(res => {
  2087 + if(res.data.code == 0) {
  2088 + th.data.sele_g = res.data.data;
  2089 + th.data.sele_g.viplimited = res.data.data.buy_limit;
  2090 + buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit;
  2091 + };
  2092 + });
  2093 +
  2094 + //用户已经成功付款购买的数量
  2095 + var gd_buy_num = 0;
  2096 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.card_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, {
  2097 + }).then(tt => {
  2098 + if (tt.data.code == 0) {
  2099 + gd_buy_num = !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum;
  2100 + th.setData({
  2101 + promcardbuynum: !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum,
  2102 + cardbuynum: tt.data.data.cardbuynum,
  2103 + });
  2104 + };
  2105 + });
  2106 +
  2107 + // 剩余购买数
  2108 + let num = buylimit - gd_buy_num;
  2109 +
  2110 + if(totalNum > redis_num) {
  2111 + wx.showToast({
  2112 + title: '超出活动库存',
  2113 + icon: 'none',
  2114 + });
  2115 + // 开启限购
  2116 + if (buylimit > 0) {
  2117 + if (num > redis_num) {
  2118 + th.setData({[txt]: redis_num-cartGoodsNum});
  2119 + t.goods_num = redis_num-cartGoodsNum;
  2120 + await th.doCheckAll();
  2121 + await th.update_cart_ser(t, pitem, item);
  2122 + } else {
  2123 + th.setData({[txt]: num - cartGoodsNum});
  2124 + t.goods_num = num - cartGoodsNum;
  2125 + await th.doCheckAll();
  2126 + await th.update_cart_ser(t, pitem, item);
  2127 + }
  2128 + } else {
  2129 + th.setData({[txt]: redis_num - cartGoodsNum});
  2130 + t.goods_num = redis_num - cartGoodsNum;
  2131 + await th.doCheckAll();
  2132 + await th.update_cart_ser(t, pitem, item);
  2133 + }
  2134 +
  2135 + return false;
  2136 + };
  2137 +
  2138 +
  2139 + //--秒杀:判断商品是否超出活动限购--
  2140 + if (buylimit > 0) {
  2141 +
  2142 + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量”
  2143 + if(totalNum > num) {
  2144 + // 计算还可以购买的数量:库存量 - 已购数
  2145 + wx.showToast({
  2146 + title: '超出活动限购',
  2147 + icon: 'none',
  2148 + });
  2149 + if (num <= 0) num = 1;
  2150 + th.setData({[txt]: num - cartGoodsNum});
  2151 + t.goods_num = num - cartGoodsNum;
  2152 + await th.doCheckAll();
  2153 + await th.update_cart_ser(t, pitem, item);
  2154 + return false;
  2155 + };
  2156 +
  2157 + }
  2158 +
  2159 +
  2160 + }
  2161 +
  2162 +
  2163 + await e.doCheckAll();
  2164 + await e.update_cart_ser(t, pitem, item);
  2165 +
  2166 +
2000 2167 },
  2168 +
  2169 +
  2170 + // 检查购物车数量
  2171 + async checkCartNum(t, item, pitem) {
  2172 + var th = this;
  2173 + if(t.is_pd_normal) return false;
  2174 + if (t.prom_type == 1) {
  2175 + var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
  2176 + var redis_num = 0;
  2177 +
  2178 + //------判断活动是否抢光-----
  2179 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  2180 + t.store_id + "/" + t.prom_type + "/" + t.prom_id, {
  2181 + 1: 1
  2182 + }).then(res => {
  2183 + redis_num = res.data.data;
  2184 + });
  2185 +
  2186 + // 检测库存
  2187 + if(redis_num == 0) {
  2188 + wx.showToast({
  2189 + title: '超出活动库存',
  2190 + icon: 'none',
  2191 + });
  2192 + th.setData({[txt]: redis_num});
  2193 + return false;
  2194 + };
  2195 +
  2196 + if(t.goods_num > redis_num) {
  2197 + wx.showToast({
  2198 + title: '超出活动库存',
  2199 + icon: 'none',
  2200 + });
  2201 + th.setData({[txt]: redis_num});
  2202 + return false;
  2203 + };
  2204 +
  2205 + // 个人限购
  2206 + //----获取用户活动购买数----
  2207 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, {
  2208 + }).then(tt => {
  2209 + if (tt.data.code == 0) {
  2210 + th.setData({
  2211 + promcardbuynum: tt.data.data.promcardbuynum,
  2212 + cardbuynum: tt.data.data.cardbuynum,
  2213 + });
  2214 + };
  2215 + });
  2216 +
  2217 +
  2218 +
  2219 + var buylimit = 0
  2220 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, {
  2221 +
  2222 + }).then(res => {
  2223 + if(res.data.code == 0) {
  2224 +
  2225 + th.data.sele_g = res.data.data;
  2226 + th.data.sele_g.viplimited = res.data.data.buy_limit;
  2227 + buylimit = res.data.data.buy_limit;
  2228 + };
  2229 + });
  2230 +
  2231 +
  2232 + //--秒杀:判断商品是否超出活动限购--
  2233 + if (buylimit > 0) {
  2234 +
  2235 + var gd_buy_num = th.data.promcardbuynum;
  2236 +
  2237 + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量”
  2238 + if(t.goods_num + gd_buy_num > buylimit) {
  2239 + // 计算还可以购买的数量:库存量 - 已购数
  2240 + wx.showToast({
  2241 + title: '超出活动限购',
  2242 + icon: 'none',
  2243 + });
  2244 + th.setData({[txt]: buylimit});
  2245 +
  2246 + };
  2247 +
  2248 + }
  2249 +
  2250 +
  2251 + th.doCheckAll();
  2252 + th.update_cart_ser(t, pitem, item);
  2253 +
  2254 +
  2255 +
  2256 + };
  2257 + },
2001 2258  
2002 2259  
2003 2260  
... ... @@ -2117,6 +2374,7 @@ Page({
2117 2374 //--更新购物车---
2118 2375 update_cart_ser: function (t, pitem, item) {
2119 2376 var e = this;
  2377 +
2120 2378 getApp().request.put("/api/weshop/cartService/update", {
2121 2379 data: t,
2122 2380 success: async function (ee) {
... ... @@ -2417,19 +2675,20 @@ Page({
2417 2675 }
2418 2676 });
2419 2677 } else {
  2678 +
2420 2679 //-- 开始服务卡的购物车购买 --
2421 2680 for (var i = 0; i < this.data.service_data.length; i++) {
2422 2681 var i_arr = this.data.service_data[i].goods;
  2682 + console.log(i_arr)
  2683 +
2423 2684 for (var j = 0; j < i_arr.length; j++) {
2424   - if (i_arr[j].selected) {
2425   - await rq.promisePut("/api/weshop/cartService/update", {
2426   - data: {
2427   - id: i_arr[j].id,
2428   - selected: 1,
2429   - store_id: oo.stoid
2430   - }
2431   - });
2432   - }
  2685 + await rq.promisePut("/api/weshop/cartService/update", {
  2686 + data: {
  2687 + id: i_arr[j].id,
  2688 + selected: i_arr[j].selected,
  2689 + store_id: oo.stoid
  2690 + }
  2691 + });
2433 2692 }
2434 2693 }
2435 2694 wx.hideLoading();
... ... @@ -2876,6 +3135,14 @@ Page({
2876 3135 getApp().goto(good_url);
2877 3136 }
2878 3137 })
2879   - }
  3138 + },
  3139 +
  3140 +
  3141 +
  3142 +
  3143 +
  3144 +
  3145 +
  3146 +
2880 3147  
2881 3148 });
2882 3149 \ No newline at end of file
... ...