Commit cd5a0b724b1d44b8e657ad4e843e52eb88ee70c9

Authored by yvan.ni
1 parent ede1b2e6

助力的指定门店优化

pages/giftpack/public/buy_com.js
... ... @@ -218,6 +218,11 @@ module.exports = {
218 218 if(th.data.submit) return false;
219 219 th.setData({submit:1})
220 220  
  221 + if(th.pp_bacK_func){
  222 + th.pp_bacK_func();
  223 + return false;
  224 + }
  225 +
221 226 var id=th.data.sele_g.lbId;
222 227 var that=th;
223 228 var json = {
... ...
pages/giftpack/public/buy_com.wxml
... ... @@ -155,7 +155,7 @@
155 155 <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl+(sele_g.cover_img?sele_g.cover_img:sele_g.lbUrl)}}" binderror="pop_err_img" data-errorimg=""></image>
156 156 <view class="spec-goods-info">
157 157 <view class="spec-goods-name ellipsis-2">{{sele_g.giftTitle}}</view>
158   - <view class="flex ai_end xc-val-money">
  158 + <view class="flex ai_end xc-val-money" wx:if="{{buyType<4}}">
159 159 <view class="spec-goods-price">
160 160 <block wx:if="{{sele_g.payMoney>0}}">
161 161 <text>{{"¥"+sele_g.payMoney}}</text>
... ... @@ -174,14 +174,15 @@
174 174 </view>
175 175  
176 176  
177   - <view class="flex">
  177 + <view class="flex" wx:if="{{buyType<4}}">
178 178 <view class="spec-goods-stock" >已售:{{sele_g.giftQty}}</view>
179 179 <view class="spec-goods-stock">可售:{{sele_g.lbnum-sele_g.giftQty+(sele_g.virtualsales?sele_g.virtualsales:0)}}</view>
180 180 </view>
181   -
182 181 </view>
  182 +
  183 + <view style="clear:both;" ></view>
183 184 <!-- 选择门店模块 -->
184   - <view class="flex-space-between address ai_end xc-width ">
  185 + <view class="flex-space-between address ai_end xc-width {{buyType>3?'mgt20':''}}">
185 186 <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
186 187 <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text>
187 188 <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
... ... @@ -249,6 +250,7 @@
249 250 <text wx:if="{{buyType==1}}">立即兑换</text>
250 251 <text wx:if="{{buyType==2}}">立即购买</text>
251 252 <text wx:if="{{buyType==3}}">立即领取</text>
  253 + <text wx:if="{{buyType==4}}">确认选择</text>
252 254 </button>
253 255 </block>
254 256  
... ...
pages/user/assistance/task_assistance.js
... ... @@ -9,6 +9,9 @@ var e = getApp(),
9 9 app_d = e.globalData;
10 10 var invalidSetTime = null
11 11 var regeneratorRuntime = require('../../../utils/runtime.js');
  12 +var com = require("../../giftpack/public/buy_com.js");
  13 +
  14 +
12 15 Page({
13 16 /**
14 17 * 页面的初始数据
... ... @@ -85,7 +88,46 @@ Page({
85 88 font_color:'',
86 89  
87 90 //-- 屏幕实际的高度 --
88   - r_heght:''
  91 + r_heght:'',
  92 +
  93 +
  94 + //门店相关
  95 + ismend: 0,
  96 + is_sec_mend: 0,
  97 + sto_sele_name: "", //选中的门店名称
  98 + sto_sele_id: "", //选中的门店id
  99 + sto_sele_distr: "", //选择的门店的配送方式
  100 + is_show_sto_cat: 1, //是否显示门店分类
  101 + only_pk: null,
  102 + all_sto: null,
  103 + sec_sto: null, //选择了的门店分类
  104 + pickpu_list: null, //读出的所有门店list
  105 + def_pickpu_list: null, //一开始5个门店list
  106 + sec_pick_index: 0, //第二级门店选择ID
  107 + fir_pick_index: 0, //第一级门店选择ID
  108 + all_pick_list: null,//所有的门店先记录起来
  109 +
  110 + select_store: 0, //选择更多
  111 + index: 1,
  112 + more_store: 0, //选择门店
  113 + sort_store: 0, //门店分类
  114 + choice_sort_store: 0, //选择分类门店
  115 + new_user: 0, //新用户
  116 +
  117 + def_pick_store: null, // 默认的门店
  118 + fir_def_store: null, //客户默认的门店的
  119 + lat: null, //维度
  120 + lon: null, //经度
  121 +
  122 + is_get_local_ok: 0, //获取坐标是否完成
  123 + region_name: "门店分类", //区域的名字
  124 + is_gps: 1,
  125 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  126 + default_store: {}, //创建添加默认门店地址的对象
  127 +
  128 + store: 0,
  129 + openSpecModal: 0,
  130 +
89 131  
90 132 },
91 133  
... ... @@ -99,7 +141,8 @@ Page({
99 141 var nav_b = th.selectComponent("#nav_b"); //组件的id
100 142 nav_b.set_name("助力", "/pages/user/assistance/assistance");
101 143 th.setData({
102   - help_id: help_id
  144 + help_id: help_id,
  145 + buyType:4
103 146 });
104 147 //start 钱
105 148 if (options.gid != undefined) {
... ... @@ -111,27 +154,107 @@ Page({
111 154 th.setData({taskid:options.taskid})
112 155 }
113 156  
  157 + //-- 获取分享人的ID --
  158 + var first_leader = options.first_leader || getApp().globalData.first_leader;
  159 + if (first_leader) {
  160 + this.setData({
  161 + first_leader,
  162 + })
  163 + //-- user_id代过来免登录 --
  164 + getApp().globalData.first_leader = first_leader;
  165 + //调用接口判断是不是会员
  166 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  167 + if (res.data.code == 0) {
  168 + getApp().globalData.guide_id = res.data.data.id;
  169 + getApp().globalData.guide_pick_id= res.data.data.pickup_id
  170 + }
  171 + })
  172 + }
  173 +
114 174 console.log('aaaa');
115 175 th.syinfo();
116 176 th.close();
117 177 th.imageinfo();
118 178  
  179 + getApp().getConfig2(function (e) {
  180 + var json_d = JSON.parse(e.switch_list);
  181 + th.setData({
  182 + bconfig: e,
  183 + sys_switch: json_d,
  184 + is_retail_price: json_d.is_retail_price || 0
  185 + });
  186 + })
  187 +
119 188 },
120 189  
  190 + check_guide(func){
  191 + var first_leader=this.data.first_leader;
  192 + if(!first_leader){
  193 + func();
  194 + return false;
  195 + }
  196 + if(this.data.is_geted_guide_pick){
  197 + func();
  198 + return false;
  199 + }
  200 + if(getApp().globalData.guide_pick_id){
  201 + func();
  202 + return false;
  203 + }
  204 + var th=this;
  205 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  206 + if (res.data.code == 0) {
  207 + getApp().globalData.guide_pick_id= res.data.data.pickup_id;
  208 + }
  209 + th.data.is_geted_guide_pick=1;
  210 + func();
  211 + })
  212 + },
  213 +
  214 +
  215 + //选中任务
  216 + add_onlicke:function (e){
  217 + this.data.tg_dd=e;
  218 + var th=this;
  219 + if(this.data.is_nd_pk){
  220 + th.setData({ openSpecModal: 1 })
  221 + th.pp_bacK_func=th.add_onlicke_next; //设置回调函数
  222 + }else{
  223 + return false;
  224 + add_onlicke_next();
  225 + }
  226 + },
  227 +
  228 +
  229 + //选中任务保存下一步
  230 + add_onlicke_next: function () {
  231 +
  232 + if(!this.data.tg_dd){
  233 + return false;
  234 + }
  235 +
  236 + let e=JSON.parse(JSON.stringify(this.data.tg_dd));
  237 + this.data.tg_dd=null;
121 238  
122   - //选中任务保存
123   - add_onlicke: function (e) {
124 239 var th = this;
125 240 var taskid = e.target.dataset.taskid;
126 241 var help_id = th.data.help_id;
127 242 var user_id = getApp().globalData.user_id;
128 243 var stoid = os.stoid
129   - getApp().request.json_post("/api/weshop/marketing/help/help/task/insert", {
  244 +
  245 + var insert_dd={
130 246 helpId: help_id,
131 247 userId: user_id,
132 248 storeId: stoid,
133 249 taskId: taskid
134   - },
  250 + };
  251 +
  252 + //-- 如果需要门店的时候 --
  253 + if( th.data.is_nd_pk==1){
  254 + insert_dd.pickupId=th.data.def_pick_store.pickup_id;
  255 + }
  256 +
  257 + getApp().request.json_post("/api/weshop/marketing/help/help/task/insert", insert_dd,
135 258 function (res) {
136 259 if (res.data.code == 0) {
137 260 getApp().my_warnning(res.data.data, 1, th);
... ... @@ -142,6 +265,8 @@ Page({
142 265 } else {
143 266 getApp().my_warnning(res.data.msg, 0, th);
144 267 }
  268 + th.setData({submit:0})
  269 + th.closeSpecModal();
145 270 }
146 271  
147 272 )
... ... @@ -175,14 +300,76 @@ Page({
175 300 success: function (res) {
176 301 if (res.data.code == 0) {
177 302 var help_data = res.data.data;
178   - th.setData({
  303 +
  304 + help_data.giftTitle=help_data.actName;
  305 + help_data.lbUrl=help_data.imageUrl;
  306 +
  307 + let sData={
179 308 endDate: help_data.endDate,
180   -
181   - btn_color: help_data.btn_color,
182   - bg_color: help_data.bg_color,
183   - font_color: help_data.font_color,
184   - imageUrl: help_data.imageUrl,
185   - });
  309 + btn_color: help_data.btn_color,
  310 + bg_color: help_data.bg_color,
  311 + font_color: help_data.font_color,
  312 + imageUrl: help_data.imageUrl,
  313 + sele_g:help_data
  314 + };
  315 +
  316 + if(help_data.is_pickup){
  317 + sData.pickup_list=help_data.pickup_list;
  318 + }
  319 +
  320 + th.setData(sData);
  321 +
  322 + /*-----获取助力活动的任务-----*/
  323 + rq.get("/api/weshop/marketing/help/help/task/page", {
  324 + data: {
  325 + helpId: help_id,
  326 + storeId: os.stoid
  327 + },
  328 + success: function (su) {
  329 + var data = su.data;
  330 + if (data.code != 0) {
  331 + getApp().my_warnning(data.msg, 0, th);
  332 + return false;
  333 + }
  334 + if (data.code == 0 && data.data && data.data.pageData && data.data.pageData.length>0) {
  335 + //轮播图的数据
  336 + var data_aissa = data.data.pageData;
  337 + //当前时间戳
  338 + var nt = ut.gettimestamp();
  339 +
  340 + data_aissa.forEach(function (val, ind) {
  341 + //已开始
  342 + if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0;
  343 + //未开始
  344 + else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1;
  345 + //已结束
  346 + else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2;
  347 + });
  348 + var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty;
  349 + var taskid = data_aissa[0].id;
  350 + if(th.data.taskid) {
  351 + th.setData({
  352 + aitem: data_aissa,
  353 + task_number: task_number,
  354 + giftQty:data_aissa[0].giftQty,
  355 + });
  356 + th.go_to_task(th.data.taskid);
  357 +
  358 + }else{
  359 + th.setData({
  360 + aitem: data_aissa,
  361 + task_number: task_number,
  362 + taskid: taskid,
  363 + giftQty:data_aissa[0].giftQty,
  364 + });
  365 + //判断是不是领取的任务
  366 + th.get_user_task();
  367 + th.get_user_task_num();
  368 + }
  369 + }
  370 +
  371 + }
  372 + })
186 373  
187 374 //任务时间 设置全局定时器
188 375 th.setData({
... ... @@ -191,65 +378,11 @@ Page({
191 378 }, 1000)
192 379 })
193 380  
194   -
195 381 }
196 382 }
197 383 });
198 384  
199 385  
200   - /*-----获取助力活动的任务-----*/
201   - rq.get("/api/weshop/marketing/help/help/task/page", {
202   - data: {
203   - helpId: help_id,
204   - storeId: os.stoid
205   - },
206   - success: function (su) {
207   - var data = su.data;
208   - if (data.code != 0) {
209   - getApp().my_warnning(data.msg, 0, th);
210   - return false;
211   - }
212   - if (data.code == 0 && data.data && data.data.pageData && data.data.pageData.length>0) {
213   - //轮播图的数据
214   - var data_aissa = data.data.pageData;
215   - //当前时间戳
216   - var nt = ut.gettimestamp();
217   -
218   - data_aissa.forEach(function (val, ind) {
219   - //已开始
220   - if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0;
221   - //未开始
222   - else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1;
223   - //已结束
224   - else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2;
225   - });
226   - var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty;
227   - var taskid = data_aissa[0].id;
228   - if(th.data.taskid) {
229   - th.setData({
230   - aitem: data_aissa,
231   - task_number: task_number,
232   - giftQty:data_aissa[0].giftQty,
233   - });
234   - th.go_to_task(th.data.taskid);
235   -
236   - }else{
237   - th.setData({
238   - aitem: data_aissa,
239   - task_number: task_number,
240   - taskid: taskid,
241   - giftQty:data_aissa[0].giftQty,
242   - });
243   - //判断是不是领取的任务
244   - th.get_user_task();
245   - th.get_user_task_num();
246   - }
247   - }
248   -
249   - }
250   - })
251   -
252   -
253 386 //会员任务列表
254 387 this.user_task_list();
255 388 //获取助力活动参与的人数
... ... @@ -468,6 +601,27 @@ Page({
468 601 var aitem = th.data.aitem;
469 602 var sw_index = th.data.sw_index;
470 603 var taskid = aitem[sw_index].id
  604 +
  605 + //-- 判断一下要不要弹出框,选择门店,只有在礼包含有礼品的时候 --
  606 + getApp().promiseGet('/api/weshop/marketing/help/help/task/getlbtype?storeId='+os.stoid+'&Id='+taskid,{}).then(gNew=>{
  607 + if(gNew && gNew.data.code==0 && gNew.data.data){
  608 + if(th.data.pickup_list && gNew.data.data.lb_type.indexOf(',1,')>-1){
  609 + th.data.is_nd_pk=1;
  610 + //-- 检测一下有没有门店 --
  611 + th.check_guide(function (){
  612 + com.wait_for_store_config(th);
  613 + com.set_user_mo_store(th, os, function () {
  614 + if (sele_g.pickup_list && th.data.def_pick_store) {
  615 + com.check_def_pk(th);
  616 + }
  617 + });
  618 + com.get_sto(th, os);
  619 + })
  620 + }
  621 + }
  622 + })
  623 +
  624 +
471 625 rq.get("/api/weshop/marketing/help/help/task/get", {
472 626 data: {
473 627 storeId: os.stoid,
... ... @@ -489,7 +643,8 @@ Page({
489 643 },
490 644 //获取失效时间
491 645 getInvalidTime(taskid){
492   - let th = this
  646 + let th = this;
  647 + let _this2=this;
493 648 rq.get("/api/weshop/marketing/giftbag/helpinfo/get", {
494 649 data: {
495 650 storeId: os.stoid,
... ... @@ -497,7 +652,7 @@ Page({
497 652 taskId: taskid,
498 653 helpId:th.data.help_id
499 654 },
500   - success: function (res) {
  655 + success:async function (res) {
501 656 console.log('获取失效时间------');
502 657 console.log(res);
503 658 if (res.data.code == 0) {
... ... @@ -507,6 +662,7 @@ Page({
507 662 if (openTime && validTime > 0) {
508 663 invalidTime = openTime*1 + validTime*60*60
509 664 }
  665 +
510 666 th.setData({
511 667 invalidTime
512 668 });
... ... @@ -1146,7 +1302,7 @@ Page({
1146 1302 is_dismantle: 0,
1147 1303 bc_page: 1,
1148 1304 })
1149   - this.get_user_task_num();
  1305 + this.get_user_task_num();
1150 1306  
1151 1307 },
1152 1308  
... ... @@ -1174,4 +1330,380 @@ Page({
1174 1330 };
1175 1331 },
1176 1332  
  1333 + buy_libao: function () {
  1334 + com.buy_libao(this)
  1335 + },
  1336 +
  1337 +
  1338 + //-- 选择门店 --
  1339 + choice_store: function (ee) {
  1340 + this.setData({
  1341 + keyword:''
  1342 + })
  1343 +
  1344 + //--先判断会员状态--
  1345 + var user_info = getApp().globalData.userInfo;
  1346 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  1347 + wx.navigateTo({
  1348 + url: '/packageE/pages/togoin/togoin',
  1349 + })
  1350 + return false;
  1351 + }
  1352 +
  1353 + var th = this;
  1354 + var ind = ee.currentTarget.dataset.ind;
  1355 + var bconfig = th.data.bconfig;
  1356 +
  1357 + //如果开启了,则不在选择门店
  1358 + // if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
  1359 + // return false;
  1360 + // }
  1361 + // if (!th.data.only_pk && !th.data.def_pickpu_list) {
  1362 + // getApp().confirmBox("门店库存不足", null, 25000, !1);
  1363 + // return false;
  1364 + // }
  1365 +
  1366 + if (th.data.only_pk && !th.data.only_pk.length) {
  1367 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1368 + return false;
  1369 + }
  1370 + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
  1371 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1372 + return false;
  1373 + }
  1374 +
  1375 +
  1376 + if (bconfig && bconfig.is_sort_storage) {
  1377 + wx.getLocation({
  1378 + type: 'gcj02',
  1379 + success: function (res) {
  1380 +
  1381 + th.data.lat = res.latitude;
  1382 + th.data.lon = res.longitude;
  1383 + th.data.is_get_local_ok = 1;
  1384 + th.setData({
  1385 + is_gps: 1
  1386 + });
  1387 + //th.onShow();
  1388 + com.get_sto(th, os);
  1389 + },
  1390 + fail: function (res) {
  1391 + //th.onShow();
  1392 + th.data.is_get_local_ok = 1;
  1393 + com.get_sto(th, os);
  1394 + if (res.errCode == 2) {
  1395 + th.setData({
  1396 + is_gps: 0
  1397 + });
  1398 + if (th.data.is_gps == 0) {
  1399 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  1400 + }
  1401 + } else {
  1402 + th.setData({
  1403 + is_gps: "3"
  1404 + });
  1405 + }
  1406 +
  1407 + }
  1408 + })
  1409 + } else {
  1410 + th.data.is_get_local_ok = 1;
  1411 + com.get_sto(th, os);
  1412 + }
  1413 +
  1414 + if (ind != undefined && ind != null) {
  1415 + this.setData({
  1416 + open_ind_store: ind,
  1417 + store: 1,
  1418 + openSpecModal: !1,
  1419 + openSpecModal_pt: !1,
  1420 + openSpecModal_flash_normal: !1,
  1421 + })
  1422 + } else {
  1423 + this.setData({
  1424 + store: 1,
  1425 + openSpecModal: !1,
  1426 + openSpecModal_pt: !1,
  1427 + openSpecModal_flash_normal: !1
  1428 +
  1429 + })
  1430 + }
  1431 + },
  1432 + //关闭选择门店
  1433 + close_popup: function (e) {
  1434 + var th = this;
  1435 + this.setData({
  1436 + store: 0,
  1437 + choice_sort_store: 0,
  1438 + sort_store: 0,
  1439 + fir_pick_index: 0,
  1440 + sec_pick_index: 0
  1441 + })
  1442 +
  1443 + var openindstore = this.data.open_ind_store;
  1444 + if (openindstore == 1) {
  1445 + th.setData({
  1446 + openSpecModal: !0,
  1447 + openSpecModal_ind: openindstore,
  1448 + });
  1449 + } else if (openindstore == 2) {
  1450 + th.setData({
  1451 + openSpecModal: !0,
  1452 + openSpecModal_ind: openindstore,
  1453 + });
  1454 + } else if (openindstore == 4) { //4就是拼团
  1455 + th.setData({
  1456 + openSpecModal_pt: 1, //打开拼团购买界面
  1457 + store: 0, //关闭门店
  1458 + choice_sort_store: 0, //关闭门店2级
  1459 + sort_store: 0, //关闭门店2级
  1460 + });
  1461 + } else {
  1462 + th.setData({
  1463 + store: 0,
  1464 + choice_sort_store: 0,
  1465 + sort_store: 0
  1466 + })
  1467 + }
  1468 +
  1469 +
  1470 + },
  1471 + //选择更多门店
  1472 + more_store: function () {
  1473 + this.setData({
  1474 + sort_store: 1
  1475 + });
  1476 + },
  1477 + // 返回按钮
  1478 + returns: function () {
  1479 + this.setData({
  1480 + sort_store: 0,
  1481 + choice_sort_store: 0
  1482 + });
  1483 + },
  1484 + //---选择分类门店---
  1485 + choice_sort_store: function (e) {
  1486 + var index = e.currentTarget.dataset.index;
  1487 + var region_name = e.currentTarget.dataset.region;
  1488 + var item = this.data.all_sto[index];
  1489 + this.setData({
  1490 + region_name: region_name,
  1491 + sort_store: 0,
  1492 + choice_sort_store: 1,
  1493 + sec_i:index,
  1494 + sec_sto: item,
  1495 + sec_pick_index: 0
  1496 + });
  1497 + },
  1498 + choose_for_store_fir: function (e) {
  1499 + var index_c = e.currentTarget.dataset.ind;
  1500 + var th = this;
  1501 + th.setData({
  1502 + fir_pick_index: index_c
  1503 + })
  1504 +
  1505 + },
  1506 + //确定def_pick为选择的门店
  1507 + sure_pick: function (e) {
  1508 + var th = this;
  1509 + var item = null;
  1510 + var openindstore = th.data.open_ind_store;
  1511 +
  1512 + if (th.data.choice_sort_store == 0) {
  1513 + var index = th.data.fir_pick_index;
  1514 + if (th.data.is_show_sto_cat == 1) {
  1515 + item = th.data.def_pickpu_list[index];
  1516 + } else {
  1517 + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候
  1518 + }
  1519 +
  1520 + } else {
  1521 + var index = th.data.sec_pick_index;
  1522 + item = th.data.sec_sto.s_arr[index];
  1523 + }
  1524 +
  1525 + if(!item) return false;
  1526 +
  1527 + if (!th.data.sele_g) return false;
  1528 +
  1529 + th.setData({
  1530 + def_pick_store: item,
  1531 + sto_sele_name: item.pickup_name,
  1532 + sto_sele_id: item.pickup_id,
  1533 + sto_sele_distr: item.distr_type,
  1534 + store: 0,
  1535 + choice_sort_store: 0,
  1536 + fir_pick_index: 0,
  1537 + openSpecModal: !0,
  1538 + });
  1539 +
  1540 +
  1541 + },
  1542 + //---点击二级之后的选择---
  1543 + choose_for_store: function (e) {
  1544 + var index_c = e.currentTarget.dataset.ind;
  1545 + var th = this;
  1546 + th.setData({
  1547 + sec_pick_index: index_c,
  1548 + fir_pick_index: index_c
  1549 + })
  1550 +
  1551 + },
  1552 + //把选择的门店设置成默认的门店def_pick
  1553 + set_def_pick: function (e) {
  1554 + var th = this;
  1555 + var item = null;
  1556 + if (th.data.choice_sort_store == 0) {
  1557 + var index = th.data.fir_pick_index;
  1558 + if (th.data.is_show_sto_cat == 1) {
  1559 + item = th.data.def_pickpu_list[index];
  1560 + } else {
  1561 + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候
  1562 + }
  1563 + } else {
  1564 + var index = th.data.sec_pick_index;
  1565 + item = th.data.sec_sto.s_arr[index];
  1566 + }
  1567 +
  1568 + if(!item) return false;
  1569 +
  1570 + th.setData({
  1571 + def_pick_store: item,
  1572 + sto_sele_name: item.pickup_name,
  1573 + sto_sele_id: item.pickup_id,
  1574 + sto_sele_distr: item.distr_type,
  1575 + store: 0,
  1576 + choice_sort_store: 0,
  1577 + openSpecModal: !0,
  1578 + });
  1579 +
  1580 + var user_id = getApp().globalData.user_id;
  1581 + var def_pickup_id = item.pickup_id;
  1582 + getApp().request.put('/api/weshop/users/update', {
  1583 + data: {
  1584 + user_id: user_id,
  1585 + def_pickup_id: def_pickup_id
  1586 + },
  1587 + success: function (res) {
  1588 + if (res.data.code == 0) {
  1589 + if (th.data.choice_sort_store == 0) th.setData({
  1590 + fir_pick_index: 0
  1591 + });
  1592 + getApp().globalData.pk_store = item;
  1593 + } else {
  1594 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  1595 + }
  1596 +
  1597 + }
  1598 + });
  1599 +
  1600 +
  1601 + },
  1602 + closeSpecModal: function () {
  1603 + this.setData({openSpecModal: 0});
  1604 + },
  1605 +
  1606 +
  1607 + //获取搜索门店输入的值
  1608 + input_store: function(e) {
  1609 + this.setData({
  1610 + keyword: e.detail.value
  1611 + })
  1612 + },
  1613 +
  1614 + //-- 搜索门店 --
  1615 + searchfn(){
  1616 + let choice_sort_store = this.data.choice_sort_store
  1617 + if (choice_sort_store==0) { //全局搜索
  1618 + let all_pick_list = this.data.all_pick_list
  1619 + let def_pickpu_list = this.data.def_pickpu_list
  1620 + let keyword = this.data.keyword
  1621 + if (keyword) {
  1622 + let arr=all_pick_list.filter( item =>{
  1623 + let i = item.pickup_name.indexOf(keyword)
  1624 + if (i > -1) {
  1625 + return true
  1626 + }else{
  1627 + return false
  1628 + }
  1629 + })
  1630 + if (arr && arr.length>0) {
  1631 + if(this.data.is_show_sto_cat==1){
  1632 + this.setData({
  1633 + def_pickpu_list:arr
  1634 + })
  1635 + }else{
  1636 + this.setData({
  1637 + only_pk:arr
  1638 + })
  1639 + }
  1640 + }else{
  1641 + wx.showToast({
  1642 + title: '没有搜索到门店',
  1643 + icon: 'none',
  1644 + duration: 2000
  1645 + })
  1646 + }
  1647 + }else{
  1648 + if (this.data.is_show_sto_cat==1) {
  1649 + this.setData({
  1650 + def_pickpu_list:all_pick_list.slice(0,10)
  1651 + })
  1652 + }else{
  1653 + this.setData({
  1654 + only_pk:all_pick_list
  1655 + })
  1656 + }
  1657 +
  1658 + }
  1659 + }else{ //分类下搜索
  1660 + let sec_i=this.data.sec_i
  1661 + let all_sto = this.data.all_sto
  1662 + let old_all_sto = this.data.old_all_sto
  1663 + if (!old_all_sto) {
  1664 + this.setData({
  1665 + old_all_sto:JSON.parse(JSON.stringify(all_sto))
  1666 + })
  1667 + }
  1668 + let sec_sto= this.data.sec_sto
  1669 + let sec_arr = this.data.old_all_sto[sec_i].s_arr
  1670 + let keyword = this.data.keyword
  1671 + let text='sec_sto.s_arr'
  1672 + if (keyword) {
  1673 + let arr=sec_arr.filter( item =>{
  1674 + let i = item.pickup_name.indexOf(keyword)
  1675 + if (i > -1) {
  1676 + return true
  1677 + }else{
  1678 + return false
  1679 + }
  1680 + })
  1681 + if (arr && arr.length>0) {
  1682 + this.setData({
  1683 + [text]:arr
  1684 + })
  1685 + }else{
  1686 + wx.showToast({
  1687 + title: '没有搜索到门店',
  1688 + icon: 'none',
  1689 + duration: 2000
  1690 + })
  1691 + }
  1692 + }else{
  1693 + if(this.data.old_all_sto){
  1694 + this.setData({
  1695 + [text]: this.data.old_all_sto[sec_i].s_arr
  1696 + })
  1697 + }else{
  1698 + this.setData({
  1699 + [text]: all_sto[sec_i].s_arr
  1700 + })
  1701 + }
  1702 +
  1703 + }
  1704 +
  1705 +
  1706 + }
  1707 + },
  1708 +
1177 1709 })
... ...
pages/user/assistance/task_assistance.wxml
... ... @@ -195,4 +195,5 @@
195 195  
196 196 <!-- 二维码显示页面 -->
197 197 <canvas canvas-id='share_id' style='width:750rpx;height:1200rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas>
  198 +<include src="../../giftpack/public/buy_com.wxml"></include>
198 199  
... ...
pages/user/assistance/task_assistance.wxss
  1 +
1 2 page {
2 3 /* background: #d01119; */
3 4 width: 100%;
... ... @@ -277,4 +278,363 @@ image{
277 278 display: flex;
278 279 align-items: center;
279 280 justify-content: space-around;
  281 +}
  282 +
  283 +
  284 +/*-- 和弹出框的组件有关系 --*/
  285 +.xc-width {
  286 + width: 100%;
  287 +}
  288 +.spec-model {
  289 + position: fixed;
  290 + bottom: 0;
  291 + z-index: 20;
  292 + background: white;
  293 + width: 100%;
  294 + /* padding: 0 30rpx; */
  295 + font-size: 32rpx;
  296 + box-sizing: border-box;
  297 + border-radius: 20rpx 20rpx 0 0;
  298 + /* height: 72%; */
  299 +}
  300 +
  301 +.spec-model .pding {
  302 + padding: 0 20rpx;
  303 +}
  304 +.pding {
  305 + padding-top: 20rpx;
  306 + padding-left: 20rpx;
  307 + height: 81%;
  308 + padding-right: 20rpx;
  309 + font-size: 26rpx;
  310 + color: #ea120f
  311 +}
  312 +
  313 +.spec-goods {
  314 + padding: 30rpx 0 20rpx;
  315 + /* float: left; */
  316 + width: 100%;
  317 + /* border-bottom:2rpx solid #eee; */
  318 +}
  319 +
  320 +.spec-img {
  321 + float: left;
  322 + height: 186rpx;
  323 + width: 186rpx;
  324 + border: 4rpx solid #eee
  325 +}
  326 +
  327 +.spec-goods-info {
  328 + float: left;
  329 + padding: 0 25rpx;
  330 + width: 400rpx;
  331 +}
  332 +
  333 +.spec-goods-name {
  334 + font-size: 30rpx;
  335 + line-height: 35rpx;
  336 + height: 70rpx;
  337 + margin: 15rpx 20rpx 25rpx 0;
  338 + overflow: hidden;
  339 + text-overflow: ellipsis;
  340 + color: #333;
  341 +}
  342 +
  343 +.spec-goods-price {
  344 + color: #d60021;
  345 + font-size: 33rpx;
  346 + font-weight: bold;
  347 + /* display: flex; */
  348 +}
  349 +
  350 +.spec-goods-stock {
  351 + margin-top: 3rpx;
  352 + font-size: 24rpx;
  353 + color: #999999;
  354 + margin-right: 15rpx;
  355 +}
  356 +
  357 +.spec-name {
  358 + clear: both;
  359 + padding: 20rpx 0;
  360 + font-size: 30rpx;
  361 + color: #333;
  362 +}
  363 +.spec-name+view{
  364 + flex-wrap: wrap;
  365 +}
  366 +.stores-img {
  367 + width: 28rpx;
  368 + height: 28rpx;
  369 + margin-right: 10rpx;
  370 +}
  371 +.right-arrow {
  372 + width: 15rpx;
  373 + height: 15rpx;
  374 + border-top: 2rpx solid #d70026;
  375 + border-right: 2rpx solid #d70026;
  376 + transform: rotate(45deg);
  377 + display: inline-block;
  378 + margin-bottom: 3rpx;
  379 +}
  380 +
  381 +
  382 +.spec-btn {
  383 + color: black;
  384 + background-color: white;
  385 + padding: 10rpx 10rpx;
  386 + font-size: 26rpx;
  387 + line-height: 28rpx;
  388 + float: left;
  389 + border: 1rpx solid #dedede;
  390 + margin: 4rpx 10rpx 4rpx 0;
  391 + border-radius: 4rpx;
  392 +}
  393 +
  394 +.spec-btn-click {
  395 + color: white;
  396 + background-color: #f23030;
  397 + border: 1rpx solid #f23030;
  398 +}
  399 +
  400 +.spec-cart-btns {
  401 + /* width: 92%; */
  402 + line-height: 70rpx;
  403 + /* margin: 0rpx auto;
  404 + margin-top: 160rpx; */
  405 + /* border-radius: 20rpx; */
  406 + /* position: fixed; */
  407 + /* bottom: 50rpx; */
  408 + /* left: 4%; */
  409 + padding: 20rpx;
  410 +}
  411 +
  412 +.spec-cart-btn {
  413 +
  414 + width: 100%;
  415 + font-size: 30rpx;
  416 + text-align: center;
  417 + color: white;
  418 + border-radius: 40rpx;
  419 +}
  420 +
  421 +.spec-cart-btn.w40 {
  422 + width: 46%;
  423 +}
  424 +
  425 +.spec-add-cart {
  426 + background-color: #ffb03f;
  427 +}
  428 +
  429 +.spec-buy {
  430 + background-color: #f23030;
  431 + /* margin-left: 34rpx; */
  432 +}
  433 +
  434 +.spec-cart-disable {
  435 + background: #bbbbbb;
  436 +}
  437 +
  438 +.spec-cart-btn-lg {
  439 + width: 614rpx;
  440 +}
  441 +
  442 +
  443 +/* 选择门店的弹窗 */
  444 +.mongolia-layer {
  445 + position: fixed;
  446 + left: 0;
  447 + top: 0;
  448 + right: 0;
  449 + bottom: 0;
  450 + z-index: 11;
  451 + background: rgba(0, 0, 0, 0.4);
  452 + width: 100%;
  453 + height: 91.9%;
  454 +
  455 +}
  456 +
  457 +.popup-frame {
  458 + position: fixed;
  459 + z-index: 20;
  460 + background: white;
  461 + width: 100%;
  462 + border-radius: 20rpx 20rpx 0 0;
  463 + height: auto;
  464 + bottom: 0;
  465 +}
  466 +
  467 +.popup-top {
  468 + border-bottom: 1rpx solid #eee;
  469 + height: 155rpx;
  470 + width: 95%;
  471 + margin: auto;
  472 + line-height: 155rpx;
  473 +
  474 +}
  475 +
  476 +.bg_rights {
  477 + border-top: 2rpx solid;
  478 + border-right: 2rpx solid;
  479 + transform: rotate(45deg);
  480 + display: inline-block;
  481 + width: 15rpx;
  482 + height: 15rpx;
  483 + border-color: #da0b31;
  484 +}
  485 +
  486 +.modal-closes {
  487 + position: absolute;
  488 + right: 30rpx;
  489 + top: -15rpx;
  490 + height: 25rpx;
  491 +
  492 +}
  493 +
  494 +.choose_more {
  495 + margin-top: 40rpx;
  496 + margin-right: 20rpx;
  497 +
  498 +}
  499 +
  500 +.choose_mores {
  501 + margin-top: 30rpx;
  502 + margin-right: 15rpx;
  503 +
  504 +}
  505 +
  506 +.store-list {
  507 + width: 95%;
  508 + min-height: 700rpx;
  509 + overflow-y: scroll;
  510 + margin: auto;
  511 + max-height: 700rpx;
  512 +}
  513 +
  514 +.store-list .store_choose {
  515 + width: 100%;
  516 + height: 120rpx;
  517 + line-height: 125rpx;
  518 + border-bottom: 1rpx solid #eee;
  519 + padding: 10rpx 0;
  520 +}
  521 +
  522 +.store-list .store_choose .store {
  523 + width: 100%;
  524 + margin: auto;
  525 + line-height: 37rpx;
  526 + padding-left: 20rpx;
  527 +
  528 +}
  529 +
  530 +.xc-hook {
  531 + width: 35rpx;
  532 + height: 35rpx;
  533 + transform: rotate(-145deg);
  534 + line-height: 37rpx;
  535 + text-align: center;
  536 +}
  537 +
  538 +.xc-hooks {
  539 + width: 30rpx;
  540 + height: 30rpx;
  541 + border: 1rpx solid #999;
  542 +}
  543 +
  544 +.address-frame {
  545 + width: 93%;
  546 + margin-left: 7rpx;
  547 +
  548 +}
  549 +
  550 +.nearby_store {
  551 + margin-left: 17rpx;
  552 +}
  553 +
  554 +.address_name {
  555 + margin-right: 10rpx;
  556 + width: 360rpx;
  557 +
  558 +}
  559 +
  560 +.address-val {
  561 + height: 38rpx;
  562 + line-height: 38rpx;
  563 +
  564 +}
  565 +
  566 +.store-bottom {
  567 + width: 85%;
  568 + margin: auto;
  569 + height: 90rpx;
  570 +}
  571 +
  572 +.searchbar {
  573 + height: 95rpx;
  574 + border-bottom: 2rpx solid rgb(238, 238, 238);
  575 +}
  576 +.storeListpadd {
  577 + padding: 0rpx 31rpx;
  578 +}
  579 +.search {
  580 + width: 125rpx;
  581 + height: 45rpx;
  582 + line-height: 45rpx;
  583 + background-color: rgb(219, 27, 52);
  584 + border-radius: 30rpx;
  585 + color: rgb(255, 255, 255);
  586 +}
  587 +.inputstore {
  588 + width: 510rpx;
  589 + height: 43rpx;
  590 + line-height: 43rpx;
  591 + border-radius: 30rpx;
  592 + border: 2rpx solid rgb(238, 238, 238);
  593 + padding-left: 30rpx;
  594 +}
  595 +
  596 +
  597 +
  598 +.determine {
  599 + width: 260rpx;
  600 + height: 55rpx;
  601 + border-radius: 50rpx;
  602 + line-height: 55rpx;
  603 +}
  604 +
  605 +.default {
  606 + width: 260rpx;
  607 + height: 55rpx;
  608 + border: 3rpx solid #c8c8c8;
  609 + border-radius: 50rpx;
  610 + line-height: 55rpx;
  611 +}
  612 +
  613 +.store-bottom-frame {
  614 + width: 95%;
  615 + margin: auto;
  616 +
  617 +}
  618 +
  619 +/* 门店分类列表 */
  620 +.sort_store_list {
  621 + max-height: 700rpx;
  622 + min-height: 700rpx;
  623 + overflow: hidden;
  624 + overflow-y: scroll;
  625 + width: 95%;
  626 + margin: auto;
  627 +}
  628 +
  629 +.sort_store_list .sort-store-frame {
  630 + width: 100%;
  631 + height: 100rpx;
  632 + line-height: 100rpx;
  633 + border-bottom: 1rpx solid #eee;
  634 +
  635 +}
  636 +
  637 +.sort_store_list .sort-store-frame .sort-store {
  638 + width: 94.5%;
  639 + margin: auto;
280 640 }
281 641 \ No newline at end of file
... ...