Commit 26b322c4166e23382ef0a5e46587e9ca31218e8b

Authored by WXD-SEASON\season
2 parents 87cdba2a 2ea988e4

Merge branch 'dev_oa_fu45' into dev

packageA/pages/profile/profile.js
@@ -79,6 +79,11 @@ Page({ @@ -79,6 +79,11 @@ Page({
79 loading: 0, 79 loading: 0,
80 oldBirtthDayLength:0, //生日日期个数 80 oldBirtthDayLength:0, //生日日期个数
81 oldbirthday:'',//生日日期 81 oldbirthday:'',//生日日期
  82 +
  83 + all_pick_list:null, //所有的门店的集合
  84 + old_all_sto:null,
  85 + keyword:'', //搜索门店的关键字
  86 + sec_i:-1
82 }, 87 },
83 //通过路径跳转到其他页面 88 //通过路径跳转到其他页面
84 goto: function (e) { 89 goto: function (e) {
@@ -267,8 +272,8 @@ Page({ @@ -267,8 +272,8 @@ Page({
267 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { 272 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
268 273
269 var ishas_cate = 0; 274 var ishas_cate = 0;
270 - for (let i in e) {  
271 - let item = e[i]; 275 + for (let i in e.data.data.pageData) {
  276 + let item = e.data.data.pageData[i];
272 if (item.category_id > 0) { 277 if (item.category_id > 0) {
273 ishas_cate = 1; 278 ishas_cate = 1;
274 break; 279 break;
@@ -286,6 +291,10 @@ Page({ @@ -286,6 +291,10 @@ Page({
286 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 291 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
287 } 292 }
288 293
  294 + th.setData({
  295 + all_pick_list: e.data.data.pageData
  296 + });
  297 +
289 //单总量超出5个的时候 298 //单总量超出5个的时候
290 if (e.data.data.total > 10 && ishas_cate) { 299 if (e.data.data.total > 10 && ishas_cate) {
291 i.get("/api/weshop/storagecategory/page", { 300 i.get("/api/weshop/storagecategory/page", {
@@ -465,7 +474,8 @@ Page({ @@ -465,7 +474,8 @@ Page({
465 sort_store: 0, 474 sort_store: 0,
466 choice_sort_store: 1, 475 choice_sort_store: 1,
467 sec_sto: item, 476 sec_sto: item,
468 - sec_pick_index: 0 477 + sec_pick_index: 0,
  478 + sec_i: index,
469 }); 479 });
470 }, 480 },
471 // 返回按钮 481 // 返回按钮
@@ -1547,5 +1557,106 @@ Page({ @@ -1547,5 +1557,106 @@ Page({
1547 }) 1557 })
1548 }, 1558 },
1549 1559
  1560 + //获取搜索门店输入的值
  1561 + input_store: function (e) {
  1562 + this.setData({
  1563 + keyword: e.detail.value
  1564 + })
  1565 + },
  1566 +
  1567 + //搜索门店
  1568 + searchfn() {
  1569 + let choice_sort_store = this.data.choice_sort_store
  1570 + if (choice_sort_store == 0) { //全局搜索
  1571 + let all_pick_list = this.data.all_pick_list
  1572 + let def_pickpu_list = this.data.def_pickpu_list
  1573 + let keyword = this.data.keyword
  1574 + if (keyword) {
  1575 + let arr = all_pick_list.filter(item => {
  1576 + let i = item.pickup_name.indexOf(keyword)
  1577 + if (i > -1) {
  1578 + return true
  1579 + } else {
  1580 + return false
  1581 + }
  1582 + })
  1583 + if (arr && arr.length > 0) {
  1584 + if (this.data.is_show_sto_cat == 1) {
  1585 + this.setData({
  1586 + def_pickpu_list: arr
  1587 + })
  1588 + } else {
  1589 + this.setData({
  1590 + only_pk: arr
  1591 + })
  1592 + }
  1593 + } else {
  1594 + wx.showToast({
  1595 + title: '没有搜索到门店',
  1596 + icon: 'none',
  1597 + duration: 2000
  1598 + })
  1599 + }
  1600 + } else {
  1601 + if (this.data.is_show_sto_cat == 1) {
  1602 + this.setData({
  1603 + def_pickpu_list: all_pick_list.slice(0, 10)
  1604 + })
  1605 + } else {
  1606 + this.setData({
  1607 + only_pk: all_pick_list
  1608 + })
  1609 + }
  1610 +
  1611 + }
  1612 + } else { //分类下搜索
  1613 + let sec_i = this.data.sec_i
  1614 + let all_sto = this.data.all_sto
  1615 + let old_all_sto = this.data.old_all_sto
  1616 + if (!old_all_sto) {
  1617 + this.setData({
  1618 + old_all_sto:JSON.parse(JSON.stringify(all_sto))
  1619 + })
  1620 + }
  1621 + let sec_sto = this.data.sec_sto
  1622 + let sec_arr = this.data.old_all_sto[sec_i].s_arr
  1623 + let keyword = this.data.keyword
  1624 + let text = 'sec_sto.s_arr'
  1625 + if (keyword) {
  1626 + let arr = sec_arr.filter(item => {
  1627 + let i = item.pickup_name.indexOf(keyword)
  1628 + if (i > -1) {
  1629 + return true
  1630 + } else {
  1631 + return false
  1632 + }
  1633 + })
  1634 + if (arr && arr.length > 0) {
  1635 + this.setData({
  1636 + [text]: arr
  1637 + })
  1638 + } else {
  1639 + wx.showToast({
  1640 + title: '没有搜索到门店',
  1641 + icon: 'none',
  1642 + duration: 2000
  1643 + })
  1644 + }
  1645 + } else {
  1646 + if(this.data.old_all_sto){
  1647 + this.setData({
  1648 + [text]: this.data.old_all_sto[sec_i].s_arr
  1649 + })
  1650 + }else{
  1651 + this.setData({
  1652 + [text]: all_sto[sec_i].s_arr
  1653 + })
  1654 + }
  1655 + }
  1656 +
  1657 +
  1658 + }
  1659 + },
  1660 +
1550 1661
1551 }); 1662 });
1552 \ No newline at end of file 1663 \ No newline at end of file
packageA/pages/profile/profile.wxml
@@ -232,6 +232,14 @@ @@ -232,6 +232,14 @@
232 </view> 232 </view>
233 </view> 233 </view>
234 </view> 234 </view>
  235 +
  236 + <view class="searchbar flex-vertical-between storeListpadd">
  237 + <input class="inputstore fs28" placeholder="输入要搜索的门店" value="{{keyword}}" placeholder-class="fs28" maxlength="16" bindinput="input_store" bindconfirm="searchfn" />
  238 + <view class="search flex-center" bindtap="searchfn">
  239 + <view class="fs28">搜索</view>
  240 + </view>
  241 + </view>
  242 +
235 <!-- 门店列表,最外层的门店列表,一开始 --> 243 <!-- 门店列表,最外层的门店列表,一开始 -->
236 <view class="store-list"> 244 <view class="store-list">
237 <!--如果还没有点击更多门店的时候 --> 245 <!--如果还没有点击更多门店的时候 -->
packageA/pages/profile/profile.wxss
@@ -723,3 +723,28 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { @@ -723,3 +723,28 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
723 content: '*'; 723 content: '*';
724 color: #C4182E; 724 color: #C4182E;
725 } 725 }
  726 +
  727 +
  728 +.searchbar {
  729 + height: 95rpx;
  730 + border-bottom: 2rpx solid rgb(238, 238, 238);
  731 +}
  732 +.storeListpadd {
  733 + padding: 0rpx 31rpx;
  734 +}
  735 +.search {
  736 + width: 125rpx;
  737 + height: 45rpx;
  738 + line-height: 45rpx;
  739 + background-color: rgb(219, 27, 52);
  740 + border-radius: 30rpx;
  741 + color: rgb(255, 255, 255);
  742 +}
  743 +.inputstore {
  744 + width: 510rpx;
  745 + height: 43rpx;
  746 + line-height: 43rpx;
  747 + border-radius: 30rpx;
  748 + border: 2rpx solid rgb(238, 238, 238);
  749 + padding-left: 30rpx;
  750 +}
726 \ No newline at end of file 751 \ No newline at end of file
packageG/pages/user/userinfo/userinfo.js
@@ -81,6 +81,10 @@ Page({ @@ -81,6 +81,10 @@ Page({
81 81
82 showvipcode:false, 82 showvipcode:false,
83 83
  84 + all_pick_list:null, //所有的门店的集合
  85 + old_all_sto:null,
  86 + keyword:'', //搜索门店的关键字
  87 + sec_i:-1
84 }, 88 },
85 //通过路径跳转到其他页面 89 //通过路径跳转到其他页面
86 goto: function(e) { 90 goto: function(e) {
@@ -350,6 +354,11 @@ Page({ @@ -350,6 +354,11 @@ Page({
350 } 354 }
351 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 355 e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
352 } 356 }
  357 +
  358 +
  359 + th.setData({
  360 + all_pick_list: e.data.data.pageData
  361 + });
353 362
354 //单总量超出5个的时候 363 //单总量超出5个的时候
355 if (e.data.data.total > 10) { 364 if (e.data.data.total > 10) {
@@ -527,7 +536,8 @@ Page({ @@ -527,7 +536,8 @@ Page({
527 sort_store: 0, 536 sort_store: 0,
528 choice_sort_store: 1, 537 choice_sort_store: 1,
529 sec_sto: item, 538 sec_sto: item,
530 - sec_pick_index: 0 539 + sec_pick_index: 0,
  540 + sec_i: index,
531 }); 541 });
532 }, 542 },
533 // 返回按钮 543 // 返回按钮
@@ -1111,7 +1121,108 @@ Page({ @@ -1111,7 +1121,108 @@ Page({
1111 } 1121 }
1112 } 1122 }
1113 }); 1123 });
1114 - } 1124 + },
  1125 +
  1126 + //获取搜索门店输入的值
  1127 + input_store: function (e) {
  1128 + this.setData({
  1129 + keyword: e.detail.value
  1130 + })
  1131 + },
  1132 +
  1133 + //搜索门店
  1134 + searchfn() {
  1135 + let choice_sort_store = this.data.choice_sort_store
  1136 + if (choice_sort_store == 0) { //全局搜索
  1137 + let all_pick_list = this.data.all_pick_list
  1138 + let def_pickpu_list = this.data.def_pickpu_list
  1139 + let keyword = this.data.keyword
  1140 + if (keyword) {
  1141 + let arr = all_pick_list.filter(item => {
  1142 + let i = item.pickup_name.indexOf(keyword)
  1143 + if (i > -1) {
  1144 + return true
  1145 + } else {
  1146 + return false
  1147 + }
  1148 + })
  1149 + if (arr && arr.length > 0) {
  1150 + if (this.data.is_show_sto_cat == 1) {
  1151 + this.setData({
  1152 + def_pickpu_list: arr
  1153 + })
  1154 + } else {
  1155 + this.setData({
  1156 + only_pk: arr
  1157 + })
  1158 + }
  1159 + } else {
  1160 + wx.showToast({
  1161 + title: '没有搜索到门店',
  1162 + icon: 'none',
  1163 + duration: 2000
  1164 + })
  1165 + }
  1166 + } else {
  1167 + if (this.data.is_show_sto_cat == 1) {
  1168 + this.setData({
  1169 + def_pickpu_list: all_pick_list.slice(0, 10)
  1170 + })
  1171 + } else {
  1172 + this.setData({
  1173 + only_pk: all_pick_list
  1174 + })
  1175 + }
  1176 +
  1177 + }
  1178 + } else { //分类下搜索
  1179 + let sec_i = this.data.sec_i
  1180 + let all_sto = this.data.all_sto
  1181 + let old_all_sto = this.data.old_all_sto
  1182 + if (!old_all_sto) {
  1183 + this.setData({
  1184 + old_all_sto:JSON.parse(JSON.stringify(all_sto))
  1185 + })
  1186 + }
  1187 + let sec_sto = this.data.sec_sto
  1188 + let sec_arr = this.data.old_all_sto[sec_i].s_arr
  1189 + let keyword = this.data.keyword
  1190 + let text = 'sec_sto.s_arr'
  1191 + if (keyword) {
  1192 + let arr = sec_arr.filter(item => {
  1193 + let i = item.pickup_name.indexOf(keyword)
  1194 + if (i > -1) {
  1195 + return true
  1196 + } else {
  1197 + return false
  1198 + }
  1199 + })
  1200 + if (arr && arr.length > 0) {
  1201 + this.setData({
  1202 + [text]: arr
  1203 + })
  1204 + } else {
  1205 + wx.showToast({
  1206 + title: '没有搜索到门店',
  1207 + icon: 'none',
  1208 + duration: 2000
  1209 + })
  1210 + }
  1211 + } else {
  1212 + if(this.data.old_all_sto){
  1213 + this.setData({
  1214 + [text]: this.data.old_all_sto[sec_i].s_arr
  1215 + })
  1216 + }else{
  1217 + this.setData({
  1218 + [text]: all_sto[sec_i].s_arr
  1219 + })
  1220 + }
  1221 + }
  1222 +
  1223 +
  1224 + }
  1225 + },
1115 1226
1116 1227
1117 }); 1228 });
1118 \ No newline at end of file 1229 \ No newline at end of file
packageG/pages/user/userinfo/userinfo.wxml
@@ -344,6 +344,14 @@ @@ -344,6 +344,14 @@
344 </view> 344 </view>
345 </view> 345 </view>
346 </view> 346 </view>
  347 +
  348 + <view class="searchbar flex-vertical-between storeListpadd">
  349 + <input class="inputstore fs28" placeholder="输入要搜索的门店" value="{{keyword}}" placeholder-class="fs28" maxlength="16" bindinput="input_store" bindconfirm="searchfn" />
  350 + <view class="search flex-center" bindtap="searchfn">
  351 + <view class="fs28">搜索</view>
  352 + </view>
  353 + </view>
  354 +
347 <!-- 门店列表,最外层的门店列表,一开始 --> 355 <!-- 门店列表,最外层的门店列表,一开始 -->
348 <view class="store-list"> 356 <view class="store-list">
349 <!--如果还没有点击更多门店的时候 --> 357 <!--如果还没有点击更多门店的时候 -->
packageG/pages/user/userinfo/userinfo.wxss
@@ -674,4 +674,29 @@ input { @@ -674,4 +674,29 @@ input {
674 align-items: center; 674 align-items: center;
675 justify-content: center; 675 justify-content: center;
676 /* margin-top: 20rpx; */ 676 /* margin-top: 20rpx; */
  677 +}
  678 +
  679 +
  680 +.searchbar {
  681 + height: 95rpx;
  682 + border-bottom: 2rpx solid rgb(238, 238, 238);
  683 +}
  684 +.storeListpadd {
  685 + padding: 0rpx 31rpx;
  686 +}
  687 +.search {
  688 + width: 125rpx;
  689 + height: 45rpx;
  690 + line-height: 45rpx;
  691 + background-color: rgb(219, 27, 52);
  692 + border-radius: 30rpx;
  693 + color: rgb(255, 255, 255);
  694 +}
  695 +.inputstore {
  696 + width: 510rpx;
  697 + height: 43rpx;
  698 + line-height: 43rpx;
  699 + border-radius: 30rpx;
  700 + border: 2rpx solid rgb(238, 238, 238);
  701 + padding-left: 30rpx;
677 } 702 }
678 \ No newline at end of file 703 \ No newline at end of file
pages/goods/goodsList/goodsList.js
@@ -45,9 +45,12 @@ Page({ @@ -45,9 +45,12 @@ Page({
45 gr_fir:0, //分组第一次 45 gr_fir:0, //分组第一次
46 share_imgurl:'', //分享图片 46 share_imgurl:'', //分享图片
47 add_purchase:false, 47 add_purchase:false,
  48 +
  49 + pro_good:null, //优惠促销活动
  50 + pro_good_err:null, //优惠促销活动
48 }, 51 },
49 52
50 - onLoad: function(t) { 53 + onLoad: async function(t) {
51 //----------商品分组自定义分享图片---------- 54 //----------商品分组自定义分享图片----------
52 if (t.gid || t.group_id) { 55 if (t.gid || t.group_id) {
53 let id = t.gid || t.group_id 56 let id = t.gid || t.group_id
@@ -75,31 +78,29 @@ Page({ @@ -75,31 +78,29 @@ Page({
75 var th=this; 78 var th=this;
76 var url = this.data.baseUrl; 79 var url = this.data.baseUrl;
77 80
78 - //优惠活动的凑单  
79 - if(t.prom_type==3){  
80 - if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }  
81 - if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }  
82 - //-- 获取 --  
83 - getApp().request.promiseGet("/api/weshop/promgoodslist/list",{  
84 - data:{prom_id:t.prom_id }  
85 - }).then(res=>{  
86 - if(res.data.code==0){  
87 - var arr= res.data.data;  
88 - th.set_prom_list(arr);  
89 - }  
90 - })  
91 - if (t.prom_id) {  
92 - this.getprom(t.prom_id)  
93 - }  
94 - } 81 + if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
  82 + if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
95 83
96 84
97 //先查看一下是不是系统会员 85 //先查看一下是不是系统会员
98 - getApp().waitfor_login(()=> { 86 + getApp().waitfor_login(async ()=> {
99 if (!getApp().globalData.user_id) { 87 if (!getApp().globalData.user_id) {
100 ut.new_user_go(oo.stoid, first_leader); 88 ut.new_user_go(oo.stoid, first_leader);
101 } 89 }
102 90
  91 + await th.get_prom_act(t);
  92 + if(t.prom_type==3 && !th.data.pro_good){
  93 + if(th.data.pro_good_err.indexOf("无权限")>-1){
  94 + ut.m_toast('您无权限参与优惠促销活动');
  95 + }else{
  96 + ut.m_toast('未找到优惠促销活动');
  97 + }
  98 + setTimeout(()=>{
  99 + getApp().goto('/pages/index/index/index');
  100 + },1500)
  101 + return false
  102 + }
  103 +
103 this.data.is_new=t.is_new; 104 this.data.is_new=t.is_new;
104 this.data.is_hot=t.is_hot; 105 this.data.is_hot=t.is_hot;
105 if (0 != t.cat_id && t.cat_id != undefined) { 106 if (0 != t.cat_id && t.cat_id != undefined) {
@@ -257,6 +258,31 @@ Page({ @@ -257,6 +258,31 @@ Page({
257 }) 258 })
258 }, 259 },
259 260
  261 +
  262 + async get_prom_act(t){
  263 + var th=this;
  264 + //优惠活动的凑单
  265 + if(t.prom_type==3){
  266 + if (t.prom_id) {
  267 + await this.getprom(t.prom_id);
  268 + if(!th.data.pro_good){
  269 + return false;
  270 + }
  271 + }
  272 +
  273 + //-- 获取 --
  274 + getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
  275 + data:{prom_id:t.prom_id }
  276 + }).then(res=>{
  277 + if(res.data.code==0){
  278 + var arr= res.data.data;
  279 + th.set_prom_list(arr);
  280 + }
  281 + })
  282 +
  283 + }
  284 + },
  285 +
260 onShow:function () { 286 onShow:function () {
261 getApp().check_can_share(); 287 getApp().check_can_share();
262 }, 288 },
@@ -274,14 +300,20 @@ Page({ @@ -274,14 +300,20 @@ Page({
274 }, 300 },
275 //获取优惠活动 301 //获取优惠活动
276 async getprom(prom_id){ 302 async getprom(prom_id){
277 - await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => { 303 + let th=this;
  304 + var uid=getApp().globalData.user_id || 0;
  305 + await getApp().request.promiseGet("/api/weshop/promgoods/getUser/" + oo.stoid + "/" + prom_id+"/"+uid, {}).then(res => {
278 if (res.data.code == 0) { 306 if (res.data.code == 0) {
279 let prom = res.data.data; 307 let prom = res.data.data;
  308 + th.data.pro_good=prom;
280 let limit_num =prom.limit_num 309 let limit_num =prom.limit_num
281 this.setData({ 310 this.setData({
282 limit_num 311 limit_num
283 }) 312 })
  313 + }else{
  314 + th.data.pro_good_err=res.data.msg;
284 } 315 }
  316 +
285 }) 317 })
286 }, 318 },
287 //设置优惠券的 319 //设置优惠券的