Commit c3527b2274573c84be76466cd98f91162833942d

Authored by season
2 parents 3bf779ef 306bbd4e

最新

Showing 80 changed files with 5920 additions and 567 deletions
.idea/mshopweapp.iml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<module type="WEB_MODULE" version="4">
  3 + <component name="NewModuleRootManager">
  4 + <content url="file://$MODULE_DIR$" />
  5 + <orderEntry type="inheritedJdk" />
  6 + <orderEntry type="sourceFolder" forTests="false" />
  7 + </component>
  8 +</module>
0 9 \ No newline at end of file
... ...
... ... @@ -5,30 +5,88 @@ var api = require(&quot;./api/api.js&quot;)
5 5  
6 6 //公共方法和变量
7 7 App({
8   - globalData: {
9   - setting: t,
10   - wechatUser: null,
11   - userInfo: null,
12   - config: null, //门店参数
13   - config2: null, //门店配置
14   - code: null,
15   - heigth:0,
16   - user_id:null,// 3674923,// 4379287,// null,// 5682068,
17   - buy_now:null,
18   - picklist:null, //门店列表
19   - wuliuprice: null, //物流价格表
20   - wuliu: null, //物流公司
21   - baddr:null,
22   - mobile: null, //记录手机
23   - getu:null, //记录会员信息
24   - sessionKey: null,//记录会员信息
25   - openid: null, //记录会员信息
  8 + editTabBar: function () {
  9 + //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。
26 10  
27   - to_group:null, //参团传递的数据
28   - wxapp_buy_obj:null, //微信小程序购买的Object
29   - pk_store:null, //选择的门店
  11 + var curPageArr = getCurrentPages(); //获取加载的页面
  12 + var curPage = curPageArr[curPageArr.length - 1]; //获取当前页面的对象
  13 + var pagePath = curPage.route; //当前页面url
  14 + if (pagePath.indexOf('/') != 0) {
  15 + pagePath = '/' + pagePath;
  16 + }
  17 + console.log("获取加载的页面:="+curPageArr)
  18 + console.log("获取当前页面的对象:="+curPage)
  19 + console.log("当前页面url:="+pagePath)
  20 + var tabBar = this.globalData.tabBar;
  21 + for (var i = 0; i < tabBar.list.length; i++) {
  22 + tabBar.list[i].active = false;
  23 + if (tabBar.list[i].weappurl == pagePath) {
  24 + tabBar.list[i].active = true; //根据页面地址设置当前页面状态
  25 + }
  26 + }
  27 + curPage.setData({
  28 + tabBar: tabBar
  29 + });
  30 + },
30 31  
  32 + globalData: {
  33 + tabBar: {
  34 + "color": "#6e6d6b",//文字未选择color
  35 + "selectedColor": "#f23030",//文字被选择后color
  36 + "borderStyle": "white",//
  37 + "backgroundColor": "#ffffff",//背景color
  38 + "iscustom":'',
  39 + "url":"",
  40 + "list": [
  41 + {
  42 + "weappurl": "/pages/index/index/index",
  43 + "nav_name": "首页",
  44 + "src": "/miniapp/images/bar/index.png",
  45 + "src_sele": "/miniapp/images/bar/index_on.png"
  46 + },
  47 + {
  48 + "weappurl": "/pages/goods/categoryList/categoryList",
  49 + "nav_name": "分类",
  50 + "src": "/miniapp/images/bar/fl.png",
  51 + "src_sele": "/miniapp/images/bar/fl_on.png"
  52 + },
  53 + {
  54 + "weappurl": "/pages/cart/cart/cart",
  55 + "nav_name": "购物车",
  56 + "src": "/miniapp/images/bar/car.png",
  57 + "src_sele": "/miniapp/images/bar/car_on.png"
  58 + },
  59 + {
  60 + "weappurl": "/pages/user/index/index",
  61 + "nav_name": "我的",
  62 + "src": "/miniapp/images/bar/user.png",
  63 + "src_sele": "/miniapp/images/bar/user_on.png"
  64 + }
  65 + ]
31 66 },
  67 + isTabBar:false,
  68 + setting: t,
  69 + wechatUser: null,
  70 + userInfo: null,
  71 + config: null, //门店参数
  72 + config2: null, //门店配置
  73 + code: null,
  74 + heigth:0,
  75 + user_id:null,// 3674923,// 4379287,// null,// 5682068,
  76 + buy_now:null,
  77 + picklist:null, //门店列表
  78 + wuliuprice: null, //物流价格表
  79 + wuliu: null, //物流公司
  80 + baddr:null,
  81 + mobile: null, //记录手机
  82 + getu:null, //记录会员信息
  83 + sessionKey: null,//记录会员信息
  84 + openid: null, //记录会员信息
  85 +
  86 + to_group:null, //参团传递的数据
  87 + wxapp_buy_obj:null, //微信小程序购买的Object
  88 + pk_store:null, //选择的门店
  89 + },
32 90 auth: o,
33 91 request: a,
34 92 onLaunch: function() {
... ... @@ -368,6 +426,8 @@ App({
368 426 data: {
369 427 store_id: th.globalData.setting.stoid,
370 428 user_id: th.globalData.user_id,
  429 + state:0,
  430 + is_gift:0
371 431 },
372 432 success: function(e) {
373 433 var num = 0;
... ... @@ -396,15 +456,14 @@ App({
396 456 },1000);
397 457 }
398 458 },
399   -
400   -
  459 +
401 460 //------定时等待某个值,有值才进行运算--------
402 461 waitfor2:function(page,key,pop_value_key,func){
403 462 var n=0;
404 463 if(!page.data[key]){
405 464 page.data[key]=setInterval(function(){
406 465 console.log(page.data[key]);n++;
407   - if(page.data[pop_value_key]) {
  466 + if(page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length>0) {
408 467 clearInterval(page.data[key]);
409 468 func();
410 469 }
... ...
app.json
1 1 {
2   - "pages": [
  2 + "pages": [
3 3 "pages/index/index/index",
4 4 "pages/goods/categoryList/categoryList",
5 5 "pages/cart/cart/cart",
... ... @@ -85,11 +85,25 @@
85 85 "pages/video/index",
86 86 "pages/template/index",
87 87 "pages/store/index"
88   -
89   - ],
  88 +
  89 + ],
90 90  
  91 + "subPackages": [{
  92 + "root": "packageA/",
  93 + "name":"pack1",
  94 + "pages": [
  95 + "pages/prom_list/prom_list",
  96 + "pages/quan_list/quan_list",
  97 + "pages/quan_pro/quan_pro"
  98 + ],
  99 + "plugins": {
  100 + "live-player-plugin": {
  101 + "version": "1.0.13",
  102 + "provider": "wx2b03c6e691cd7370"
  103 + }
  104 + }
  105 + }],
91 106  
92   -
93 107 "permission": {
94 108 "scope.userLocation": {
95 109 "desc": "获取你的位置信息"
... ... @@ -112,26 +126,26 @@
112 126 {
113 127 "pagePath": "pages/index/index/index",
114 128 "text": "首页",
115   - "iconPath": "images/bar/index.png",
116   - "selectedIconPath": "images/bar/index_on.png"
  129 + "iconPath": "packageA/images/bar/index.png",
  130 + "selectedIconPath": "packageA/images/bar/index_on.png"
117 131 },
118 132 {
119 133 "pagePath": "pages/goods/categoryList/categoryList",
120 134 "text": "分类",
121   - "iconPath": "images/bar/fl.png",
122   - "selectedIconPath": "images/bar/fl_on.png"
  135 + "iconPath": "packageA/images/bar/fl.png",
  136 + "selectedIconPath": "packageA/images/bar/fl_on.png"
123 137 },
124 138 {
125 139 "pagePath": "pages/cart/cart/cart",
126 140 "text": "购物车",
127   - "iconPath": "images/bar/car.png",
128   - "selectedIconPath": "images/bar/car_on.png"
  141 + "iconPath": "packageA/images/bar/car.png",
  142 + "selectedIconPath": "packageA/images/bar/car_on.png"
129 143 },
130 144 {
131 145 "pagePath": "pages/user/index/index",
132 146 "text": "我的",
133   - "iconPath": "images/bar/user.png",
134   - "selectedIconPath": "images/bar/user_on.png"
  147 + "iconPath": "packageA/images/bar/user.png",
  148 + "selectedIconPath": "packageA/images/bar/user_on.png"
135 149 }
136 150 ]
137 151 },
... ...
app.wxss
... ... @@ -94,7 +94,7 @@ button {
94 94 text-align: center;
95 95 }
96 96 .no-data .no-data-title {
97   - color: #9b9b9b;
  97 + color: #444;
98 98 margin-bottom: 30rpx;
99 99 font-size: 35rpx;
100 100 }
... ...
components/goods_list/goods_list.js
... ... @@ -144,12 +144,21 @@ Component({
144 144 var arr = [1219, 2089, 3031];
145 145 var new_arr = new Array();
146 146 var card_name_map = new Map();
  147 +
  148 + var user = getApp().globalData.userInfo;
  149 +
147 150 for (var i = 0; i < plusCard.length; i++) {
148   - var name = "card" + plusCard[i].CorrPrice.toLowerCase();
149   - card_name_map.set(name, plusCard[i].CardName);
  151 + if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
  152 + continue;
  153 + }
  154 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  155 + card_name_map.set(name, plusCard[i].CardName);
  156 + new_arr.push(plusCard[i]);
  157 +
  158 +
150 159 }
151 160 var ob = {
152   - "card_list": plusCard,
  161 + "card_list": new_arr,
153 162 "name_map": card_name_map
154 163 };
155 164 func(ob);
... ...
images/bar/car.png renamed to packageA/images/bar/car.png

3.43 KB

images/bar/car_on.png renamed to packageA/images/bar/car_on.png

17.7 KB

images/bar/fl.png renamed to packageA/images/bar/fl.png

3.86 KB

images/bar/fl_on.png renamed to packageA/images/bar/fl_on.png

18 KB

images/bar/fx.png renamed to packageA/images/bar/fx.png

3.88 KB

images/bar/fx_on.png renamed to packageA/images/bar/fx_on.png

17.8 KB

images/bar/index.png renamed to packageA/images/bar/index.png

3.79 KB

images/bar/index_on.png renamed to packageA/images/bar/index_on.png

17.8 KB

images/bar/user.png renamed to packageA/images/bar/user.png

4.08 KB

images/bar/user_on.png renamed to packageA/images/bar/user_on.png

17.9 KB

images/share/ct_num.png renamed to packageA/images/share/ct_num.png

3.63 KB

images/share/default_g_img.gif renamed to packageA/images/share/default_g_img.gif

7.54 KB

images/share/hui_hear_pic.png renamed to packageA/images/share/hui_hear_pic.png

27.6 KB

images/share/mackground.png renamed to packageA/images/share/mackground.png

10.4 KB

images/share/miao_share.png renamed to packageA/images/share/miao_share.png

14 KB

images/share/q_tj.png renamed to packageA/images/share/q_tj.png

1.81 KB

images/share/s_gou.png renamed to packageA/images/share/s_gou.png

23.8 KB

images/share/share_bg.png renamed to packageA/images/share/share_bg.png

7.03 KB

packageA/pages/prom_list/filter.wxs 0 → 100644
  1 +var is_has = function (text,val) {
  2 + if(text.indexOf(","+val+",")==-1) return false;
  3 + return true
  4 +}
  5 +
  6 +function get_guige(color,spece){
  7 + if(color=="" && spece==""){return "规格1"}
  8 + if(spece!="" && color==""){return spece}
  9 + if(spece=="" && color!=""){return color}
  10 + if(spece!="" && color!=""){return spece+"/"+color}
  11 + return "";
  12 +}
  13 +
  14 +module.exports = {
  15 + is_has: is_has,
  16 + get_guige:get_guige
  17 +}
... ...
packageA/pages/prom_list/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + //min_price=min.price;
  78 + //min_name=min.name;
  79 + if(type==0) return min_price.toFixed(2);
  80 + if(min_name.length>4 ) min_name=min_name.substring(0, 4);
  81 + return min_name;
  82 + },
  83 +}
  84 +module.exports = {
  85 + is_has_rank:g_filters.is_has_rank,
  86 + get_card_price:g_filters.get_card_price,
  87 +}
0 88 \ No newline at end of file
... ...
packageA/pages/prom_list/prom_list.js 0 → 100644
  1 +var t = require("../../../utils/util.js"),
  2 + ut = t,
  3 + e = require("../../../utils/common.js"),
  4 + a = require("../../../utils/wxParse/wxParse.js"),
  5 + s = getApp(),
  6 + i = s.request,
  7 + rq = i,
  8 + oo = s.globalData,
  9 + o = s.globalData.setting,
  10 + os = o;
  11 +var utils = require('../../../utils/util.js'),ut=utils;
  12 +var regeneratorRuntime = require('../../../utils/runtime.js');
  13 +
  14 +
  15 +Page({
  16 + data: {
  17 + gid: "",
  18 + stoid: o.stoid,
  19 + url: o.url,
  20 + resourceUrl: o.resourceUrl,
  21 + iurl: o.imghost,
  22 + defaultAvatar: o.resourceUrl + "/static/images/user68.jpg",
  23 + data: null,
  24 + openSpecModal: !1,
  25 + openPromModal: !1,
  26 + supportPageScroll: !1,
  27 +
  28 + //联系电话
  29 + mobile: '',
  30 + bconfig:null,
  31 + sales_rules:1,
  32 +
  33 + t_time:null,
  34 + card_field:"",
  35 + dp_price:0,
  36 + cut_price:0,
  37 + open_ind_store:1,
  38 + goodsInputNum:1,
  39 + g_buy_num: null,
  40 + sele_collocation:null,
  41 + },
  42 +
  43 + //------初始化加载----------
  44 + onLoad: function(t) {
  45 + var goods_id=t.goods_id;
  46 + this.setData({gid:goods_id});
  47 + var ee=this,th=ee,that=ee;
  48 + //----获取系统参数,并判断等级价格-----
  49 + getApp().getConfig2(function(e) {
  50 + var json_d = JSON.parse(e.switch_list);
  51 + ee.setData({
  52 + store_config: e,
  53 + bconfig: e,
  54 + sys_switch:json_d,
  55 + is_closecoupon: json_d.is_closecoupon,
  56 + is_newsales_rules:json_d.is_newsales_rules,
  57 + sales_rules:e.sales_rules
  58 + });
  59 + //------几人评价-------
  60 + //计算等级价相关
  61 + var swithc_list=e.switch_list;
  62 + var sw_arr=JSON.parse(swithc_list);
  63 + //---如果后台又开等级卡的开关---
  64 + if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
  65 + th.data.rank_switch=true;
  66 + }
  67 + });
  68 +
  69 + //获取用户的默认门店
  70 + getApp().get_user_store(function(ee) {
  71 + if(!ee) {
  72 + th.data.fir_def_store={}; //赋值空对象
  73 + return false;
  74 + }
  75 + var appd=getApp().globalData;
  76 + var w_time = setInterval(function() {
  77 + if (that.data.is_get_local_ok == 0) return false;
  78 + clearInterval(w_time);
  79 + var distance = null;
  80 + var e=JSON.parse(JSON.stringify(ee));
  81 +
  82 + //如果有开启近距离的话,同时距离优不一样了
  83 + if (that.data.lat != null) {
  84 + //如果经纬度有变化的话
  85 + if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){
  86 + that.data.fir_def_store=e;
  87 + that.setData({
  88 + def_pick_store: e,
  89 + sto_sele_name: e.pickup_name,
  90 + sto_sele_id: e.pickup_id,
  91 + sto_sele_distr: e.distr_type
  92 + })
  93 + }else{
  94 + //要用接口是获取距离,js的计算不准
  95 + getApp().request.promiseGet("/api/weshop/pickup/list",{
  96 + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon},
  97 + }).then(res=>{
  98 + if(res.data.code==0){
  99 + e=res.data.data.pageData[0];
  100 + if (e){
  101 + appd.pk_store=e;
  102 + that.data.fir_def_store=e;
  103 + that.setData({
  104 + def_pick_store: e,
  105 + sto_sele_name: e.pickup_name,
  106 + sto_sele_id: e.pickup_id,
  107 + sto_sele_distr: e.distr_type
  108 + })
  109 + }
  110 +
  111 + }
  112 + })
  113 + }
  114 +
  115 + //e.distance = distance;
  116 + appd.lat=that.data.lat;
  117 + appd.lon=that.data.lon;
  118 +
  119 + }else{
  120 + if (e) {
  121 + e.distance = null;
  122 + that.data.fir_def_store=e;
  123 + that.setData({
  124 + def_pick_store: e,
  125 + sto_sele_name: e.pickup_name,
  126 + sto_sele_id: e.pickup_id,
  127 + sto_sele_distr: e.distr_type
  128 + })
  129 + }
  130 + }
  131 +
  132 + }, 500)
  133 + });
  134 +
  135 + },
  136 +
  137 + //---展示---
  138 + onShow: function() {
  139 + var ee=this,th=ee,that=ee;
  140 + var gid = this.data.gid,i = getApp().request;
  141 + ee.data.g_buy_num = new Map();
  142 + this.wait_for_store_config();
  143 + setTimeout(function(){
  144 + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
  145 + failRollback: !0,
  146 + success: function(t) {
  147 + if (t.data.code == 0) {
  148 + if (t.data.data.is_on_sale != 1) {
  149 + wx.showModal({
  150 + title: '商品已经下架',
  151 + showCancel: !1,
  152 + complete: function() {
  153 + wx.navigateBack();
  154 + }
  155 + });
  156 + }
  157 +
  158 + var timestamp = Date.parse(new Date());
  159 + timestamp = timestamp / 1000;
  160 + if (t.data.data.on_time > timestamp) {
  161 + wx.showModal({
  162 + title: '商品还未上架',
  163 + showCancel: !1,
  164 + complete: function() {
  165 + wx.navigateBack();
  166 + }
  167 + });
  168 + }
  169 +
  170 + if (t.data.data.down_time > 0) {
  171 + if (t.data.data.down_time < timestamp) {
  172 + wx.showModal({
  173 + title: '商品已经到期下架',
  174 + showCancel: !1,
  175 + complete: function() {
  176 + wx.navigateBack();
  177 + }
  178 + });
  179 + }
  180 + }
  181 +
  182 + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
  183 + var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2);
  184 + t.data.data['disc'] = txt;
  185 +
  186 + if (t.data.data.original_img.indexOf(o.imghost) == -1)
  187 + t.data.data.original_img = o.imghost + t.data.data.original_img;
  188 + if (t.data.data.goods_content == null) t.data.data.goods_content = "";
  189 +
  190 + //计算商品的规格
  191 + var gg = "";
  192 + if(t.data.data.goods_spec=="null" || t.data.data.goods_spec==null) t.data.data.goods_spec="";
  193 + if(t.data.data.goods_color=="null" || t.data.data.goods_color==null) t.data.data.goods_color="";
  194 +
  195 + if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") {
  196 + gg = t.data.data.goods_spec + "/" + t.data.data.goods_color;
  197 + } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") {
  198 + gg = t.data.data.goods_spec + t.data.data.goods_color;
  199 + } else {
  200 + gg = "规格1";
  201 + }
  202 + t.data.data.gg = gg;
  203 +
  204 +
  205 + //--看一下有没有开启等级卡---
  206 + if(ee.data.rank_switch){
  207 + //---回调卡的列表---
  208 + th.getPlusCardType(function(ob){
  209 + var user = getApp().globalData.userInfo;
  210 + if(user){
  211 + if(user.card_field ){
  212 + var str = user['card_expiredate'].replace(/-/g, '/');
  213 + var end = new Date(str);
  214 + end = Date.parse(end) / 1000;
  215 + var now = ut.gettimestamp();
  216 + //--- 判断是等级会员,且在有效期范围内 ---
  217 + if(user.card_field && now<end){
  218 + var card_name=ob.name_map.get(user.card_field);
  219 + if(card_name.length>5) card_name=card_name.substring(0,5);
  220 + th.setData({card_field:user.card_field,card_name:card_name});
  221 + if(t.data.data[user.card_field]>0) t.data.data.shop_price=t.data.data[user.card_field];
  222 + }
  223 + }
  224 + }
  225 + ee.setData({ data: t.data.data, });
  226 + })
  227 + }else{
  228 + ee.setData({ data: t.data.data, });
  229 + }
  230 +
  231 + /*---获取活动的重表---*/
  232 + //调用接口判断订单优惠,
  233 + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+ee.data.gid+"/2", {}).then(res => {
  234 + if(res.data.code==0){
  235 + var r_data=res.data.data;
  236 + th.loop_promise(0,r_data.collocationList,function(){
  237 + ee.setData({
  238 + collocationGoods:r_data.collocationPromList,
  239 + collocationList:r_data.collocationList,
  240 + })
  241 + })
  242 + }
  243 + })
  244 +
  245 + //获取统一条形码,普通商品和优惠促销的商品
  246 + if ( t.data.data.prom_type == 5){
  247 + //默认门店要拿下门店库存
  248 + if(that.data.sales_rules==2 && that.data.is_newsales_rules){
  249 + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存
  250 + getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){
  251 + if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){
  252 + var lock=0,plist=null;
  253 + //先读取门店的lock,采用链式写法,少用await
  254 + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  255 + data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000}
  256 + }).then(res=>{
  257 + if(res.data.code==0 && res.data.data.total>0){
  258 + for(var i in res.data.data.pageData)
  259 + lock+=res.data.data.pageData[i].outQty
  260 + }
  261 + //---通过接口获取门店的线下库存信息--
  262 + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  263 + data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid}
  264 + })
  265 + }).then(res=>{
  266 + if(res.data.code==0 && res.data.data.total>0){
  267 + plist=res.data.data.pageData[0];
  268 + }
  269 + if(plist && plist.CanOutQty-lock>0){
  270 + that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock;
  271 + }else{
  272 + that.data.fir_def_store.CanOutQty=0;
  273 + }
  274 + //--给门店赋值线下库存--
  275 + th.setData({def_pick_store:that.data.fir_def_store});
  276 + //获取门店
  277 + ee.get_sto();
  278 + })
  279 + }else{
  280 + //--获取门店--
  281 + ee.get_sto();
  282 + }
  283 + })
  284 + }else{
  285 + //获取门店
  286 + ee.get_sto();
  287 + }
  288 +
  289 + }
  290 + else {
  291 + return getApp().my_warnning("商品没有搭配购的活动",0,th)
  292 + }
  293 + }
  294 + }
  295 + });
  296 + },1000)
  297 + },
  298 +
  299 + onUnload: function() {},
  300 + onHide: function() {
  301 + clearInterval(this.data.t_time);
  302 + },
  303 + //--滚动到顶部--
  304 + doScrollTop: function() {
  305 + wx.pageScrollTo({
  306 + scrollTop: 0
  307 + });
  308 + },
  309 + //------------加入购物车--------------
  310 + addCart: function(t) {
  311 + var th = this;
  312 + th.add_cart_func(t);
  313 +
  314 + },
  315 + //加入购物的函数
  316 + add_cart_func: function(t) {
  317 + var i = getApp().request;
  318 + if (oo.user_id == null) {
  319 + return s.my_warnning("还未登录!", 0, this);
  320 + }
  321 + var e = this,
  322 + th = e,
  323 + a = 0,
  324 + o = this.data.data;
  325 + a = o.goods_id;
  326 +
  327 + //----------添加到购物车时,要判断限购数量,--------
  328 + e.get_buy_num(o, function(ee) {
  329 + //---判断商品是否超出限购---
  330 + if (th.data.g_buy_num != null && th.data.data.viplimited > 0) {
  331 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.data.goods_id) > th.data.data.viplimited) {
  332 + wx.showModal({
  333 + title: '提示',
  334 + content: '超出商品限购'
  335 + });
  336 + return false;
  337 + }
  338 + }
  339 + //---判断商品是否超出活动限购---
  340 + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
  341 + if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
  342 + wx.showModal({
  343 + title: '提示',
  344 + content: '超出商品活动限购'
  345 + });
  346 + return false;
  347 + }
  348 + }
  349 +
  350 + if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
  351 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  352 + this.setData({
  353 + sto_sele_name: ""
  354 + });
  355 + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  356 +
  357 + //--------------此时操作的数据------------
  358 + var newd = {
  359 + goods_id: o.goods_id,
  360 + goods_num: th.data.goodsInputNum,
  361 + pick_id: th.data.sto_sele_id,
  362 + user_id: oo.user_id,
  363 + store_id: th.data.stoid,
  364 + goods_price: o.shop_price,
  365 + member_goods_price: o.shop_price,
  366 + goods_name: o.goods_name,
  367 + goods_sn: o.goods_sn,
  368 + sku: o.sku,
  369 + prom_type: 5,
  370 + prom_id:o.prom_id
  371 + };
  372 +
  373 + //-----如果是秒杀,团购,积分购,拼团-----
  374 + if (th.data.data.prom_type != 5) {
  375 + return s.my_warnning("商品不是搭配活动!", 0, th);
  376 + }else{
  377 + //---如果是线下门店销售的时候---
  378 + if(th.data.sales_rules==2){
  379 + var pick=th.get_pick_from_list(th.data.sto_sele_id)
  380 + //---通过接口获取门店的线下库存信息--
  381 + getApp().request.get("/api/weshop/goods/getWareStorages",{
  382 + data:{storageNos:pick.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid},
  383 + success:function(res){
  384 + if(res.data.code==0){
  385 + if(res.data.data.pageData.length>0){
  386 + var CanOutQty=res.data.data.pageData[0].CanOutQty;
  387 + if(CanOutQty<e.data.goodsInputNum){
  388 + return s.my_warnning("库存不足!", 0, th);
  389 + }
  390 + //在调一次接口,读取商品的预出库的数量,lock
  391 + getApp().request.get("/api/weshop/order/ware/lock/page",{
  392 + data:{store_id:os.stoid,wareId:th.data.data.goods_id,storageId:pick.pickup_id,pageSize:1000},
  393 + success:function(res_data){
  394 + if(res_data.data.code==0 && res_data.data.data.total>0){
  395 + var lock=0;
  396 + for(var i in res_data.data.data.pageData){
  397 + lock+=res_data.data.data.pageData[i].outQty;
  398 + }
  399 +
  400 + if(CanOutQty<=lock){
  401 + return s.my_warnning("库存不足!", 0, th);
  402 + }
  403 + th.add_cart_next(e,t,a,o,newd,CanOutQty-lock);
  404 + }else{
  405 + th.add_cart_next(e,t,a,o,newd,CanOutQty);
  406 + }
  407 + }
  408 + })
  409 + }else{
  410 + return s.my_warnning("库存不足!", 0, th);
  411 + }
  412 +
  413 + }
  414 + }
  415 + })
  416 + }else{
  417 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  418 + if (o.store_count <e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  419 + th.add_cart_next(e,t,a,o,newd); //加入购物车下一步
  420 + }
  421 + }
  422 + })
  423 + },
  424 +
  425 + //---加入购物车的最后一步---
  426 + add_cart_next(e,t,a,o,newd,CanOutQty){
  427 + var th=this;
  428 + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
  429 + if(o.prom_type!=1 && o.prom_type!=6){
  430 + var conf=th.data.bconfig;
  431 + if (conf.switch_list && getApp().globalData.userInfo['card_field']){
  432 + var s_list=JSON.parse(conf.switch_list);
  433 + var now=ut.gettimestamp();
  434 + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');
  435 + var end = new Date(str);
  436 + end = Date.parse(end) / 1000;
  437 +
  438 + //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--
  439 + if(parseInt(s_list.rank_switch)==2 && end>now){
  440 + var card_price=o[getApp().globalData.userInfo['card_field']];
  441 + //如果会员有等级价
  442 + if(getApp().globalData.userInfo['card_field']!=undefined && getApp().globalData.userInfo['card_field']!=null
  443 + && getApp().globalData.userInfo['card_field']!="" && card_price>0){
  444 + newd.goods_price=card_price;
  445 + }
  446 + }
  447 + }
  448 + }
  449 +
  450 + newd['pick_name'] = th.data.sto_sele_name;
  451 + newd['pick_dis'] = th.data.sto_sele_distr;
  452 + newd["collocation_goods"]=th.data.sele_collocation;
  453 +
  454 + th.buyNow(newd);
  455 +
  456 + },
  457 +
  458 + //----------立即购买-----------
  459 + buyNow: function(e) {
  460 + s.set_b_now(e);
  461 + wx.redirectTo({
  462 + url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
  463 + });
  464 + },
  465 +
  466 + //----------增加购买数量-----------
  467 + addCartNum: function(t) {
  468 + this.checkCartNum(this.data.goodsInputNum + 1);
  469 + },
  470 + //----------减少购买数量-----------
  471 + subCartNum: function(t) {
  472 + this.checkCartNum(this.data.goodsInputNum - 1);
  473 + },
  474 + //----------输入框输入购买数量-----------
  475 + inputCartNum: function(t) {
  476 + this.checkCartNum(Number(t.detail.value));
  477 + },
  478 +
  479 + //------检查数量是不是超出限购------
  480 + checkCartNum: function(t) {
  481 + var th = this;
  482 + this.get_buy_num(this.data.data, async function() {
  483 +
  484 + //--判断商品是否超出限购--
  485 + if (th.data.g_buy_num != null && th.data.data.viplimited > 0) {
  486 +
  487 + var gd_buy_num=th.data.g_buy_num.get(th.data.data.goods_id);
  488 +
  489 + if (t + gd_buy_num > th.data.data.viplimited) {
  490 + wx.showModal({
  491 + title: '超出商品限购',
  492 + });
  493 +
  494 + var num= th.data.data.viplimited-gd_buy_num;
  495 + if(num<0) num=0;
  496 + th.setData({goodsInputNum:num})
  497 + return false;
  498 + }
  499 + }
  500 +
  501 + //--判断商品是否超出活动限购--
  502 + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
  503 + if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
  504 + wx.showModal({
  505 + title: '超出商品活动限购',
  506 + });
  507 +
  508 + var num=th.data.prom_buy_limit- th.data.prom_buy_num ;
  509 + if(num<0) num=0;
  510 + th.setData({goodsInputNum:num})
  511 + return false;
  512 + }
  513 + }
  514 +
  515 + if (th.data.data.prom_type == 1 || th.data.data.prom_type == 6) {
  516 + var redis_num = 0;
  517 + //------判断活动是否抢光-----
  518 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  519 + os.stoid + "/" + th.data.data.prom_type + "/" + th.data.data.prom_id, {
  520 + 1: 1
  521 + }).then(res => {
  522 + redis_num = res.data.data;
  523 + });
  524 +
  525 + if (t > redis_num) {
  526 + wx.showModal({
  527 + title: '超出商品活动库存',
  528 + });
  529 + th.setData({goodsInputNum:redis_num})
  530 + return false;
  531 + }
  532 +
  533 + }
  534 +
  535 + var e = th.data.data.store_count;
  536 + if(th.data.sales_rules==2){
  537 + if(!th.data.def_pick_store){
  538 + wx.showModal({ title: '请选择门店', });
  539 + return false;
  540 + }else{
  541 + e=th.data.def_pick_store.CanOutQty;
  542 + }
  543 + }
  544 +
  545 + //库存不足,不增加
  546 + if(e<t){ wx.showModal({ title: '库存不足', });
  547 + if(e<0) e=0;
  548 + th.setData({ goodsInputNum: e }); return false;
  549 + }
  550 + t > e || 0 == e ? t = e : t < 1 && (t = 1);
  551 + th.setData({ goodsInputNum: t });
  552 +
  553 + })
  554 + },
  555 +
  556 + closeSpecModal: function() {
  557 + var th=this;
  558 + this.setData({
  559 + openSpecModal: !1,
  560 + openSpecModal_pt: !1
  561 + });
  562 + },
  563 + openSpecModel: function(t) {
  564 + var th = this;
  565 + this.setData({
  566 + store: 0,
  567 + choice_sort_store: 0,
  568 + sort_store: 0,
  569 + })
  570 + //--先判断会员状态--
  571 + var user_info = getApp().globalData.userInfo;
  572 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  573 + wx.navigateTo({
  574 + url: '/pages/getphone/getphone',
  575 + })
  576 + return false;
  577 + }
  578 +
  579 + var collocationList=this.data.collocationList;
  580 + this.data.sele_collocation=null;
  581 + for(var i in collocationList){
  582 + if(collocationList[i].sele){
  583 + collocationList[i].goods_num=1;
  584 + collocationList[i].prom_type=5;
  585 + collocationList[i].prom_id=th.data.data.prom_id;
  586 + collocationList[i].goods_price=collocationList[i].price;
  587 + collocationList[i].is_collocation=1;
  588 + if(!th.data.sele_collocation) th.data.sele_collocation=new Array();
  589 + th.data.sele_collocation.push(collocationList[i]);
  590 + }
  591 + }
  592 + if(!th.data.sele_collocation){
  593 + return s.my_warnning("请选择搭配商品!", 0, th);
  594 + }
  595 +
  596 +
  597 + this.setData({
  598 + openSpecModal: !0,
  599 + });
  600 + },
  601 + closePromModal: function() {
  602 + this.setData({
  603 + openPromModal: !1
  604 + });
  605 + },
  606 +
  607 + openPromModal: function() {
  608 + this.setData({
  609 + openPromModal: !0
  610 + });
  611 + },
  612 +
  613 + //--点击分享事件---
  614 + onShareAppMessage: function(t) {
  615 + var th = this;
  616 + var price = th.data.data.shop_price;
  617 + if (th.data.prom_act) {
  618 + price = th.data.prom_act.price;
  619 + }
  620 + var title= th.data.data.goods_name;
  621 + var img=th.data.data.original_img;
  622 + if(th.data.prom_type==6){
  623 + title=th.data.prom_act.share_title;
  624 + img=th.data.iurl+th.data.prom_act.share_imgurl;
  625 + }
  626 +
  627 + return {
  628 + title: price + "元 " +title,
  629 + path: "/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid,
  630 + imageUrl: img,
  631 + }
  632 +
  633 + },
  634 +
  635 + //-----图片失败,默认图片-----
  636 + bind_bnerr: function(e) {
  637 + var _errImg = e.target.dataset.errorimg;
  638 + var _errObj = {};
  639 + _errObj[_errImg] = this.data.iurl + "/miniapp/images/default_g_img.gif";
  640 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  641 + },
  642 +
  643 + //-----图片失败,默认图片-----
  644 + bind_bnerr2: function(e) {
  645 +
  646 + var _errImg = e.target.dataset.errorimg;
  647 + var _errObj = {};
  648 + _errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png"
  649 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  650 + },
  651 +
  652 + //---------拿出门店分类和门店------------
  653 + get_sto(e) {
  654 + var th = this,that=this;
  655 + var timer_get = setInterval(function() {
  656 + if (th.data.is_get_local_ok == 0) return false;
  657 + var dd = null,
  658 + i = getApp().request;
  659 + var g_distr_type = th.data.data.distr_type;
  660 + if (g_distr_type != 0) {
  661 + dd = {
  662 + store_id: o.stoid,
  663 + distr_type: g_distr_type,
  664 + isstop: 0,
  665 + pageSize: 2000
  666 + }
  667 + } else {
  668 + dd = {
  669 + store_id: o.stoid,
  670 + isstop: 0,
  671 + pageSize: 2000
  672 + }
  673 + }
  674 + //如果有距离的话
  675 + if (th.data.lat != null) {
  676 + dd.lat = th.data.lat;
  677 + dd.lon = th.data.lon;
  678 + }
  679 + clearInterval(timer_get);
  680 + //----------获取门店----------------
  681 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  682 + data: dd,
  683 + }).then(res => {
  684 + var e = res;
  685 + if (e.data.code == 0) {
  686 +
  687 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  688 + if(dd.lat && !th.data.def_pick_store && th.data.bconfig.is_sort_storage){
  689 + th.setData({
  690 + def_pick_store:e.data.data.pageData[0],
  691 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  692 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  693 + sto_sele_distr: e.data.data.pageData[0].distr_type
  694 + });
  695 + th.data.fir_def_store=e.data.data.pageData[0];
  696 + }
  697 +
  698 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
  699 + if (th.data.def_pick_store) {
  700 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  701 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  702 + e.data.data.pageData.splice(k, 1); //删除
  703 + break;
  704 + }
  705 + }
  706 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  707 + }
  708 +
  709 +
  710 + th.setData({all_pick_list:e.data.data.pageData});
  711 +
  712 + //--获取线下库存,而且不是新的门店规则,同时不能是活动--
  713 + if(th.data.sales_rules==2 && !th.data.is_newsales_rules && th.data.prom_type!=1 && th.data.prom_type!=6){
  714 + setTimeout(function(){
  715 + th.deal_pickup_dline(e);
  716 + },800)
  717 + }else{
  718 + setTimeout(function(){
  719 + th.deal_pickup(e); //--普通门店排版--
  720 + },800)
  721 + }
  722 + }
  723 + })
  724 + }, 200)
  725 + },
  726 +
  727 + //------------处理门店---------------
  728 + deal_pickup(e){
  729 + var th=this;
  730 + //单总量超出5个的时候
  731 + if (e.data.data.total > 5) {
  732 + getApp().request.get("/api/weshop/storagecategory/page", {
  733 + data: {
  734 + store_id: o.stoid,
  735 + is_show: 1,
  736 + pageSize: 1000
  737 + },
  738 + success: function(ee) {
  739 + if (ee.data.code == 0) {
  740 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  741 + var def_arr = new Array();
  742 + var ishas = 0;
  743 + //-- 开始就看5个门店 --
  744 + for (var k = 0; k < 5; k++) {
  745 + if (k == e.data.data.pageData.length) break;
  746 + def_arr.push(e.data.data.pageData[k]);
  747 + }
  748 +
  749 + th.setData({
  750 + def_pickpu_list: def_arr,
  751 + pickpu_list: ee.data.data.pageData
  752 + });
  753 + var sto_cate = ee.data.data.pageData;
  754 + var sto_arr = e.data.data.pageData;
  755 + var newarr = new Array();
  756 + var qita = new Array();
  757 +
  758 + //----要进行门店分组--------
  759 + for (var i = 0; i < sto_arr.length; i++) {
  760 + //找一下这个门店有没有在分类数组内
  761 + var find2 = 0,
  762 + find2name = "";
  763 + for (var m = 0; m < sto_cate.length; m++) {
  764 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  765 + find2 = sto_cate[m].cat_id;
  766 + find2name = sto_cate[m].cat_name;
  767 + break;
  768 + }
  769 + }
  770 +
  771 + if (newarr.length > 0) {
  772 + var find = 0;
  773 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  774 + if (find2 != 0) {
  775 + for (var ii = 0; ii < newarr.length; ii++) {
  776 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  777 + newarr[ii].s_arr.push(sto_arr[i]);
  778 + find = 1;
  779 + break;
  780 + }
  781 + }
  782 + if (find == 0) {
  783 + var arr0 = new Array();
  784 + arr0.push(sto_arr[i]);
  785 + var item = {
  786 + cat_id: find2,
  787 + name: find2name,
  788 + s_arr: arr0
  789 + };
  790 + newarr.push(item);
  791 + }
  792 + } else {
  793 + qita.push(sto_arr[i]);
  794 + }
  795 + } else {
  796 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  797 + if (find2 != 0) {
  798 + var arr0 = new Array();
  799 + arr0.push(sto_arr[i]);
  800 + var item = {
  801 + cat_id: find2,
  802 + name: find2name,
  803 + s_arr: arr0
  804 + };
  805 + newarr.push(item);
  806 + } else {
  807 + qita.push(sto_arr[i]);
  808 + }
  809 + }
  810 + }
  811 +
  812 + //----安排其他的分类-----
  813 + if (qita.length > 0) {
  814 + var item = {
  815 + cat_id: -1,
  816 + name: "其他",
  817 + s_arr: qita
  818 + };
  819 + newarr.push(item);
  820 + }
  821 + th.setData({
  822 + is_show_sto_cat: 1,
  823 + all_sto: newarr
  824 + });
  825 +
  826 + } else {
  827 + th.setData({
  828 + is_show_sto_cat: -1,
  829 + only_pk: e.data.data.pageData
  830 + });
  831 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  832 + if (!th.data.def_pick_store) {
  833 + th.setData({def_pick_store:e.data.data.pageData[0]})
  834 + }
  835 + }
  836 + } else {
  837 + th.setData({
  838 + is_show_sto_cat: -1,
  839 + only_pk: e.data.data.pageData
  840 + });
  841 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  842 + if (!th.data.def_pick_store) {
  843 + th.setData({def_pick_store:e.data.data.pageData[0]})
  844 + }
  845 +
  846 + }
  847 + }
  848 + });
  849 + } else {
  850 + th.setData({
  851 + is_show_sto_cat: 0,
  852 + only_pk: e.data.data.pageData
  853 + });
  854 + //-----如果没有默认门店,要取第一个门店作为默认店------
  855 + if (!th.data.def_pick_store && th.data.bconfig.is_sort_storage) {
  856 + th.setData({
  857 + def_pick_store:e.data.data.pageData[0],
  858 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  859 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  860 + sto_sele_distr: e.data.data.pageData[0].distr_type
  861 + })
  862 + }
  863 + }
  864 +
  865 + },
  866 + //------------处理线下门店库存--------
  867 + deal_pickup_dline(e){
  868 + var pkno=[],th=this;
  869 + if(this.data.def_pick_store){
  870 + pkno.push(this.data.def_pick_store.pickup_no);
  871 + }
  872 + for(var i in e.data.data.pageData){
  873 + var item=e.data.data.pageData[i];
  874 + if(pkno.indexOf(item.pickup_no)<0)
  875 + pkno.push(item.pickup_no);
  876 + }
  877 + var pkno_str=pkno.join(",");
  878 + var o_plist=e.data.data.pageData;
  879 + var new_list=[];
  880 + var is_find_def_store=0;
  881 +
  882 + var lock=[];
  883 + //先读取门店的lock,采用链式写法,少用await
  884 + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  885 + data:{store_id:os.stoid,wareId:th.data.data.goods_id,pageSize:1000}
  886 + }).then(res=>{
  887 + if(res.data.code==0 && res.data.data.total>0){
  888 + lock=res.data.data.pageData
  889 + }
  890 + //---通过接口获取门店的线下库存信息--
  891 + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  892 + data:{storageNos:pkno_str,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid}
  893 + })
  894 + }).then(res=>{
  895 + if(res.data.code==0){
  896 + if(res.data.data.pageData){
  897 + var plist=res.data.data.pageData;
  898 + var def_pick_store=th.data.def_pick_store;
  899 + //以原来的数组为外循环,保证距离的顺序
  900 + for(var kk in o_plist){
  901 + for(var ii in plist){
  902 + //线下的门店小心
  903 + var n_item=plist[ii];
  904 + if(n_item.StorageNo==o_plist[kk].pickup_no){
  905 +
  906 + //拿到锁库的数量
  907 + var lock_num=th.find_lock_num(o_plist[kk].pickup_id,lock);
  908 + //可出库数大于预出库库存的数量,可以判断为有库存
  909 + if(n_item.CanOutQty>lock_num){
  910 + o_plist[kk].CanOutQty=n_item.CanOutQty-lock_num;
  911 + new_list.push(o_plist[kk]);
  912 + //如果找到默认门店
  913 + if(th.data.fir_def_store && n_item.StorageNo==th.data.fir_def_store.pickup_no){
  914 + th.data.fir_def_store.CanOutQty=n_item.CanOutQty-lock_num;
  915 + if(def_pick_store.pickup_id==th.data.fir_def_store.pickup_id)
  916 + th.setData({def_pick_store:th.data.fir_def_store})
  917 + is_find_def_store=1;
  918 + }
  919 + }
  920 + break;
  921 + }
  922 + }
  923 + }
  924 +
  925 + //数据组装下
  926 + var em={};em.data={};em.data.data={};
  927 + em.data.data.total=new_list.length;
  928 + em.data.data.pageData=new_list;
  929 +
  930 + if(th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id){
  931 + th.data.fir_def_store.CanOutQty=0;
  932 + //--当选择的门店是客户默认的门店的时候--
  933 + if(th.data.def_pick_store && th.data.fir_def_store.pickup_id==th.data.def_pick_store.pickup_id) {
  934 + th.setData({def_pick_store:th.data.fir_def_store});
  935 + em.data.data.pageData.unshift(th.data.def_pick_store);
  936 + }else{
  937 + em.data.data.pageData.splice(1,0,th.data.fir_def_store);
  938 + }
  939 + }
  940 +
  941 + //---把数组组装进去---
  942 + th.deal_pickup(em);
  943 + }else{
  944 + th.setData({def_pick_store:null,all_sto:null,only_pk:null})
  945 + }
  946 + }else{
  947 + th.setData({def_pick_store:null,all_sto:null,only_pk:null})
  948 + }
  949 + })
  950 + },
  951 +
  952 + find_lock_num(pick_id,lock){
  953 + var lock_num=0;
  954 + if(!lock) return 0;
  955 + if(lock.length<0) return 0;
  956 + for(var i in lock){
  957 + if(pick_id==lock[i].pickupId){
  958 + lock_num+=lock[i].outQty;
  959 + }
  960 + }
  961 + return lock_num;
  962 + },
  963 +
  964 + //----------取货门店被点击的效果------
  965 + getmendian: function(t) {
  966 + this.setData({
  967 + ismend: 1,
  968 + });
  969 + },
  970 + //----------隐藏取货门店,选取门店----------
  971 + hidemend: function(e) {
  972 + var pid = e.target.dataset.p_id;
  973 + var pname = e.target.dataset.p_name;
  974 + var p_distr_t = e.target.dataset.p_dis;
  975 + this.setData({
  976 + ismend: 0,
  977 + is_sec_mend: 0,
  978 + sto_sele_id: pid,
  979 + sto_sele_name: pname,
  980 + sto_sele_distr: p_distr_t
  981 + });
  982 + },
  983 + //------显示取货2级----------
  984 + show_sec: function(t) {
  985 + var index = t.target.dataset.index;
  986 + var item = this.data.all_sto[index];
  987 + this.setData({
  988 + is_sec_mend: 1,
  989 + sec_sto: item
  990 + });
  991 + },
  992 + //------隐藏取货门店2级----
  993 + hide_sec_mend: function() {
  994 + this.setData({
  995 + is_sec_mend: 0,
  996 + });
  997 + },
  998 +
  999 + //加载更多是靠这个函数
  1000 + onReachBottom: function() {
  1001 +
  1002 + },
  1003 + //--------检查是搭配促销活动是不是结束-------
  1004 + async check_prom(gid, prom_type, prom_id) {
  1005 +
  1006 + },
  1007 +
  1008 + //-------------获取购买数量的总函数----------------
  1009 + get_buy_num: function(gd, func) {
  1010 + var map = this.data.g_buy_num,
  1011 + th = this,
  1012 + user_id = getApp().globalData.user_id;
  1013 + if (user_id == null) {
  1014 + map.set(gd.goods_id, 0);
  1015 + th.setData({
  1016 + g_buy_num: map,
  1017 + prom_buy_num: 0,
  1018 + });
  1019 + "function" == typeof func && func();
  1020 + return false;
  1021 + }
  1022 +
  1023 + if (map.has(gd.goods_id)) {
  1024 + "function" == typeof func && func();
  1025 + } else {
  1026 + //----获取商品购买数----
  1027 + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1028 + data: {
  1029 + store_id: os.stoid,
  1030 + user_id: user_id,
  1031 + goods_id: gd.goods_id
  1032 + },
  1033 + success: function(t) {
  1034 + if (t.data.code == 0) {
  1035 + var g_buy_num = t.data.data.goodsbuynum;
  1036 + if (gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6) {
  1037 + //----获取活动购买数----
  1038 + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1039 + data: {
  1040 + store_id: os.stoid,
  1041 + user_id: user_id,
  1042 + goods_id: gd.goods_id,
  1043 + prom_type: gd.prom_type,
  1044 + prom_id: gd.prom_id
  1045 + },
  1046 + //-----获取-----
  1047 + success: function(tt) {
  1048 + if (tt.data.code == 0) {
  1049 + map.set(gd.goods_id, g_buy_num);
  1050 + th.setData({
  1051 + g_buy_num: map,
  1052 + prom_buy_num: tt.data.data.goodsbuynum,
  1053 + });
  1054 + "function" == typeof func && func();
  1055 + }
  1056 + }
  1057 + });
  1058 + } else {
  1059 + map.set(gd.goods_id, g_buy_num);
  1060 + th.setData({
  1061 + g_buy_num: map
  1062 + });
  1063 + "function" == typeof func && func();
  1064 + }
  1065 + }
  1066 + }
  1067 + });
  1068 + }
  1069 + },
  1070 +
  1071 + //--跳转到商品详情页面--
  1072 + go_goods: function(e) {
  1073 + var gid = e.currentTarget.dataset.gid;
  1074 + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
  1075 + getApp().goto(url);
  1076 + },
  1077 +
  1078 + // 选择门店
  1079 + choice_store: function(ee) {
  1080 + var th = this;
  1081 + var ind=ee.currentTarget.dataset.ind;
  1082 + var bconfig = th.data.bconfig;
  1083 +
  1084 + if(!th.data.only_pk && !th.data.def_pickpu_list){
  1085 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1086 + return false;
  1087 + }
  1088 +
  1089 + if(th.data.only_pk && !th.data.only_pk.length){
  1090 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1091 + return false;
  1092 + }
  1093 + if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){
  1094 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1095 + return false;
  1096 + }
  1097 +
  1098 +
  1099 + if (bconfig.is_sort_storage) {
  1100 + wx.getLocation({
  1101 + type: 'wgs84',
  1102 + success: function(res) {
  1103 +
  1104 + th.data.lat = res.latitude;
  1105 + th.data.lon = res.longitude;
  1106 + th.data.is_get_local_ok = 1;
  1107 + th.setData({
  1108 + is_gps: 1
  1109 + });
  1110 + //th.onShow();
  1111 + //th.get_sto();
  1112 + },
  1113 + fail: function(res) {
  1114 + //th.onShow();
  1115 + th.data.is_get_local_ok = 1;
  1116 + th.get_sto();
  1117 + if (res.errCode == 2) {
  1118 + th.setData({
  1119 + is_gps: 0
  1120 + });
  1121 + if (th.data.is_gps == 0) {
  1122 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  1123 + }
  1124 + } else {
  1125 + th.setData({
  1126 + is_gps: "3"
  1127 + });
  1128 + }
  1129 +
  1130 + }
  1131 + })
  1132 + }else{
  1133 + th.data.is_get_local_ok = 1;
  1134 + }
  1135 +
  1136 + if(ind!=undefined && ind!=null ){
  1137 + this.setData({
  1138 + open_ind_store: ind,
  1139 + store: 1,
  1140 + openSpecModal: !1,
  1141 + openSpecModal_pt: !1
  1142 + })
  1143 + }else{
  1144 + this.setData({
  1145 + store: 1,
  1146 + openSpecModal: !1,
  1147 + openSpecModal_pt: !1
  1148 + })
  1149 + }
  1150 + },
  1151 + //关闭选择门店
  1152 + close_popup: function(e) {
  1153 + var th=this;
  1154 + this.setData({
  1155 + store: 0,
  1156 + choice_sort_store: 0,
  1157 + sort_store: 0,
  1158 + fir_pick_index:0,
  1159 + sec_pick_index:0
  1160 + })
  1161 +
  1162 + var openindstore=this.data.open_ind_store;
  1163 + if (openindstore == 1) {
  1164 + th.setData({
  1165 + openSpecModal: !0,
  1166 + openSpecModal_ind: openindstore,
  1167 + });
  1168 + } else if (openindstore == 2) {
  1169 + th.setData({
  1170 + openSpecModal: !0,
  1171 + openSpecModal_ind: openindstore,
  1172 + });
  1173 + }
  1174 + else if (openindstore == 4) { //4就是拼团
  1175 + th.setData({
  1176 + openSpecModal_pt: 1, //打开拼团购买界面
  1177 + store: 0, //关闭门店
  1178 + choice_sort_store: 0, //关闭门店2级
  1179 + sort_store: 0, //关闭门店2级
  1180 + });
  1181 + }
  1182 + else {
  1183 + th.setData({
  1184 + store: 0,
  1185 + choice_sort_store: 0,
  1186 + sort_store: 0
  1187 + })
  1188 + }
  1189 +
  1190 + },
  1191 +
  1192 + //选择更多门店
  1193 + more_store: function() {
  1194 + this.setData({
  1195 + sort_store: 1
  1196 + });
  1197 + },
  1198 +
  1199 + //---选择分类门店---
  1200 + choice_sort_store: function(e) {
  1201 + var index = e.currentTarget.dataset.index;
  1202 + var region_name = e.currentTarget.dataset.region;
  1203 + var item = this.data.all_sto[index];
  1204 + this.setData({
  1205 + region_name: region_name,
  1206 + sort_store: 0,
  1207 + choice_sort_store: 1,
  1208 + sec_sto: item,
  1209 + sec_pick_index: 0
  1210 + });
  1211 + },
  1212 +
  1213 + choose_for_store_fir: function(e) {
  1214 + var index_c = e.currentTarget.dataset.ind;
  1215 + var th=this;
  1216 + th.setData({
  1217 + fir_pick_index: index_c
  1218 + })
  1219 +
  1220 + },
  1221 +
  1222 + //如果开启线下库存,已经急速库存才会使用
  1223 + async check_the_pick(item,func){
  1224 + var th=this;
  1225 + var goodsinfo=th.data.data;
  1226 + var erpwareid=goodsinfo.erpwareid;
  1227 + var plist=null;
  1228 + var lock=0;
  1229 +
  1230 + //---如果是活动的时候---
  1231 + if(th.data.prom_type==1 || th.data.prom_type==6){
  1232 + func(); return false;
  1233 + }
  1234 +
  1235 + if(this.data.sales_rules!=2){
  1236 + func();
  1237 + }else{
  1238 +
  1239 + //先读取门店的lock
  1240 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  1241 + data:{store_id:os.stoid,wareId:goodsinfo.goods_id,storageId:item.pickup_id,pageSize:1000}
  1242 + }).then(res=>{
  1243 + if(res.data.code==0 && res.data.data.total>0){
  1244 + for(var i in res.data.data.pageData )
  1245 + lock+=res.data.data.pageData[i].outQty;
  1246 + }
  1247 + })
  1248 + //读取线下的门店库存
  1249 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  1250 + data:{storageNos:item.pickup_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid}
  1251 + }).then(res=>{
  1252 + if(res.data.code==0 && res.data.data.total>0){
  1253 + plist=res.data.data.pageData[0];
  1254 + }
  1255 + })
  1256 +
  1257 + if(plist && plist.CanOutQty-lock>0){
  1258 + item.CanOutQty=plist.CanOutQty-lock;
  1259 + func();
  1260 + return false;
  1261 + }
  1262 + getApp().my_warnning(item.pickup_name+"库存不足!", 0, th);
  1263 +
  1264 + }
  1265 + },
  1266 +
  1267 + //确定def_pick为选择的门店
  1268 + sure_pick: function(e) {
  1269 + var th = this;
  1270 + var item = null;
  1271 + var openindstore = th.data.open_ind_store;
  1272 +
  1273 + if (th.data.choice_sort_store == 0) {
  1274 + var index = th.data.fir_pick_index;
  1275 + if (th.data.is_show_sto_cat == 1) {
  1276 + item = th.data.def_pickpu_list[index];
  1277 + } else {
  1278 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1279 + }
  1280 +
  1281 + } else {
  1282 + var index = th.data.sec_pick_index;
  1283 + item = th.data.sec_sto.s_arr[index];
  1284 + }
  1285 +
  1286 + //--回调函数的用法--
  1287 + th.check_the_pick(item,function(){
  1288 + th.setData({
  1289 + def_pick_store: item,
  1290 + sto_sele_name: item.pickup_name,
  1291 + sto_sele_id: item.pickup_id,
  1292 + sto_sele_distr: item.distr_type,
  1293 + store: 0,
  1294 + choice_sort_store: 0,
  1295 + fir_pick_index: 0
  1296 + });
  1297 +
  1298 + if (openindstore == 1) {
  1299 + th.setData({
  1300 + openSpecModal: !0,
  1301 + openSpecModal_ind: openindstore,
  1302 + });
  1303 + } else if (openindstore == 2) {
  1304 + th.setData({
  1305 + openSpecModal: !0,
  1306 + openSpecModal_ind: openindstore,
  1307 + });
  1308 + }
  1309 + else if (openindstore == 4) { //4就是拼团
  1310 + th.setData({
  1311 + openSpecModal_pt: 1, //打开拼团购买界面
  1312 + store: 0, //关闭门店
  1313 + choice_sort_store: 0, //关闭门店2级
  1314 + sort_store: 0, //关闭门店2级
  1315 + });
  1316 + }
  1317 + else {
  1318 + th.setData({
  1319 + store: 0,
  1320 + choice_sort_store: 0,
  1321 + sort_store: 0
  1322 + })
  1323 + }
  1324 + })
  1325 + },
  1326 + //---点击二级之后的选择---
  1327 + choose_for_store: function(e) {
  1328 + var index_c = e.currentTarget.dataset.ind;
  1329 + var th=this;
  1330 + th.setData({
  1331 + sec_pick_index: index_c,
  1332 + fir_pick_index: index_c
  1333 + })
  1334 + },
  1335 +
  1336 + //把选择的门店设置成默认的门店def_pick
  1337 + set_def_pick: function(e) {
  1338 + var th = this;
  1339 + var item = null;
  1340 + if (th.data.choice_sort_store == 0) {
  1341 + var index = th.data.fir_pick_index;
  1342 + if (th.data.is_show_sto_cat == 1) {
  1343 + item = th.data.def_pickpu_list[index];
  1344 + } else {
  1345 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1346 + }
  1347 + } else {
  1348 + var index = th.data.sec_pick_index;
  1349 + item = th.data.sec_sto.s_arr[index];
  1350 + }
  1351 +
  1352 + //先设置之前,要判断是不是有库存
  1353 + th.check_the_pick(item,function(){
  1354 + var store_id = o.stoid;
  1355 + var user_id = getApp().globalData.user_id;
  1356 + var def_pickup_id = item.pickup_id;
  1357 +
  1358 + getApp().request.put('/api/weshop/users/update', {
  1359 + data: {
  1360 + user_id,
  1361 + def_pickup_id
  1362 + },
  1363 + success: function(res) {
  1364 + if (res.data.code == 0) {
  1365 + if (th.data.choice_sort_store == 0) th.setData({
  1366 + fir_pick_index: 0
  1367 + });
  1368 + getApp().globalData.pk_store = item;
  1369 + } else {
  1370 + //s.showWarning("设置默认门店地址失败", null, 500, !1);
  1371 + getApp().my_warnning("设置默认门店地址失败",0,th)
  1372 + }
  1373 +
  1374 + }
  1375 + });
  1376 +
  1377 + th.setData({
  1378 + def_pick_store: item,
  1379 + sto_sele_name: item.pickup_name,
  1380 + sto_sele_id: item.pickup_id,
  1381 + sto_sele_distr: item.distr_type,
  1382 + store: 0,
  1383 + choice_sort_store: 0
  1384 + });
  1385 +
  1386 + var openindstore = th.data.open_ind_store;
  1387 + if (openindstore == 1) {
  1388 + th.setData({
  1389 + openSpecModal: !0,
  1390 + openSpecModal_ind: openindstore,
  1391 + store: 0,
  1392 + choice_sort_store: 0,
  1393 + sort_store: 0,
  1394 + });
  1395 + } else if (openindstore == 2) {
  1396 + th.setData({
  1397 + openSpecModal: !0,
  1398 + openSpecModal_ind: openindstore,
  1399 + store: 0,
  1400 + choice_sort_store: 0,
  1401 + sort_store: 0,
  1402 + });
  1403 + }
  1404 + else if (openindstore == 4) { //4就是拼团
  1405 + th.setData({
  1406 + openSpecModal_pt: 1, //打开拼团购买界面
  1407 + store: 0, //关闭门店
  1408 + choice_sort_store: 0, //关闭门店2级
  1409 + sort_store: 0, //关闭门店2级
  1410 + });
  1411 + }
  1412 +
  1413 + else {
  1414 + th.setData({
  1415 + store: 0,
  1416 + choice_sort_store: 0,
  1417 + sort_store: 0,
  1418 + })
  1419 + }
  1420 + })
  1421 + },
  1422 +
  1423 + wait_for_store_config: function() {
  1424 + var th = this;
  1425 + th.data.t_time = setInterval(function() {
  1426 + if (th.data.bconfig == null) false;
  1427 + var e = th.data.bconfig;
  1428 + if (e.is_sort_storage) {
  1429 + wx.getLocation({
  1430 + type: 'wgs84',
  1431 + success: function(res) {
  1432 + th.data.lat = res.latitude;
  1433 + th.data.lon = res.longitude;
  1434 + th.data.is_get_local_ok = 1;
  1435 + },
  1436 + fail: function(res) {
  1437 + if (res.errCode == 2) {
  1438 + th.setData({
  1439 + is_gps: 0
  1440 + });
  1441 + if (th.data.is_gps == 0) {
  1442 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  1443 + }
  1444 +
  1445 + } else {
  1446 + th.setData({
  1447 + is_gps: "3"
  1448 + });
  1449 + }
  1450 + th.data.is_get_local_ok = 1;
  1451 + }
  1452 + })
  1453 + } else {
  1454 + th.data.is_get_local_ok = 1;
  1455 + }
  1456 + clearInterval(th.data.t_time);
  1457 + }, 500)
  1458 + },
  1459 +
  1460 + //-- 根据ID拿出门店 --
  1461 + get_pick_from_list(pid){
  1462 + var all_pick_list=this.data.all_pick_list;
  1463 + for(var i in all_pick_list){
  1464 + var item=all_pick_list[i];
  1465 + if(item.pickup_id==pid){
  1466 + return item;
  1467 + }
  1468 + }
  1469 + },
  1470 +
  1471 + //--- 获取卡类列表 ---
  1472 + getPlusCardType: function (func) {
  1473 + var storid = os.stoid;
  1474 + var th = this;
  1475 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  1476 + var plusCard = res.data.data;
  1477 + var arr = [1219, 2089, 3031];
  1478 + var new_arr = new Array();
  1479 + var card_name_map=new Map();
  1480 + for (var i = 0; i < plusCard.length; i++) {
  1481 + var name="card"+plusCard[i].CorrPrice.toLowerCase();
  1482 + card_name_map.set(name,plusCard[i].CardName);
  1483 + }
  1484 +
  1485 + var ob={"card_list":plusCard,"name_map":card_name_map};
  1486 + func(ob);
  1487 + })
  1488 + },
  1489 +
  1490 + //递归获取商品
  1491 + loop_promise:function(x,arr,func){
  1492 + var th=this;
  1493 + getApp().request.promiseGet("/api/weshop/goods/get/" + o.stoid + "/" + arr[x].goods_id, {}).then(res => {
  1494 + arr[x].goods_spec=res.data.data.goods_spec;
  1495 + arr[x].goods_color=res.data.data.goods_color;
  1496 + arr[x].original_img=res.data.data.original_img;
  1497 + arr[x].shop_price=res.data.data.shop_price;
  1498 + if(x==arr.length-1){
  1499 + func(arr); //循环再最后
  1500 + }else{
  1501 + ++x;
  1502 + th.loop_promise(x,arr,func);
  1503 + }
  1504 + })
  1505 + },
  1506 +
  1507 + //图片失败,默认图片
  1508 + bind_bnerr3: function(e) {
  1509 + var _errImg = e.target.dataset.errorimg;
  1510 + var _errObj = {};
  1511 + _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
  1512 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  1513 + },
  1514 +
  1515 + set_sele:function (e) {
  1516 + var index=e.currentTarget.dataset.ind;
  1517 + var set=e.currentTarget.dataset.set;
  1518 + var text="collocationList["+index+"].sele";
  1519 + var ob={};
  1520 + ob[text]= parseInt(set);
  1521 + this.setData(ob);
  1522 +
  1523 + var price=parseFloat(this.data.collocationList[index].price);
  1524 + var cut_pirce=this.data.collocationList[index].shop_price-price;
  1525 + if(set==1){
  1526 + this.data.dp_price=parseFloat(this.data.dp_price)+price;
  1527 + this.data.cut_price=this.data.cut_price+cut_pirce;
  1528 + }else{
  1529 + this.data.dp_price=parseFloat(this.data.dp_price)-price;
  1530 + this.data.cut_price=this.data.cut_price-cut_pirce;
  1531 + }
  1532 + price=price.toFixed(2);
  1533 + cut_pirce=cut_pirce.toFixed(2);
  1534 + this.setData({dp_price: this.data.dp_price,cut_price:this.data.cut_price});
  1535 + }
  1536 +
  1537 +
  1538 +
  1539 +});
... ...
packageA/pages/prom_list/prom_list.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "搭配促销商品",
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "nav_box": "/components/nav_box/nav_box",
  6 + "warn": "/components/long_warn/long_warn"
  7 + }
  8 +}
0 9 \ No newline at end of file
... ...
packageA/pages/prom_list/prom_list.wxml 0 → 100644
  1 +<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
  2 +<wxs module="g_filters" src="g_filter.wxs"></wxs>
  3 +<wxs module="tool" src="filter.wxs"></wxs>
  4 +
  5 +<view class="head" style="font-size: 34rpx">搭配商品</view>
  6 +<view class="goods_list" wx:if="{{data && data.goods_name}}">
  7 + <view class="item flex ai-center">
  8 + <view style="width:80rpx;height: 100%" class="flex ai-center jc-center"><icon type="success" size="18"></icon></view>
  9 + <view class="r_box flex">
  10 + <view><image class="r_box_img" src="{{data.original_img}}"></image></view>
  11 + <view class="flex jc_sb">
  12 + <view class="fs30" style="margin: 18rpx">
  13 + <view>{{data.goods_name}}</view>
  14 + <view>规格:{{tool.get_guige(data.goods_spec,data.goods_color)}}</view>
  15 + <view>¥{{data.shop_price}}</view>
  16 + </view>
  17 + <view></view>
  18 + </view>
  19 + </view>
  20 + </view>
  21 +
  22 + <!-- 搭配的商品 -->
  23 + <view class="item flex ai-center" wx:for="{{collocationList}}">
  24 + <view style="width:80rpx;height: 100%" class="flex ai-center jc-center">
  25 + <icon bindtap="set_sele" wx:if="{{item.sele}}" data-ind="{{index}}" data-set="0" type="success" size="18"></icon>
  26 + <icon bindtap="set_sele" wx:else data-ind="{{index}}" data-set="1" type="success" size="18" color="#adadad"></icon>
  27 +
  28 + </view>
  29 + <view class="r_box flex">
  30 + <view><image class="r_box_img" src="{{iurl+item.original_img}}" binderror="bind_bnerr3" data-errorimg="collocationList[{{index}}].original_img"></image></view>
  31 + <view class="flex jc_sb">
  32 + <view class="fs30" style="margin: 18rpx">
  33 + <view>{{item.goods_name}}</view>
  34 + <view>规格:{{tool.get_guige(item.goods_spec,item.goods_color)}}</view>
  35 + <view>¥{{item.price}}</view>
  36 + </view>
  37 + <view></view>
  38 + </view>
  39 + </view>
  40 + </view>
  41 +
  42 +</view>
  43 +
  44 +<!-------------------底部按钮-------------------->
  45 +<view class="join-cart jc_sb ai-center fs30">
  46 + <!-- 左边 -->
  47 + <view style="text-align: left; padding-left: 20rpx">
  48 + <view class="co-red"><text class="f_hei">搭配价</text>¥{{filters.toFix(data.shop_price+dp_price,2)}}</view>
  49 + <view class="co-red"><text class="f_hei">已省</text>¥{{filters.toFix(cut_price,2)}}</view>
  50 + </view>
  51 + <!-- 右边 -->
  52 + <view bindtap="openSpecModel" class="buy_btn ">立即购买</view>
  53 +</view>
  54 +
  55 +<!----弹起来,选择规格数量,普通商品购买和秒杀------>
  56 +<view hidden="{{!openSpecModal}}">
  57 + <view bindtap="closeSpecModal" class="cover-layer"></view>
  58 + <view class="spec-model">
  59 + <view class="pding">
  60 + <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
  61 + <view class="spec-goods">
  62 + <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
  63 + <view class="spec-goods-info">
  64 + <view class="spec-goods-name ellipsis-1">{{data.goods_name}}</view>
  65 + <view class="flex ai_end xc-val-money">
  66 + <view class="spec-goods-price" >
  67 + <text class="fs20">¥</text>
  68 + <!-- 如果是等级会员,且有等级价 -->
  69 + <block wx:if="{{card_field && data[card_field]>0}}">
  70 + {{data[card_field]}}
  71 + </block>
  72 + <block wx:else>
  73 + {{data.shop_price}}
  74 + </block>
  75 + </view>
  76 +
  77 + </view>
  78 + <block>
  79 + <view class="flex">
  80 + <view class="spec-goods-stock">已售:{{data.sales_sum}}</view>
  81 + <block wx:if="{{sales_rules==2}}">
  82 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view>
  83 + <view class="spec-goods-stock" wx:else>可售:0</view>
  84 + </block>
  85 + <block wx:else>
  86 + <view class="spec-goods-stock">可售:{{data.store_count}}</view>
  87 + </block>
  88 +
  89 + </view>
  90 + </block>
  91 + </view>
  92 + <view style="clear: both"></view>
  93 + <!-- 选择门店模块 -->
  94 + <view class="flex-space-between address ai_end xc-width ">
  95 + <view class="flex ai_end" wx:if="{{def_pick_store}}">
  96 + <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
  97 + <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}">
  98 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
  99 +
  100 + </view>
  101 + </view>
  102 +
  103 + <!-- 没有门店的时候 -->
  104 + <view class="flex" bindtap="choice_store" wx:else>
  105 + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
  106 + <view class="fs28 xc-ash-9f">选择门店</view>
  107 + </view>
  108 +
  109 + <view class="red-co fs28" bindtap="choice_store" >
  110 + 更多门店
  111 + <text class="right-arrow"></text>
  112 + </view>
  113 + </view>
  114 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  115 + <block wx:else>
  116 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  117 + <block wx:else>
  118 + <view wx:if="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
  119 + </block>
  120 + </block>
  121 +
  122 + <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store}}">地址:{{def_pick_store.fulladdress}}</view>
  123 + </view>
  124 +
  125 + <!----商品的属性项目---->
  126 + <view class="xc-goods-attribute">
  127 + <view class="spec-name">商品属性</view>
  128 + <view style="max-height: 120rpx;overflow-y: auto;">
  129 + <view class="spec_bt act" data-gid='{{item.goods_id}}'>
  130 + {{data.gg}}
  131 + </view>
  132 + </view>
  133 + </view>
  134 +
  135 +
  136 + <view class="b_num">
  137 + <view>购买数量</view>
  138 + <view class="count">
  139 + <view bindtap="subCartNum" class="sub">-</view>
  140 + <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input>
  141 + <view bindtap="addCartNum" class="add">+</view>
  142 + </view>
  143 + </view>
  144 + </view>
  145 + <view class="spec-cart-btns">
  146 + <!-- 根本就找不到门店 -->
  147 + <block wx:if="{{!only_pk && !def_pickpu_list}}">
  148 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  149 + </block>
  150 + <block wx:else>
  151 +
  152 +
  153 + <block wx:if="{{only_pk.length && !only_pk.length}}">
  154 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  155 + </block>
  156 + <block wx:else>
  157 + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
  158 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  159 + </block>
  160 + <block wx:else>
  161 + <block wx:if="{{!def_pick_store}}">
  162 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
  163 + </block>
  164 + <block wx:else>
  165 + <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
  166 + <block wx:if="{{sales_rules==2}}">
  167 + <block wx:if="{{!def_pick_store.CanOutQty}}">
  168 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  169 + </block>
  170 + <block wx:else>
  171 + <view bindtap="addCart" data-openSpecModal_ind="2"
  172 + class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  173 + </block>
  174 + </block>
  175 + <!-- 线上销售 -->
  176 + <block wx:else>
  177 + <block wx:if="{{data.store_count<=0}}">
  178 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  179 + </block>
  180 + <block wx:else>
  181 + <view bindtap="addCart"data-openSpecModal_ind="2"
  182 + class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  183 + </block>
  184 + </block>
  185 +
  186 + </block>
  187 + </block>
  188 + </block>
  189 + </block>
  190 +
  191 + </view>
  192 +
  193 + <view class="clear"></view>
  194 +
  195 + </view>
  196 +</view>
  197 +
  198 +
  199 +<!-- 选择门店的弹框,1.1版最新的 -->
  200 +<block wx:if="{{store==1}}">
  201 + <view class="mongolia-layer" bindtap="close_popup"></view>
  202 + <view class="popup-frame">
  203 + <block wx:if="{{sort_store==0}}">
  204 + <!-- 头部 标题 -->
  205 + <view class="popup-top flex-space-between">
  206 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  207 + <view>
  208 + <view>
  209 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  210 + </view>
  211 + <view class="felx choose_more" bindtap="more_store">
  212 + <text class="fs26 red-co" wx:if="{{is_show_sto_cat}}">{{choice_sort_store==0?'更多门店':'返回'}}</text>
  213 + <view class="bg_rights" wx:if="{{is_show_sto_cat}}"></view>
  214 + </view>
  215 + </view>
  216 + </view>
  217 + <!-- 门店列表,最外层的门店列表,一开始 -->
  218 + <view class="store-list">
  219 + <!--如果还没有点击更多门店的时候 -->
  220 + <block wx:if="{{choice_sort_store==0}}">
  221 + <!-- 需要for循环 -->
  222 + <block wx:if="{{is_show_sto_cat==1}}">
  223 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  224 + <view class="store flex-vertical">
  225 + <!-- 需要点击事件 -->
  226 + <block wx:if="{{index==fir_pick_index}}">
  227 + <view class="circle white xc-hook fs20 red-b">Г</view>
  228 + </block>
  229 + <block wx:else>
  230 + <view class="circle xc-hooks"></view>
  231 + </block>
  232 + <view class="address-frame xc-ash">
  233 + <view class="flex-vertical-between butttem5">
  234 + <view class="flex xc-ash">
  235 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  236 + </view>
  237 + <view>
  238 + <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}">
  239 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}</view>
  240 + </view>
  241 + </view>
  242 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  243 + </view>
  244 + </view>
  245 + </view>
  246 + </block>
  247 + <block wx:else>
  248 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  249 + <view class="store flex-vertical">
  250 + <!-- 需要点击事件 -->
  251 + <block wx:if="{{index==fir_pick_index}}" >
  252 + <view class="circle white xc-hook fs20 red-b">Г</view>
  253 + </block>
  254 + <block wx:else>
  255 + <view class="circle xc-hooks"></view>
  256 + </block>
  257 +
  258 + <view class="address-frame xc-ash">
  259 + <view class="flex-vertical-between ">
  260 + <view class="flex xc-ash">
  261 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  262 + </view>
  263 + <view>
  264 + <view class="distance fs24 address-val"
  265 + wx:if="{{item.distance!=null}}">距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  266 + </view>
  267 + </view>
  268 + </view>
  269 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  270 + </view>
  271 + </view>
  272 + </view>
  273 + </block>
  274 + </block>
  275 + <block wx:else> <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  276 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store">
  277 + <view class="store flex-vertical">
  278 + <!-- 需要点击事件 -->
  279 + <block wx:if="{{index==sec_pick_index}}">
  280 + <view class="circle white xc-hook fs20 red-b">Г</view>
  281 + </block>
  282 + <block wx:else>
  283 + <view class="circle xc-hooks"></view>
  284 + </block>
  285 +
  286 + <view class="address-frame xc-ash">
  287 + <view class="flex-vertical-between ">
  288 + <view class="flex xc-ash">
  289 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  290 + </view>
  291 + <view>
  292 + <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}">
  293 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}</view>
  294 + </view>
  295 + </view>
  296 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  297 + </view>
  298 + </view>
  299 + </view>
  300 + </block>
  301 +
  302 + </view>
  303 +
  304 + <!-- 门店列表底部 -->
  305 + <view class="store-bottom-frame">
  306 + <view class="store-bottom flex-vertical-between">
  307 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick"
  308 + data-openindstore="{{open_ind_store}}">确定</view>
  309 + <view class="default t-c fs28" bindtap="set_def_pick"data-openindstore="{{open_ind_store}}">设为默认</view>
  310 + </view>
  311 + </view>
  312 +
  313 + </block>
  314 +
  315 +
  316 + <block wx:else>
  317 + <view class="popup-top flex-space-between">
  318 + <text class="fs32 nearby_store">门店分类选择</text>
  319 + <view>
  320 + <view>
  321 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  322 + </view>
  323 + <view class="felx choose_mores" bindtap="returns">
  324 + <text class="fs26 red-co">返回</text>
  325 + </view>
  326 + </view>
  327 + </view>
  328 + <view class="sort_store_list">
  329 +
  330 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
  331 + <view class="sort-store flex-vertical-between" >
  332 + <view class="fs30" di>{{item.name}}</view>
  333 + <view class="black_rights-frame">
  334 + <view class="black_rights"></view>
  335 + </view>
  336 + </view>
  337 + </view>
  338 +
  339 + </view>
  340 + </block>
  341 + </view>
  342 +</block>
  343 +
  344 +<warn id="warn"></warn>
  345 +
... ...
packageA/pages/prom_list/prom_list.wxss 0 → 100644
  1 +.head{ height: 100rpx; line-height: 100rpx; border-bottom: 1rpx solid #dddddd; padding: 0 20px }
  2 +.goods_list .item{ height:240rpx}
  3 +.r_box{width:670rpx;border-bottom: 1rpx solid #dddddd;height: 100%}
  4 +.r_box_img{ width:210rpx;height: 210rpx; margin: 17rpx 0 }
  5 +
  6 +
  7 +.join-cart {
  8 + position: fixed;
  9 + left: 0;
  10 + bottom: 0;
  11 + display: flex;
  12 + width: 100%;
  13 + height: 100rpx;
  14 + background-color: #fff;
  15 + text-align: center;
  16 + z-index: 9;
  17 + border-top: 4rpx solid #eee;
  18 +}
  19 +
  20 +.buy_btn{ width: 200rpx; height: 100%; background-color:#c4182e; line-height: 100rpx; color: #fff}
  21 +.f_hei{color: #333; font-size: 28rpx}
  22 +
  23 +.spec-model {
  24 + position: fixed;
  25 + bottom: 0;
  26 + z-index: 20;
  27 + background: white;
  28 + width: 100%;
  29 + /* padding: 0 30rpx; */
  30 + font-size: 32rpx;
  31 + box-sizing: border-box;
  32 + border-radius: 20rpx;
  33 + height: 72%;
  34 +}
  35 +
  36 +.spec-model .pding{padding: 0 30rpx;}
  37 +
  38 +.spec-goods {
  39 + padding: 30rpx 0 20rpx;
  40 + float: left;
  41 + width: 100%;
  42 + border-bottom:2rpx solid #eee;
  43 +}
  44 +
  45 +.spec-img {
  46 + float: left;
  47 + height: 186rpx;
  48 + width: 186rpx;
  49 + border: 4rpx solid #eee
  50 +}
  51 +
  52 +.spec-goods-info {
  53 + float: left;
  54 + padding: 0 25rpx;
  55 + width: 400rpx;
  56 +}
  57 +
  58 +.spec-goods-name {
  59 + font-size: 30rpx;
  60 + line-height: 35rpx;
  61 + height: 35rpx;
  62 + margin: 15rpx 20rpx 25rpx 0;
  63 + overflow: hidden;
  64 + text-overflow: ellipsis;color: #333;
  65 +}
  66 +
  67 +.spec-goods-price {
  68 + color: #d60021;
  69 + font-size: 33rpx;
  70 + font-weight: bold;
  71 +}
  72 +
  73 +.spec-goods-stock {
  74 + margin-top: 3rpx;
  75 + font-size: 24rpx;
  76 + color: #999999;
  77 + margin-right: 15rpx;
  78 +}
  79 +
  80 +.spec-name {
  81 + clear: both;
  82 + padding: 20rpx 0;
  83 + font-size: 30rpx;color: #333;
  84 +}
  85 +
  86 +.quhuo{font-size: 30rpx; color: #000}
  87 +.b_num{
  88 + display: flex;font-size: 30rpx; color: #333;
  89 +}
  90 +
  91 +.count {
  92 + position: fixed;
  93 + display: flex;
  94 + height: 50rpx;
  95 + border: 1rpx solid #000;
  96 + font-size: 28rpx;
  97 + right: 30rpx;
  98 +}
  99 +
  100 +
  101 +.count>view,.count>input {
  102 + width: 60rpx;
  103 + height: 50rpx;
  104 + line-height: 50rpx;
  105 + text-align: center;
  106 +}
  107 +.spec_bt{
  108 + background: fff;color: #333; margin-left: 10rpx;padding: 4rpx 15rpx 4rpx; display: inline-block;
  109 + border-radius:30rpx;font-size: 24rpx;border: 1rpx solid #ccc; margin: 10rpx; height: 40rpx; line-height: 40rpx;
  110 +}
  111 +.spec_bt.act{background: #d60021;color: #fff;border: 1rpx solid #d60021;}
  112 +.sub {
  113 + border-right: 1px solid #000;
  114 +}
  115 +
  116 +.add {
  117 + border-left: 1px solid #000;
  118 +}
  119 +
  120 +.spec-btn {
  121 + color: black;
  122 + background-color: white;
  123 + padding: 10rpx 10rpx;
  124 + font-size: 26rpx;
  125 + line-height: 28rpx;
  126 + float: left;
  127 + border: 1rpx solid #dedede;
  128 + margin: 4rpx 10rpx 4rpx 0;
  129 + border-radius: 4rpx;
  130 +}
  131 +
  132 +.spec-btn-click {
  133 + color: white;
  134 + background-color: #f23030;
  135 + border: 1rpx solid #f23030;
  136 +}
  137 +
  138 +.spec-cart-btns {
  139 + width: 92%;
  140 + line-height: 70rpx;
  141 + margin: 0rpx auto;
  142 + margin-top: 160rpx;
  143 + border-radius: 20rpx;
  144 + position: fixed;
  145 + bottom: 50rpx;
  146 + left: 4%;
  147 +}
  148 +
  149 +.spec-cart-btn {
  150 +
  151 + width:100%;
  152 + font-size: 30rpx;
  153 + text-align: center;
  154 + color: white;
  155 + border-radius: 40rpx;
  156 +}
  157 +
  158 +.spec-add-cart {
  159 + background-color: #ffb03f;
  160 +}
  161 +.spec-buy {
  162 + background-color: #f23030;
  163 + /* margin-left: 34rpx; */
  164 +}
  165 +.spec-cart-disable {
  166 + background: #bbbbbb;
  167 +}
  168 +
  169 +.spec-cart-btn-lg {
  170 + width: 614rpx;
  171 +}
  172 +.stores-img{
  173 + width: 40rpx;
  174 + height: 35rpx;
  175 + margin-right: 10rpx;
  176 +}
  177 +.shop_name{
  178 + margin-right: 10rpx;
  179 +}
  180 +.address{
  181 + width: 90%;
  182 + margin-top: 25rpx;
  183 + margin-bottom: 5rpx;
  184 +}
  185 +.distance{
  186 + padding-left: 15rpx;
  187 + padding-right: 15rpx;
  188 + background: #eee;
  189 + border-radius: 20rpx;
  190 + margin-right: 5rpx;
  191 + color: #999;
  192 + height: 38rpx;
  193 + line-height: 38rpx;
  194 +}
  195 +.sto_v .title,.sto_v .stitle{ border-top: 1rpx solid #dedede;border-bottom: 1rpx solid #dedede; height: 78rpx; line-height: 78rpx;}
  196 +.sto_v .title .tubiao,.sto_v .stitle .tubiao{width: 32rpx; height: 32rpx; margin-top: 23rpx;}
  197 +.itemlists .item{border-bottom: 1rpx solid #dedede; height: 72rpx; line-height: 72rpx;font-size: 28rpx; margin: 0 10rpx;}
  198 +
  199 +.store-list{
  200 + width: 95%;
  201 + height: 72%;
  202 + overflow-y: scroll;
  203 + margin: auto;
  204 +}
  205 +.store-list .store_choose{
  206 + width: 100%;
  207 + height: 120rpx;
  208 + line-height: 125rpx;
  209 + border-bottom: 1rpx solid #eee;
  210 +
  211 +}
  212 +.store-list .store_choose .store{
  213 + width: 100%;
  214 + margin: auto;
  215 + line-height: 37rpx;
  216 + padding-left: 20rpx;
  217 +
  218 +}
  219 +.xc-hook{
  220 + width: 35rpx;
  221 + height: 35rpx;
  222 + transform: rotate(-145deg);
  223 + line-height: 37rpx;
  224 + text-align: center;
  225 +}
  226 +.xc-hooks{
  227 + width: 30rpx;
  228 + height: 30rpx;
  229 + border: 1rpx solid #999;
  230 +}
  231 +.address-frame{
  232 + width: 93%;
  233 + margin-left: 7rpx;
  234 +
  235 +}
  236 +.nearby_store{
  237 + margin-left: 17rpx;
  238 +}
  239 +.address_name{
  240 + margin-right: 10rpx;
  241 +
  242 +}
  243 +.address-val{
  244 + height: 38rpx;
  245 + line-height: 38rpx;
  246 +
  247 +}
  248 +.store-bottom{
  249 + width: 85%;
  250 + margin: auto;
  251 + height: 70rpx;
  252 +}
  253 +.determine{
  254 + width: 260rpx;
  255 + height: 55rpx;
  256 + border-radius: 50rpx;
  257 + line-height: 55rpx;
  258 +}
  259 +.default{
  260 + width: 260rpx;
  261 + height: 55rpx;
  262 + border:3rpx solid #c8c8c8;
  263 + border-radius: 50rpx;
  264 + line-height: 55rpx;
  265 +}
  266 +.store-bottom-frame{
  267 + width: 95%;
  268 + margin: auto;
  269 +
  270 +}
  271 +/* 门店分类列表 */
  272 +.sort_store_list{
  273 + height: 82%;
  274 + overflow: hidden;
  275 + overflow-y: scroll;
  276 + width: 95%;
  277 + margin: auto;
  278 +}
  279 +.sort_store_list .sort-store-frame{
  280 + width: 100%;
  281 + height: 100rpx;
  282 + line-height:100rpx;
  283 + border-bottom: 1rpx solid #eee;
  284 +
  285 +}
  286 +.sort_store_list .sort-store-frame .sort-store{
  287 + width: 94.5%;
  288 + margin: auto;
  289 +}
  290 +.black_rights-frame{
  291 + width: 50%;
  292 +}
  293 +.black_rights-frame .black_rights{
  294 + border-top: 3rpx solid;
  295 + border-right: 3rpx solid;
  296 + transform: rotate(45deg);
  297 + display: inline-block;
  298 + width: 20rpx;
  299 + height: 20rpx;
  300 +}
  301 +
  302 +/* 选择门店的弹窗 */
  303 +.mongolia-layer{
  304 + position: fixed;
  305 + left: 0;
  306 + top: 0;
  307 + right: 0;
  308 + bottom: 0;
  309 + z-index: 11;
  310 + background: rgba(0,0,0,0.4);
  311 + width: 100%;
  312 + height: 91.9%;
  313 +}
  314 +
  315 +.popup-frame{
  316 + position: fixed;
  317 + bottom:99rpx;
  318 + z-index: 20;
  319 + background: white;
  320 + width: 100%;
  321 + border-radius: 20rpx 20rpx 0 0;
  322 + height: 72%;
  323 +}
  324 +.popup-top{
  325 + border-bottom: 1rpx solid #eee;
  326 + height: 155rpx;
  327 + width: 95%;
  328 + margin: auto;
  329 + line-height: 155rpx;
  330 +
  331 +}
  332 +.bg_rights{
  333 + border-top: 2rpx solid ;
  334 + border-right: 2rpx solid ;
  335 + transform: rotate(45deg);
  336 + display:inline-block;
  337 + width:15rpx;height:15rpx;
  338 + border-color:#da0b31;
  339 +}
  340 +.modal-closes {
  341 + position: absolute;
  342 + right: 30rpx;
  343 + top: -15rpx;
  344 + height: 25rpx;
  345 +
  346 +}
  347 +.choose_more{
  348 + margin-top: 40rpx;
  349 + margin-right: 20rpx;
  350 +
  351 +}
  352 +.choose_mores{
  353 + margin-top: 30rpx;
  354 + margin-right: 15rpx;
  355 +}
  356 +.xc-goods-attribute{
  357 + border-bottom: 1px solid #eee;
  358 + padding-bottom: 15px;
  359 + margin-bottom:40rpx;
  360 + }
0 361 \ No newline at end of file
... ...
packageA/pages/quan_list/filter.wxs 0 → 100644
  1 +var is_has = function (text,val) {
  2 + if(text.indexOf(","+val+",")==-1) return false;
  3 + return true
  4 +}
  5 +
  6 +function get_guige(color,spece){
  7 + if(color=="" && spece==""){return "规格1"}
  8 + if(spece!="" && color==""){return spece}
  9 + if(spece=="" && color!=""){return color}
  10 + if(spece!="" && color!=""){return spece+"/"+color}
  11 + return "";
  12 +}
  13 +
  14 +function get_color(index){
  15 + var i=index%3;
  16 + switch(i){
  17 + case 0: return "red";
  18 + case 1: return "blue";
  19 + case 2: return "purple";
  20 + }
  21 +}
  22 +
  23 +module.exports = {
  24 + is_has: is_has,
  25 + get_guige:get_guige,
  26 + get_color:get_color
  27 +}
... ...
packageA/pages/quan_list/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + //min_price=min.price;
  78 + //min_name=min.name;
  79 + if(type==0) return min_price.toFixed(2);
  80 + if(min_name.length>4 ) min_name=min_name.substring(0, 4);
  81 + return min_name;
  82 + },
  83 +}
  84 +module.exports = {
  85 + is_has_rank:g_filters.is_has_rank,
  86 + get_card_price:g_filters.get_card_price,
  87 +}
0 88 \ No newline at end of file
... ...
packageA/pages/quan_list/quan_list.js 0 → 100644
  1 +var t = require("../../../utils/util.js"), ut = t,
  2 + e = require("../../../utils/common.js"),
  3 + oo = getApp().globalData,
  4 + os = getApp().globalData.setting;
  5 +var utils = require('../../../utils/util.js'),ut=utils;
  6 +
  7 +
  8 +
  9 +Page({
  10 + data: {
  11 + stoid: os.stoid,
  12 + url: os.url,
  13 + resourceUrl: os.resourceUrl,
  14 + iurl: os.imghost,
  15 + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg",
  16 + dataList: null,
  17 + config2:null,
  18 + curpage:1,
  19 + loading:0,
  20 + get_item:null,
  21 + show_success:0,
  22 + },
  23 + //------初始化加载----------
  24 + onLoad: function(t) {
  25 + var th=this;
  26 + getApp().getConfig2(function (conf) {
  27 + conf.couponset=conf.couponset.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"');
  28 + th.setData({config2:conf});
  29 + })
  30 + },
  31 + //---展示---
  32 + onShow: function() {
  33 + this.data.curpage=1;
  34 + this.setData({dataList:null});
  35 + this.get_quan_list();
  36 + //券的模拟数据
  37 + //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}];
  38 + //th.setData({dataList: data});
  39 + },
  40 +
  41 + onHide: function() {
  42 +
  43 + },
  44 +
  45 + //--券的列表页面的函数--
  46 + get_quan_list:function(){
  47 + var th=this;
  48 + if(th.data.loading) return false;
  49 + th.data.loading=1;
  50 + var user_id=getApp().globalData.user_id;
  51 + getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", {
  52 + data:{store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id}
  53 + }).then(res => {
  54 + th.data.loading=0;
  55 + if(res.data.code==0){
  56 + if(!th.data.dataList) th.data.dataList=new Array();
  57 + th.data.dataList=th.data.dataList.concat(res.data.data.pageData);
  58 + th.data.curpage++;
  59 + th.setData({dataList:th.data.dataList});
  60 + }
  61 + });
  62 + },
  63 +
  64 + //---加载更多是靠这个函数----
  65 + onReachBottom: function() {
  66 + this.get_quan_list();
  67 + },
  68 +
  69 +
  70 + //--滚动到顶部--
  71 + doScrollTop: function() {
  72 + wx.pageScrollTo({ scrollTop: 0 });
  73 + },
  74 +
  75 + //-----领取券-----
  76 + get_quan: function(e) {
  77 + var cid = e.currentTarget.dataset.cid;
  78 + var index = e.currentTarget.dataset.ind;
  79 + var item = this.data.dataList[index];
  80 +
  81 + //--先判断会员状态--
  82 + var user_info = getApp().globalData.userInfo;
  83 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  84 + wx.navigateTo({
  85 + url: '/pages/getphone/getphone',
  86 + })
  87 + return false;
  88 + }
  89 +
  90 + //如果券还在领取中,不能再点
  91 + if (item.linging == 1) {
  92 + getApp().my_warnning('领取中..', 0, this);
  93 + return false;
  94 + }
  95 +
  96 + //如果领取的次数到了
  97 + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) {
  98 + getApp().my_warnning('领取失败,您已领完该券', 0, this);
  99 + return false;
  100 + }
  101 + var lq_num = item.lqnum;
  102 + var pdata = {
  103 + 'uid': oo.user_id,
  104 + 'cid': cid,
  105 + 'store_id': os.stoid,
  106 + 'type': 5
  107 + };
  108 + var app = getApp(),
  109 + th = this;
  110 + app.request.post("/api/weshop/couponList/saveCouponList", {
  111 + data: pdata,
  112 + success: function(res) {
  113 + if (res.data.code == 0) {
  114 + var text = "dataList[" + index + "].is_get";
  115 + var text2 = "dataList[" + index + "].linging";
  116 + var text3 = "get_item";
  117 + var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1;
  118 + th.setData(obj);
  119 + } else {
  120 + app.confirmBox(res.data.msg);
  121 + var text2 = "dataList[" + index + "].linging";
  122 + th.setData({[text2]:0});
  123 + }
  124 + }
  125 + })
  126 + },
  127 + close_show:function () {
  128 + this.setData({show_success:0,get_item:null})
  129 + },
  130 + go_quan:function () {
  131 + getApp().goto("/pages/user/coupons/coupons");
  132 + },
  133 + go_detail:function (e) {
  134 + var index=e.currentTarget.dataset.ind;
  135 + var item=this.data.dataList[index];
  136 + getApp().goto("/packageA/pages/quan_pro/quan_pro?id="+item.id);
  137 + }
  138 +
  139 +
  140 +});
... ...
packageA/pages/quan_list/quan_list.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "优惠券",
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "nav_box": "/components/nav_box/nav_box",
  6 + "warn": "/components/long_warn/long_warn"
  7 + }
  8 +}
0 9 \ No newline at end of file
... ...
packageA/pages/quan_list/quan_list.wxml 0 → 100644
  1 +<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
  2 +<wxs module="g_filters" src="g_filter.wxs"></wxs>
  3 +<wxs module="tool" src="filter.wxs"></wxs>
  4 +
  5 +<view class="header">
  6 + <rich-text nodes="{{config2.couponset}}" class="r_txt fs26"></rich-text>
  7 +</view>
  8 +<view class="content">
  9 + <view bindtap="go_detail" data-ind="{{index}}" class="quan_item flex fs30" wx:for="{{dataList}}">
  10 + <!-- 左边 -->
  11 + <view class="left {{tool.get_color(index)}} flex ai-center jc-center co-w">
  12 + <view class="t-c">
  13 + <view class="fs40"><text class="fs24">¥</text>{{filters.toFix(item.money,2)}}</view>
  14 + <view>满{{filters.toFix(item.condition,2)}}可用</view>
  15 + </view>
  16 + </view>
  17 + <!-- 右边 -->
  18 + <view class="right fs24 co_g pding" style="background-image:url({{iurl}}/miniapp/images/coupon_img/white.png); position: relative">
  19 + <view class="fs28 co_b" style="margin-top: 15rpx">{{item.name}}</view>
  20 + <view style="margin-top: 5rpx">所有门店通用</view>
  21 + <view wx:if="{{item.endtype==0}}">有效期
  22 + <text wx:if="{{item.use_start_time>0}}"> {{filters.format_time(item.use_start_time)}}</text>至
  23 + <text wx:if="{{item.use_start_time>0}}"> {{filters.format_time(item.use_end_time)}}</text><text wx:else>不限</text>
  24 + </view>
  25 + <view wx:else>有效期<text wx:if="{{item.days>0}}">{{item.days}}天</text><text wx:else>不限</text></view>
  26 + <view>每人限领:<text wx:if="{{item.everyone_num>0}}">{{item.everyone_num}}</text><text wx:else>不限</text></view>
  27 + <!-- 领取按钮 -->
  28 + <view data-ind="{{index}}" data-cid="{{item.id}}" catchtap="get_quan">
  29 + <view wx:if="{{item.everyone_num>0 && item.lqnum>=item.everyone_num}}" class="btn flex jc-center ai-center is_get">已领取</view>
  30 + <view wx:else class="btn flex jc-center ai-center">立即领取</view>
  31 + </view>
  32 + </view>
  33 + </view>
  34 +</view>
  35 +
  36 +<view wx:if="{{show_success}}">
  37 + <view class="cover-layer" bindtap="close_show"></view>
  38 + <view class="suc_content">
  39 + <view class="up flex jc-center">
  40 + <view class="t-c">
  41 + <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image>
  42 + <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{get_item.name}}】优惠券</view>
  43 + </view>
  44 + </view>
  45 + <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view>
  46 + </view>
  47 +</view>
  48 +
  49 +<warn id="warn"></warn>
  50 +<nav_box id="nav"></nav_box>
  51 +
... ...
packageA/pages/quan_list/quan_list.wxss 0 → 100644
  1 +page{background-color: #f8f8f8;}
  2 +.co-w{color: #ffffff;}
  3 +.co_g{color:#b399b3}
  4 +.co_b{color:#333;}
  5 +
  6 +.header{padding: 0 10rpx;}
  7 +.r_txt{line-height: 45rpx; }
  8 +.content{padding: 0 20rpx; margin-top: 20rpx}
  9 +.quan_item{ height: 213rpx; margin-bottom: 20rpx }
  10 +.quan_item .left{overflow: hidden;width: 35%; height: 213rpx;border-top-left-radius:10rpx;border-bottom-left-radius:10rpx;position: relative}
  11 +.quan_item .right{width: 65%; height: 210rpx; border-top-right-radius:10rpx;border-bottom-right-radius:10rpx;position: relative;
  12 + background-position: center;background-size: 100% 100%; background-repeat: no-repeat}
  13 +.quan_item .left.red {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/red.png) no-repeat;background-position: center;background-size: 100% 100%;}
  14 +.quan_item .left.blue {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/blue.png) no-repeat;background-position: center;background-size: 100% 100%;}
  15 +.quan_item .left.purple {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/purple.png) no-repeat;background-position: center;background-size: 100% 100%;}
  16 +
  17 +.quan_item .right.pding{padding-left: 40rpx}
  18 +.btn{position: absolute;right: 20rpx; bottom: 20rpx; border-radius: 5px; border: 1rpx solid #c4182e; width: 132rpx; height: 40rpx; color: #c4182e }
  19 +.btn.is_get{border: 0;background-color: #dcdcdc;color: #adb3be; width: 94rpx;}
  20 +
  21 +.suc_content{
  22 + height: 300rpx; width: 84%; margin-left:8%;position: fixed; border-radius:25rpx;
  23 + top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999;
  24 +}
  25 +
  26 +.suc_content .up{ height:200rpx }
  27 +.suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx}
  28 +.suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx;
  29 +border-bottom-right-radius:25rpx;
  30 +border-bottom-left-radius:25rpx;
  31 +}
  32 +
... ...
packageA/pages/quan_pro/filter.wxs 0 → 100644
  1 +var is_has = function (text,val) {
  2 + if(text.indexOf(","+val+",")==-1) return false;
  3 + return true
  4 +}
  5 +
  6 +function get_guige(color,spece){
  7 + if(color=="" && spece==""){return "规格1"}
  8 + if(spece!="" && color==""){return spece}
  9 + if(spece=="" && color!=""){return color}
  10 + if(spece!="" && color!=""){return spece+"/"+color}
  11 + return "";
  12 +}
  13 +
  14 +module.exports = {
  15 + is_has: is_has,
  16 + get_guige:get_guige
  17 +}
... ...
packageA/pages/quan_pro/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + //-- 判断是不是有等级价 --
  3 + is_has_rank:function(rank_switch,item){
  4 + if(!rank_switch) return false;
  5 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  6 + return false;
  7 + },
  8 +
  9 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  10 + get_card_price:function(goods,all_card,type){
  11 + var price1=parseFloat(goods['cardprice1']);
  12 + var price2=parseFloat(goods['cardprice2']);
  13 + var price3=parseFloat(goods['cardprice3']);
  14 + if(!all_card){
  15 + if(type==0) return 0;
  16 + return "";
  17 + }
  18 +
  19 + var arr=[];
  20 + var min_price= 0;
  21 + var min_name="";
  22 +
  23 + var min_price=null;
  24 + var min_name=null;
  25 + //---设置对应的价格名字----
  26 + for(var i=0;i<3;i++) {
  27 + var vl=all_card[i];
  28 + if(!vl) continue;
  29 + if(vl['CorrPrice']=="Price1" && price1>0)
  30 + {
  31 + if(min_price==null) {
  32 + min_price=price1;min_name=vl['CardName'];
  33 + }
  34 + else if(price1<min_price) {
  35 + min_price=price1;min_name=vl['CardName'];
  36 + }
  37 + }
  38 + if(vl['CorrPrice']=="Price2" && price2>0)
  39 + {
  40 + if(min_price==null) {
  41 + min_price=price2;min_name=vl['CardName'];
  42 + }
  43 + else if(price2<min_price) {
  44 + min_price=price2;min_name=vl['CardName'];
  45 + }
  46 + }
  47 +
  48 + if(vl['CorrPrice']=="Price3" && price3>0)
  49 + {
  50 + if(min_price==null) {
  51 + min_price=price3;min_name=vl['CardName'];
  52 + }
  53 + else if(price3<min_price) {
  54 + min_price=price3;min_name=vl['CardName'];
  55 + }
  56 + }
  57 +
  58 + }
  59 + if(min_price==null){
  60 + if(type==0) return 0;
  61 + return "";
  62 + }
  63 +
  64 + //if(type==0) return arr.length;
  65 + //--进行排序,升序---
  66 + /*---
  67 + arr.sort(function(a,b){
  68 + if (a.price < b.price) {
  69 + return -1;
  70 + } else if (a.fee == b.fee) {
  71 + return 0;
  72 + } else {
  73 + return 1;
  74 + }
  75 + })--*/
  76 + //-- 获取最下价钱,和相应的卡的名称 --
  77 + //min_price=min.price;
  78 + //min_name=min.name;
  79 + if(type==0) return min_price.toFixed(2);
  80 + if(min_name.length>4 ) min_name=min_name.substring(0, 4);
  81 + return min_name;
  82 + },
  83 +}
  84 +module.exports = {
  85 + is_has_rank:g_filters.is_has_rank,
  86 + get_card_price:g_filters.get_card_price,
  87 +}
0 88 \ No newline at end of file
... ...
packageA/pages/quan_pro/quan_pro.js 0 → 100644
  1 +var t = require("../../../utils/util.js"), ut = t,
  2 + e = require("../../../utils/common.js"),
  3 + oo = getApp().globalData,
  4 + os = getApp().globalData.setting;
  5 + var utils = require('../../../utils/util.js'),ut=utils;
  6 +
  7 +Page({
  8 + data: {
  9 + stoid: os.stoid,
  10 + url: os.url,
  11 + resourceUrl: os.resourceUrl,
  12 + iurl: os.imghost,
  13 + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg",
  14 + q_data: null,
  15 + id:null,
  16 + config2:null,
  17 +
  18 + },
  19 + //------初始化加载----------
  20 + onLoad: function(t) {
  21 + var id=t.id;
  22 + this.data.id=id;
  23 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  24 + goods_list.init();
  25 + setTimeout(function() {
  26 + goods_list.get_list();
  27 + }, 300)
  28 + },
  29 +
  30 + //---展示,显示券的信息---
  31 + onShow: function() {
  32 + var th=this;
  33 + var user_id=getApp().globalData.user_id;
  34 + getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", {
  35 + data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id}
  36 + }).then(res => {
  37 + if(res.data.code==0){
  38 + th.setData({q_data:res.data.data.pageData[0]});
  39 + }
  40 + });
  41 + },
  42 +
  43 + onHide: function() {
  44 +
  45 + },
  46 + //--滚动到顶部--
  47 + doScrollTop: function() {
  48 + wx.pageScrollTo({ scrollTop: 0 });
  49 + },
  50 +
  51 + //---加载更多是靠这个函数----
  52 + onReachBottom: function() {
  53 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  54 + if (goods_list) goods_list.get_list();
  55 + },
  56 +
  57 + //-----领取券-----
  58 + get_quan: function() {
  59 + var item=this.data.q_data;
  60 + var cid = this.data.q_data.id;
  61 + var th=this;
  62 + //--先判断会员状态--
  63 + var user_info = getApp().globalData.userInfo;
  64 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  65 + wx.navigateTo({
  66 + url: '/pages/getphone/getphone',
  67 + })
  68 + return false;
  69 + }
  70 + //如果券还在领取中,不能再点
  71 + if (th.data.linging == 1) {
  72 + getApp().my_warnning('领取中..', 0, this);
  73 + return false;
  74 + }
  75 + th.data.linging = 1;
  76 + //如果领取的次数到了
  77 + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) {
  78 + getApp().my_warnning('领取失败,您已领完该券', 0, this);
  79 + return false;
  80 + }
  81 + var lq_num = item.lqnum;
  82 + var pdata = {
  83 + 'uid': oo.user_id,
  84 + 'cid': cid,
  85 + 'store_id': os.stoid,
  86 + 'type': 5
  87 + };
  88 + var app = getApp(),
  89 + th = this;
  90 + app.request.post("/api/weshop/couponList/saveCouponList", {
  91 + data: pdata,
  92 + success: function(res) {
  93 + th.data.linging = 0;
  94 + if (res.data.code == 0) {
  95 + item.lqnum++;
  96 + var text = "dataList[" + index + "].is_get";
  97 + var text2 = "dataList[" + index + "].linging";
  98 + var text3="q_data";
  99 + var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1;
  100 + th.setData(obj);
  101 + } else {
  102 + app.confirmBox(res.data.msg);
  103 + }
  104 + }
  105 + })
  106 + },
  107 +
  108 +
  109 +});
... ...
packageA/pages/quan_pro/quan_pro.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "优惠券",
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "nav_box": "/components/nav_box/nav_box",
  6 + "warn": "/components/long_warn/long_warn",
  7 + "goods_recommend":"/components/goods_list/goods_list"
  8 + }
  9 +}
0 10 \ No newline at end of file
... ...
packageA/pages/quan_pro/quan_pro.wxml 0 → 100644
  1 +<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
  2 +<wxs module="g_filters" src="g_filter.wxs"></wxs>
  3 +<wxs module="tool" src="filter.wxs"></wxs>
  4 +
  5 +<!-- 上部分 -->
  6 +<view class="up_part">
  7 + <view class="img_part">
  8 + <image style="width: 100%; height: 450rpx" src="{{iurl}}/miniapp/images/coupon_img/q_detail_bg.png"></image>
  9 + <view class="q_content">
  10 + <view class="upper flex jc_sb co-w">
  11 + <view class="left fs30">
  12 + <view>
  13 + <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image>
  14 + {{q_data.name}}
  15 + </view>
  16 + <view class="flex ai-center ellipsis-1" style="margin-top: 24rpx; margin-right: 20rpx"><view class="t_circle"></view>
  17 + <text wx:if="{{q_data.useobjecttype==0}}">全场通用</text>
  18 + <text wx:else>仅限{{q_data.useobjectname}}使用</text>
  19 + </view>
  20 + </view>
  21 + <view class="right" style="margin-right: 80rpx;">
  22 + <view class="f40 t-c" style="margin-top: 100rpx"><text class="fs26">¥</text>{{filters.toFix(q_data.money,2)}}</view>
  23 + <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view>
  24 + </view>
  25 + </view>
  26 + <view wx:if="{{item.endtype==0}}" class="lower fs30">有效期
  27 + <text wx:if="{{q_data.use_start_time>0}}"> {{filters.format_time(q_data.use_start_time)}}</text>至
  28 + <text wx:if="{{q_data.use_start_time>0}}"> {{filters.format_time(q_data.use_end_time)}}</text><text wx:else>不限</text>
  29 + </view>
  30 + <view wx:else class="lower fs30">有效期<text wx:if="{{q_data.days>0}}">{{q_data.days}}天</text><text wx:else>不限</text></view>
  31 +
  32 + </view>
  33 + </view>
  34 +
  35 + <view class="flex jc-center" style="margin-top: 40rpx">
  36 + <view wx:if="{{q_data.everyone_num>0 && q_data.lqnum>=q_data.everyone_num}}" class="btn flex jc-center ai-center gray" bindtap="get_quan">已领取</view>
  37 + <view wx:else class="btn flex jc-center ai-center" bindtap="get_quan">立即领取</view>
  38 + </view>
  39 + <view class="flex jc-center fs36" style="margin-top: 40rpx">
  40 + <image style="margin-right: 20rpx" class="love" src="{{iurl}}/miniapp/images/coupon_img/love.png"></image>猜你喜欢
  41 + </view>
  42 +</view>
  43 +<!-- 下部分 -->
  44 +<view class="down_part">
  45 + <!-- 商品列表组件 -->
  46 + <goods_recommend id="goods_list"></goods_recommend>
  47 +</view>
  48 +
  49 +
  50 +<view wx:if="{{show_success}}">
  51 + <view class="cover-layer" bindtap="close_show"></view>
  52 + <view class="suc_content">
  53 + <view class="up flex jc-center">
  54 + <view class="t-c">
  55 + <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image>
  56 + <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{get_item.name}}】优惠券</view>
  57 + </view>
  58 + </view>
  59 + <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view>
  60 + </view>
  61 +</view>
  62 +
  63 +
  64 +<warn id="warn"></warn>
  65 +<nav_box id="nav"></nav_box>
  66 +
  67 +
... ...
packageA/pages/quan_pro/quan_pro.wxss 0 → 100644
  1 +page{background-color: #f8f8f8;}
  2 +.co-w{color: #ffffff;}
  3 +.co_g{color:#b399b3}
  4 +.co_b{color:#333;}
  5 +
  6 +.up_part{background-color: #fff;padding-bottom: 20rpx}
  7 +.img_part{ padding: 0 20rpx; position: relative}
  8 +.btn{ width: 90%; height: 72rpx; border-radius: 10rpx; background-color: #ff6c6c; color: #fff;}
  9 +.love{ width: 60rpx; height: 50rpx}
  10 +.q_content{ position: absolute;top: 0; left: 0; width: 100%; height: 450rpx;padding: 0 20rpx; }
  11 +.upper{ height:330rpx;}
  12 +.lower{ height: 120rpx; line-height: 170rpx;color:#7a668f}
  13 +
  14 +.upper .left{ margin-left:30rpx; margin-top: 30rpx }
  15 +.t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx}
  16 +
  17 +.suc_content{
  18 + height: 300rpx; width: 84%; margin-left:8%;position: fixed; border-radius:25rpx;
  19 + top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999;
  20 +}
  21 +
  22 +.suc_content .up{ height:200rpx;}
  23 +.suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx}
  24 +.suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx;
  25 + border-bottom-right-radius:25rpx;
  26 + border-bottom-left-radius:25rpx;
  27 +}
  28 +
  29 +.btn.gray{background-color: #dcdcdc; color: #adb3be;}
... ...
pages/cart/cart/cart.js
... ... @@ -49,9 +49,17 @@ Page({
49 49 t.auth.hadAuth() && t.getUserInfo(function() {
50 50 a.getCardList();
51 51 });
  52 +
  53 +
  54 +
52 55 },
53 56 onShow: function() {
54 57 var th = this;
  58 + //th.setData({
  59 + // isTabBar: getApp().globalData.isTabBar,
  60 + //});
  61 +
  62 + t.editTabBar(); //显示自定义的底部导航
55 63 this.getCardList();
56 64 if(getApp().globalData.user_id) getApp().requestCardNum();
57 65 //--获取是否又秒杀活动--
... ... @@ -121,7 +129,8 @@ Page({
121 129 user_id: app.globalData.user_id,
122 130 rd: rd,
123 131 store_id: oo.stoid,
124   - pageSize: 600
  132 + pageSize: 600,
  133 + state:0
125 134 },
126 135 success:async function(su) {
127 136 //按门店分类的数组
... ... @@ -136,18 +145,60 @@ Page({
136 145 good=res.data.data;
137 146 })
138 147 var tt=ut.gettimestamp();
139   - if((good.down_time>0 && good.down_time<tt) || good.is_on_sale==0 ){
  148 + //如果商品下架了,或者商品是赠品,一开始都要清除
  149 + if((good.down_time>0 && good.down_time<tt) || good.is_on_sale==0 || item.is_gift ){
140 150 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
141   - a.delete(url, {
  151 + getApp().request.delete(url, {
142 152 success: function(t) { }
143 153 });
144 154 //商品已经下架
145 155 continue;
146 156 }
  157 + //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着
  158 + if(item.prom_type==1){
  159 + var prom=null;
  160 + await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+item.prom_id,{
  161 + }).then(res=>{
  162 + if(res.data.code==0) prom=res.data.data;
  163 + })
  164 + //---如果有活动,不算在一起---
  165 + if(!prom && prom.is_end==0 && prom.end_time>now && prom.start_time<now){
  166 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  167 + a.delete(url, {
  168 + success: function(t) { }
  169 + });
  170 + //商品已经下架
  171 + continue;
  172 + }
  173 + }
  174 + //--判断优惠活动有没有过期--
  175 + else if(item.prom_type==3){
  176 + var isok=1;
  177 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+item.goods_id+"/1", {}).then(res => {
  178 + if(res.data.code==0){
  179 + var r_data=res.data.data;
  180 + if(!r_data.promGoodsLists){
  181 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  182 + a.delete(url, {});
  183 + //商品已经下架
  184 + isok=0;
  185 + }
  186 + }
  187 + else{
  188 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  189 + a.delete(url, { });
  190 + //商品已经下架
  191 + isok=0;
  192 + }
  193 + })
  194 + if(!isok) continue;
  195 + }
  196 +
147 197 all_num += item.goods_num;
148 198 item.original_img = oo.imghost + item.original_img;
149 199 item.selected = 0;
150 200  
  201 +
151 202 var pcid = item.pick_id;
152 203 var find = 0;
153 204 //---------循环查找门店---
... ... @@ -183,6 +234,14 @@ Page({
183 234 }
184 235 }
185 236  
  237 + if(arr.length==0) {
  238 + setTimeout(function () {
  239 + var goods_list = th.selectComponent("#goods_list"); //组件的id
  240 + goods_list.init();
  241 + goods_list.get_list();
  242 + }, 800)
  243 + }
  244 +
186 245 th.setData({
187 246 requestData: arr,
188 247 all_num: all_num,
... ... @@ -292,6 +351,7 @@ Page({
292 351 }
293 352 var fir = 0;
294 353 for (var j = 0; j < item.length; j++) {
  354 + if(item[j].is_gift) continue;
295 355 if (fir == 0) {
296 356 fir = item[j].distr_type;
297 357 } else {
... ... @@ -324,6 +384,11 @@ Page({
324 384 total_fee: tfeel.toFixed(2),
325 385 total_num: t_num,
326 386 });
  387 +
  388 + for(var i in e.data.requestData){
  389 + e.check_prom_activity(i)
  390 + }
  391 +
327 392 }
328 393 },
329 394  
... ... @@ -339,6 +404,7 @@ Page({
339 404 iarr = item;
340 405 if (!sele && item.length > 0) {
341 406 for (var i = 0; i < iarr.length; i++) {
  407 + if(iarr[i].is_gift==1) continue;
342 408 if (iarr[i].distr_type != 0) {
343 409 if (fir == 0) {
344 410 fir = iarr[i].distr_type;
... ... @@ -370,6 +436,7 @@ Page({
370 436 e.setData({
371 437 [txt]: Number(!sele),
372 438 });
  439 + e.check_prom_activity(pitems);
373 440 this.doCheckAll();
374 441 },
375 442  
... ... @@ -379,14 +446,15 @@ Page({
379 446 item = t.currentTarget.dataset.item,
380 447 pitems = t.currentTarget.dataset.pitems;
381 448 a = this.data.requestData[pitems].goods[item];
382   - var isok = 1,
383   - fir = 0;
  449 + var isok = 1,fir = 0;
384 450 var iarr = e.data.requestData[pitems].goods;
385 451  
386 452  
387 453 //当数量大于1,且是选择的时候
388 454 if (iarr.length > 1 && !a.selected) {
389 455 for (var i = 0; i < iarr.length; i++) {
  456 + if(iarr[i].is_gift==1) continue;
  457 +
390 458 //---当不是本身选择项目----
391 459 var sel = iarr[i].selected;
392 460 if (iarr[i].distr_type != 0 && (sel || iarr[i].id == a.id)) {
... ... @@ -411,6 +479,12 @@ Page({
411 479 e.setData({
412 480 [txt]: Number(!a.selected),
413 481 });
  482 +
  483 + if(a.prom_type==3){
  484 + //判断商品是不是优惠活动
  485 + e.check_prom_activity(pitems);
  486 + }
  487 +
414 488 this.doCheckAll();
415 489 }
416 490 },
... ... @@ -427,6 +501,7 @@ Page({
427 501 var item = car[a].goods,
428 502 is_s_sele = 1;
429 503 for (var c = 0; c < item.length; c++) {
  504 + if(item[c].is_gift) continue;
430 505 all_num += item[c].goods_num;
431 506 if (item[c].selected == 0) {
432 507 ischeck = 0;
... ... @@ -680,8 +755,13 @@ Page({
680 755 plist=res.data.data.pageData[0];
681 756 }
682 757 })
683   - var ob={}; ob.code=1;
684   - if(t.goods_num>plist.CanOutQty-lock){
  758 + var ob={}; ob.code=1;
  759 +
  760 + if(!plist){
  761 + ob.code=-1;ob.CanOutQty=0;func(ob); return false;
  762 + }
  763 +
  764 + if( t.goods_num>plist.CanOutQty-lock){
685 765 ob.code=-1;
686 766 ob.CanOutQty=plist.CanOutQty-lock
687 767 if(ob.CanOutQty<0) ob.CanOutQty=0;
... ... @@ -701,6 +781,9 @@ Page({
701 781 e.setData({
702 782 [txt]: t.goods_num,
703 783 });
  784 + for(var i in e.data.requestData){
  785 + e.check_prom_activity(i)
  786 + }
704 787 e.doCheckAll();
705 788 }
706 789 });
... ... @@ -725,7 +808,7 @@ Page({
725 808 for (var i = 0; i < this.data.requestData.length; i++) {
726 809 var i_arr = this.data.requestData[i].goods;
727 810 for (var j = 0; j < i_arr.length; j++) {
728   - if (i_arr[j].selected) {
  811 + if (i_arr[j].selected && i_arr[j].is_gift!=1) {
729 812 //map 的key是不会重复,会覆盖,,
730 813 var ie = {
731 814 goods_id: i_arr[j].goods_id,
... ... @@ -742,8 +825,8 @@ Page({
742 825 }
743 826 glist += i_arr[j].goods_id + ",";
744 827 ab = 1;
745   - //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算---
746   - if(i_arr[j].prom_type==0 && th.data.sales_rules==2){
  828 + //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
  829 + if((i_arr[j].prom_type==0 || i_arr[j].prom_type==3 || i_arr[j].prom_type==5) && th.data.sales_rules==2 && i_arr[j].is_gift!=1){
747 830 //--获取商品的线下商品ID--
748 831 var gd=null;
749 832 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id,{}).then(res=>{
... ... @@ -759,9 +842,26 @@ Page({
759 842 wx.hideLoading();
760 843 return false;
761 844 }
  845 +
  846 + var is_ok=1;
  847 + //如果是优惠活动话,要看活动有没有过期
  848 + if(i_arr[j].prom_type==3){
  849 + //判断有没有活动
  850 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+i_arr[j].goods_id+"/1", {}).then(res => {
  851 + if(res.data.code==0){
  852 + if(!res.data.data.promGoodsLists){
  853 + t.my_warnning(i_arr[j].goods_name+"优惠活动已经过期", 0, th);
  854 + wx.hideLoading();
  855 + is_ok=0;
  856 + }
  857 + }
  858 + })
  859 + }
  860 + if(!is_ok){return false;}
762 861 }
763 862  
764 863 } else {
  864 + if(i_arr[j].is_gift==1) continue;
765 865 rq.put("/api/weshop/cart/update", {
766 866 data: {
767 867 id: i_arr[j].id,
... ... @@ -1006,7 +1106,188 @@ Page({
1006 1106 url: '/pages/index/index/index',
1007 1107 })
1008 1108 },
1009   -
1010   -
  1109 +
  1110 + //---加载更多是靠这个函数----
  1111 + onReachBottom: function() {
  1112 + if(this.data.requestData.length==0) {
  1113 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  1114 + if (goods_list) goods_list.get_list();
  1115 + }
  1116 + },
  1117 +
  1118 + //检查莫个门店下的商品是不是优惠活动,有的话,看要不要送礼品,同时有没有倍增
  1119 + check_prom_activity:async function (cindex) {
  1120 + var make_up_arr=new Array();
  1121 + var th=this;
  1122 + var map=new Map();
  1123 + var list=this.data.requestData[cindex];
  1124 + //循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量
  1125 + for(var i in list.goods){
  1126 + var item=list.goods[i];
  1127 + if(item.prom_type==3 && item.selected && !item.is_gift){
  1128 + if(map.has(item.prom_id+"")){
  1129 + var ob=map.get(item.prom_id+"");
  1130 + ob.num+=item.goods_num;
  1131 + ob.price+=item.goods_num*item.goods_price;
  1132 + map.set(item.prom_id+"",ob);
  1133 + }else{
  1134 + var ob={};
  1135 + ob.num=item.goods_num;
  1136 + ob.price=item.goods_num*item.goods_price;
  1137 + map.set(item.prom_id+"",ob);
  1138 + }
  1139 + }
  1140 + if(item.is_gift==1){
  1141 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  1142 + //getApp().request.delete(url, {});
  1143 + await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除
  1144 + list.goods.splice(i,1);
  1145 + }
  1146 + }
  1147 +
  1148 + var map2=new Map();
  1149 + //请那些是赠品,但是优惠活动并没有被选中的商品要删除,同时满足条件的要放到map2,
  1150 + for(var i in list.goods){
  1151 + var item=list.goods[i];
  1152 + if(item.is_gift){
  1153 + if(map.has(item.prom_id+"")){
  1154 + if(!map2.has(item.prom_id+"")){
  1155 + map2.set(item.prom_id+"",i)
  1156 + }
  1157 + }else{
  1158 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  1159 + list.goods.splice(i,1);
  1160 + getApp().request.delete(url, {});
  1161 + }
  1162 + }
  1163 + }
  1164 + for(let p_item of map.entries()){
  1165 + var prom=null;
  1166 + await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+p_item[0],{}).then(res=> {
  1167 + if(res.data.code==0){
  1168 + prom=res.data.data;
  1169 + }
  1170 + })
  1171 + //如果活动已经结束
  1172 + if(!prom || prom.is_end || prom.end_time<ut.gettimestamp() ){
  1173 + for(var ii in list.goods){
  1174 + var item=list.goods[ii];
  1175 + list.goods.splice(ii,1);
  1176 + if(item.prom_id==p_item[0] && item.prom_type==3){
  1177 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  1178 + getApp().request.delete(url, {});
  1179 + }
  1180 + }
  1181 + continue;
  1182 + }
  1183 + //---读取打折的详情---
  1184 + var ob=p_item[1];var discount=null;
  1185 + await getApp().request.promiseGet("/api/weshop/goods/getDiscount",{
  1186 + data: {
  1187 + price: ob.price,
  1188 + prom_id: p_item[0],
  1189 + goods_num: ob.num,
  1190 + user_id: getApp().globalData.user_id,
  1191 + is_bz: prom.is_bz
  1192 + }
  1193 + }).then(res=>{
  1194 + if(res.data.code==0) discount=res.data.data;
  1195 + })
  1196 +
  1197 + //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
  1198 + if(discount && discount['goods_id'] && discount.limit_num>=discount.bs && discount.gift_storecount>=discount.bs){
  1199 + var o=discount.goodsinfo;
  1200 + var newd = {
  1201 + goods_id: o.goods_id,
  1202 + goods_num: discount.bs,
  1203 + pick_id: list.pid,
  1204 + user_id: app.globalData.user_id,
  1205 + store_id: os.stoid,
  1206 + goods_price: 0,
  1207 + member_goods_price: 0,
  1208 + goods_name: o.goods_name,
  1209 + goods_sn: o.goods_sn,
  1210 + sku: o.sku,
  1211 + is_gift: 1,
  1212 + prom_id:p_item[0],
  1213 + prom_type:3,
  1214 + selected:1,
  1215 + gift_id:discount.gift_id
  1216 + };
  1217 +
  1218 + if(map2.has(p_item[0]+"")){
  1219 + var index=map2.get(p_item[0]+"");
  1220 + if( list.goods[index].goods_num!=discount.bs){
  1221 + list.goods[index].goods_num=discount.bs;
  1222 + getApp().request.put("/api/weshop/cart/update", {
  1223 + data: {
  1224 + id: list.goods[index].id,
  1225 + selected: 1,
  1226 + store_id: oo.stoid,
  1227 + goods_num:discount.bs
  1228 + },
  1229 + success: function(ee) {
  1230 + console.log(ee);
  1231 + }
  1232 + });
  1233 + }
  1234 +
  1235 + }else{
  1236 + var add_data=null;
  1237 + await getApp().request.promisePost("/api/weshop/cart/save", { data: newd }).then(res=>{
  1238 + if(res.data.code==0){
  1239 + add_data=res.data.data;
  1240 + }
  1241 + })
  1242 + if(add_data){
  1243 + newd.id=add_data.id;
  1244 + list.goods.push(newd);
  1245 + }
  1246 + }
  1247 + }
  1248 +
  1249 +
  1250 +
  1251 + //-- 获取 --
  1252 + await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
  1253 + data:{prom_id:prom.id}
  1254 + }).then(res=>{
  1255 + if(res.data.code==0){
  1256 + var list=res.data.data;
  1257 + for(var i in list){
  1258 + var item=list[i];
  1259 + if(item.prom_type==0){
  1260 + if(ob.price<item.condition){
  1261 + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)}
  1262 + make_up_arr.push(elem); break;
  1263 + }
  1264 + }else{
  1265 + if(ob.num<item.condition){
  1266 + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.num).toFixed(2), content:JSON.parse(item.preferential_type)}
  1267 + make_up_arr.push(elem);break;
  1268 + }
  1269 + }
  1270 + }
  1271 + }
  1272 + })
  1273 + }
  1274 + //--更新购物车的前台渲染--
  1275 + var rq_text="requestData["+cindex+"]";
  1276 + this.setData({[rq_text]:list});
  1277 + var diff_text="requestData["+cindex+"].make_up_arr";
  1278 + //-- 如果有凑单的话 --
  1279 + if(make_up_arr.length>0){
  1280 + this.setData({[diff_text]:make_up_arr});
  1281 + }else{
  1282 + this.setData({[diff_text]:null});
  1283 + }
  1284 + },
  1285 +
  1286 + //去凑单
  1287 + go_cou_dang:function (e) {
  1288 + var prom_id=e.currentTarget.dataset.prom_id;
  1289 + var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id;
  1290 + getApp().goto(url);
  1291 + }
1011 1292  
1012 1293 });
1013 1294 \ No newline at end of file
... ...
pages/cart/cart/cart.json
1 1 {
2 2 "navigationBarTitleText": "购物车",
3 3 "usingComponents": {
4   - "warn": "/components/long_warn/long_warn"
  4 + "warn": "/components/long_warn/long_warn",
  5 + "goods_recommend":"/components/goods_list/goods_list"
5 6 }
6 7 }
7 8 \ No newline at end of file
... ...
pages/cart/cart/cart.wxml
... ... @@ -32,16 +32,25 @@
32 32  
33 33 </view>
34 34 <view class="order-item" data-item="{{idx}}" wx:for="{{item.goods}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}">
35   - <view bindtap="check_th_item" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}">
  35 + <block wx:if="{{!items.is_gift}}">
  36 + <view bindtap="check_th_item" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}">
36 37 <!--<radio color="red" checked="{{checkAllToggle||items.selected}}"></radio>-->
37   - <icon wx:if="{{checkAllToggle||items.selected}}" color="red" size="20" type="success"></icon>
38   - <text wx:else class="icon_no_sele"></text>
39   - </view>
  38 + <icon wx:if="{{checkAllToggle||items.selected}}" color="red" size="20" type="success"></icon>
  39 + <text wx:else class="icon_no_sele"></text>
  40 + </view>
  41 + </block>
  42 + <block wx:else><view class="order-raido flex-vertical " style="width: 45rpx"></view></block>
  43 +
40 44 <navigator class="goods-img rel" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{items.goods_id}}">
41 45 <image class="wh100" src="{{items.original_img}}" binderror="bind_bnerr2" data-errorimg="requestData[{{pidx}}].goods[{{idx}}].original_img" data-url="{{items.original_img}}"></image>
42   - <view class="abs flex-center fs26" wx:if="{{items.distr_type==0}}">自选</view>
43   - <view class="abs flex-center fs26" wx:if="{{items.distr_type==1}}">自提</view>
44   - <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view>
  46 + <block wx:if="{{items.is_gift}}">
  47 + <view style="background-color:red" class="abs flex-center fs26" wx:if="{{items.is_gift==1}}">赠品</view>
  48 + </block>
  49 + <block wx:else>
  50 + <view class="abs flex-center fs26" wx:if="{{items.distr_type==0}}">自选</view>
  51 + <view class="abs flex-center fs26" wx:if="{{items.distr_type==1}}">自提</view>
  52 + <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view>
  53 + </block>
45 54  
46 55 </navigator>
47 56 <view class="goods-cont">
... ... @@ -53,9 +62,14 @@
53 62 {{items.goods_color}}{{items.goods_color?"/":''}}{{items.goods_spec}}</view>
54 63 <view wx:else>规格1</view>
55 64 </view>
  65 + <block wx:if="{{items.is_gift}}">
  66 + <view>{{items.goods_num}}件</view>
  67 + </block>
56 68 </view>
57 69  
58   - <view class="flex alend jc_sb">
  70 +
  71 + <block wx:if="{{!items.is_gift}}">
  72 + <view class="flex alend jc_sb">
59 73 <view class="goods-price co-red baseline ellipsis-1">
60 74 <view class="fs20">¥</view>
61 75 <view class="fs28">{{items.goods_price}}</view>
... ... @@ -66,9 +80,28 @@
66 80 <view class="add" bindtap="addNum" data-pitems="{{pidx}}" data-item="{{idx}}">+</view>
67 81 </view>
68 82 </view>
  83 + </block>
69 84 </view>
70 85 </view>
71 86 </view>
  87 + <!--- 去凑单 -->
  88 + <view style="margin-top: 20rpx; padding: 0 30rpx">
  89 + <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
  90 + <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text>
  91 + <text wx:if="{{item.diff_type==1}}">件</text>
  92 + </text>,
  93 + <text wx:if="{{item.content.is_money==1}}">免{{item.content.money}}元|</text>
  94 + <text wx:if="{{item.content.is_sale==1}}">打{{item.content.sale}}折|</text>
  95 + <text wx:if="{{item.content.is_past==1}}">包邮|</text>
  96 + <text wx:if="{{item.content.is_coupon==1}}">送优惠券|</text>
  97 + <text wx:if="{{item.content.is_int==1}}">送积分|</text>
  98 + <text wx:if="{{item.content.is_gift==1}}">送赠品|</text>
  99 + <text wx:if="{{item.content.is_libao==1}}">送礼包|</text>
  100 + <text></text>
  101 + </view>
  102 + <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
  103 + </view>
  104 + </view>
72 105 </block>
73 106 </view>
74 107 <view class="pay-for flex-vertical-between">
... ... @@ -113,4 +146,44 @@
113 146 </view>
114 147 </view>
115 148  
116   -<warn id="warn"></warn>
117 149 \ No newline at end of file
  150 +<!-- 好物推荐 -->
  151 +<view class="title" style="margin-top: 60rpx; margin-bottom:{{isTabBar == true ? '50px' : '0'}}" wx:if="{{(!requestData|| requestData.length==0) && is_load}}">
  152 + <!-- 标题 -->
  153 + <view>
  154 + <!-- 中文名标题 -->
  155 + <view class="China flex-level">
  156 + <view class="line flex-vertical">
  157 + <view class="one"></view>
  158 + <view class="two"></view>
  159 + <view class="three"></view>
  160 + </view>
  161 +
  162 + <view class="Recommend flex-level" bindtap="requestList">好物推荐</view>
  163 +
  164 + <view class="line flex-vertical">
  165 + <view class="three"></view>
  166 + <view class="two"></view>
  167 + <view class="one"></view>
  168 + </view>
  169 + </view>
  170 +
  171 + <!-- 英文标题 -->
  172 + <view class="english flex-center">
  173 + <view class="silk"></view>
  174 + <view class="esh five-level-word">GOOD HOT THING</view>
  175 + <view class="silk"></view>
  176 + </view>
  177 +
  178 + </view>
  179 + <!-- 商品列表组件 -->
  180 + <goods_recommend id="goods_list"></goods_recommend>
  181 +</view>
  182 +
  183 +
  184 +
  185 +
  186 +<warn id="warn"></warn>
  187 +<!-- <view wx:if="{{isTabBar == true}}">
  188 + <import src="../../tabbar/tabbar.wxml" />
  189 + <template is="tabBar" data="{{tabBar}}" />
  190 +</view> -->
118 191 \ No newline at end of file
... ...
pages/cart/cart/cart.wxss
... ... @@ -267,9 +267,9 @@ radio {
267 267 /* 购物车为空 */
268 268  
269 269 .empty_order image {
270   - width: 329rpx;
271   - height: 229rpx;
272   - margin-top: 140rpx;
  270 + width: 129rpx;
  271 + height: 129rpx;
  272 + margin-top: 120rpx;
273 273 }
274 274  
275 275 .empty_order .xc-ash {
... ... @@ -278,7 +278,7 @@ radio {
278 278 }
279 279  
280 280 .empty_order navigator {
281   - margin-top: 60rpx;
  281 + margin-top: 20rpx;
282 282 border-radius: 40rpx;
283 283 }
284 284  
... ... @@ -294,3 +294,55 @@ radio {
294 294 margin-left: 30rpx; margin-right: 25rpx}
295 295  
296 296 .mlr{ margin-left: 25rpx; margin-right: 20rpx}
  297 +
  298 +/* 热门好物 */
  299 +
  300 +.title .China {
  301 + width: 100%;
  302 + margin-top: 10rpx;
  303 + margin-bottom: 10rpx;
  304 + line-height: 0rpx;
  305 +}
  306 +
  307 +.title .China .line view {
  308 + width: 2rpx;
  309 +}
  310 +
  311 +.title .China .line {
  312 + height: 40rpx;
  313 + color: rgb(51, 51, 51);
  314 +}
  315 +
  316 +.title .China .line view {
  317 + border-left: 3rpx solid #000;
  318 + margin-left: 5rpx;
  319 +}
  320 +
  321 +.title .China .line .one {
  322 + height: 23rpx;
  323 +}
  324 +
  325 +.title .China .line .two {
  326 + height: 15rpx;
  327 +}
  328 +
  329 +.title .China .line .three {
  330 + height: 18rpx;
  331 +}
  332 +
  333 +.title .China .Recommend {
  334 + margin: 0rpx 20rpx;
  335 + font-size: 28rpx;
  336 + line-height: 39rpx;
  337 + font-weight: bold;
  338 +}
  339 +
  340 +.title .english .silk {
  341 + width: 214rpx;
  342 + height: 2rpx;
  343 + background-color: #000;
  344 +}
  345 +
  346 +.title .english .esh {
  347 + margin: 0rpx 15rpx;
  348 +}
... ...
pages/cart/cart2/cart2.js
... ... @@ -34,6 +34,7 @@ Page({
34 34 },
35 35 /*-----------当是购物车结算的时候-------------*/
36 36 cartlist:null,
  37 + old_cartlist:null,
37 38 cartlist_y:null, //购物车原始列表
38 39 js_use_money: 0, //是否使用余额
39 40 is_all_zt:1, //是否全部都是自提
... ... @@ -95,6 +96,14 @@ Page({
95 96 is_no_by:{},
96 97 is_by:{},
97 98 is_quan_by:{},
  99 + //--购买赠送的商品--
  100 + buy_now_gift_goods:null,
  101 + //--订单优惠--
  102 + order_prom:{},
  103 + //-- 购物车优惠活动 --
  104 + prom_goods_map:{},
  105 + //-- order_prom_list --
  106 + order_prom_list_cart:null,
98 107  
99 108 },
100 109 onLoad: function(t) {
... ... @@ -143,10 +152,38 @@ Page({
143 152 console.log("getuser_addr")
144 153 console.log(ie)
145 154  
146   - th.setData({user_addr: ie });
147   - var going=0;
  155 + //地址切换要把包邮券清空
  156 + if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
  157 + var using_quan=th.data.using_quan;
  158 + for(var i in using_quan){
  159 + var item=using_quan[i];
  160 + if(item.isby==1){
  161 + var ob={},txt="using_quan["+i+"]";ob[txt]={};
  162 + th.setData(ob);
  163 + }
  164 + }
  165 + th.data.isget_by_quan={};
  166 + }
  167 +
  168 + //更换地址回来要重新调用计算价钱的接口
  169 + if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
  170 + if (th.data.is_b_now == 1) {
  171 + if(th.data.bn_goods) {
  172 + th.calculatePrice2();
  173 + }
  174 + }else{
  175 + if (th.data.cartlist){
  176 + th.calculatePrice();
  177 + }
  178 + }
  179 + }
  180 +
  181 + th.setData({user_addr: ie });
  182 + var going=0;
  183 +
148 184  
149 185 //使用计时器,避免空现象
  186 + /*---
150 187 var jishi= setInterval(function () {
151 188 if (th.data.is_b_now == 1 && going==0) {
152 189 if(th.data.bn_goods) {
... ... @@ -157,7 +194,7 @@ Page({
157 194 th.calculatePrice();going = 1; clearInterval(jishi);
158 195 }
159 196 }
160   - },500)
  197 + },500)--*/
161 198  
162 199 });
163 200 //--更新默认地址--,看一下是不是跳到地址页面
... ... @@ -171,7 +208,6 @@ Page({
171 208  
172 209 //-------------------获取物流---------------
173 210 get_wuliu(func) {
174   -
175 211 var th = this;
176 212 to.getwuliu(function (e) {
177 213 th.setData({ wu_arr: e })
... ... @@ -256,9 +292,9 @@ Page({
256 292 var th = this,app=getApp();
257 293 a.get("/api/weshop/cart/list", {
258 294 data: {
259   - user_id: to.globalData.user_id, selected:1,
  295 + user_id: to.globalData.user_id, selected:1,state:0,
260 296 store_id: oo.stoid, pageSize: 600 },
261   - success:function (su) {
  297 + success:async function (su) {
262 298 //按门店分类的数组
263 299 var arr = new Array();
264 300 var carr = su.data.data.pageData;
... ... @@ -266,8 +302,11 @@ Page({
266 302  
267 303 for (var i = 0; i < carr.length; i++) {
268 304 var item = carr[i];
  305 + //要把优惠活动加入,prom_goods_map中,赠品不要运算
  306 + if(item.prom_type==3 && item.is_gift!=1){
  307 + await th.add_prom_goods_map(item);
  308 + }
269 309 item.original_img = oo.imghost + item.original_img;
270   -
271 310 /*----接口要弄出来的,先顶着-----*/
272 311 var pcid = item.pick_id;
273 312 var find = 0;
... ... @@ -320,13 +359,23 @@ Page({
320 359 arr.push(ie);
321 360 }
322 361 }
  362 + //深拷贝
  363 + th.data.old_cartlist= JSON.parse(JSON.stringify(arr));
323 364 th.setData({
324 365 cartlist: arr,
325   - }),
326   -
327   - th.calculatePrice();
  366 + });
328 367 //--- 获取一下看有没有优惠券 ----
329   - th.get_cart_quan();
  368 + setTimeout(function () {
  369 + var frozenQuan=null;
  370 + var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
  371 + app.request.promiseGet(url0,{1:1}).then(res=>{
  372 + if(res.data.code==0){ frozenQuan=res.data.data; th.data.frozenQuan=frozenQuan; }
  373 + th.calculatePrice();
  374 + th.get_cart_quan();
  375 + })
  376 +
  377 + },500)
  378 +
330 379 }
331 380 });
332 381 },
... ... @@ -360,7 +409,6 @@ Page({
360 409 var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; }
361 410 }
362 411 }
363   -
364 412 switch (gd.prom_type){
365 413 case 0:
366 414 case 2:
... ... @@ -371,21 +419,99 @@ Page({
371 419 //--此时开始计算商品的使用券相关,如果有等级价还要计算和等级价相关的,
372 420 // 如果有优惠促销,还要把促销的部分计算在内,因为促销还有不能使用优惠券--
373 421 t.data.data.shop_price=gg.goods_price;
  422 + t.data.data.goods_price=gg.goods_price;
  423 + t.data.data.goods_num=gg.goods_num;
374 424 th.data.ckeck_quan_price=t.data.data.shop_price*gg.goods_num;
375 425 th.data.check_quan_price_list=t.data.data.shop_price*gg.goods_num+"";
376 426 th.data.check_quan_ware_list=t.data.data.erpwareid+"";
377 427  
378 428 t.data.data.prom_id = 0;
379 429 t.data.data.prom_type = 0;
380   -
381   - th.setData({
382   - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,
383   - bn_pick: gg.pick_id, bn_t_exp_t: distr_t
384   - });
385   - //计算价格
386   - th.calculatePrice2();
387   - //获取优惠券
388   - th.get_buy_now_quan();
  430 +
  431 + //如果立即购买那边过来,就要读取接口,查看活动的优惠内容
  432 + if(gg.prom_type==3){
  433 + t.data.data.prom_id = gg.prom_id ;
  434 + t.data.data.prom_type =3;
  435 + //如果是优惠活动,就要调用活动,计算价格
  436 + th.buy_now_prom_goods(gg.prom_id, t.data.data,function (data) {
  437 + //判断一下购买商品的数量是不是超过
  438 + if(data.gift_goods_id){
  439 + var num=1;
  440 + if(data.is_bz==1){
  441 + num=data.bs;
  442 + if (num > data.gift_limitnum) num = 0;
  443 + }
  444 + //如果赠品数量超出礼品库存,就取消
  445 + if(num>data['gift_storecount']) num=0;
  446 + if(num>0){
  447 + var ob={};
  448 + ob.is_gift=1;
  449 + ob.prom_id=data.prom_id;
  450 + ob.goods_id=data.gift_goods_id;
  451 + ob.goods_name=data.gift_goods_name;
  452 + ob.goods_color=data.gift_goods_color;
  453 + ob.goods_spec=data.gift_goods_spec;
  454 + ob.original_img=os.imghost+data.gift_original_img;
  455 + ob.market_price=data.gift_market_price;
  456 + ob.gift_id=data.gift_id;
  457 + ob.shop_price=0;
  458 + ob.buynum=num;
  459 + ob.weight=data.gift_weight; //商品的重量
  460 + ob.exp_sum_type=data.gift_exp_sum_type; //商品的物流计算方式
  461 + th.setData({buy_now_gift_goods:ob});
  462 + }
  463 + }
  464 +
  465 + th.setData({
  466 + bn_goods: data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,
  467 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t
  468 + });
  469 +
  470 + //计算价格
  471 + th.calculatePrice2();
  472 + //获取优惠券
  473 + th.get_buy_now_quan();
  474 +
  475 + })
  476 +
  477 + }else{
  478 + //--看是不是搭配促销--
  479 + if(gg.prom_type==5){
  480 + t.data.data.prom_id = gg.prom_id ;
  481 + t.data.data.prom_type =5;
  482 + th.setData({collocation_goods:gg.collocation_goods});
  483 +
  484 + var cart_arr=new Array();
  485 + var narr=gg.collocation_goods;
  486 + narr.push(t.data.data);
  487 + var ie = {
  488 + pickup_id: gg.pick_id, pname: gg.pick_name, goods: narr, exp_type: et, wind: m_wind, distr_t: distr_t,
  489 + goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0};
  490 + cart_arr.push(ie);
  491 + th.data.old_cartlist=cart_arr;
  492 + }
  493 + th.setData({
  494 + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,
  495 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t
  496 + });
  497 +
  498 + //--搭配促销也是按照购物车的方式来计算优惠券--
  499 + if(gg.prom_type==5){
  500 + var frozenQuan=null;
  501 + var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
  502 + app.request.promiseGet(url0,{1:1}).then(res=> {
  503 + if(res.data.code==0){ frozenQuan=res.data.data; th.data.frozenQuan=frozenQuan; }
  504 + //计算价格
  505 + th.calculatePrice2();
  506 + th.get_cart_quan();
  507 + });
  508 + }else{
  509 + //计算价格
  510 + th.calculatePrice2();
  511 + //获取优惠券,
  512 + th.get_buy_now_quan();
  513 + }
  514 + }
389 515  
390 516 break;
391 517 case 1: //---秒杀-----
... ... @@ -461,14 +587,16 @@ Page({
461 587 to.getConfig2(function(ee){
462 588 to.getwuliuprice( async function (rs) {
463 589  
464   - var all_price=0; //所有的商品总价
465   - var all_shipping_m= 0; //所有的物流总价
466   - var all_total_m = 0; //所有的订单应付总价
467   - var all_order_m = 0; //所有的订单应付总价
468   - var all_user_m=0; //所有的订单用户使用金额
  590 + var all_price=0; //所有的商品总价
  591 + var all_shipping_m= 0; //所有的物流总价
  592 + var all_total_m = 0; //所有的订单应付总价
  593 + var all_order_m = 0; //所有的订单应付总价
  594 + var all_user_m=0; //所有的订单用户使用金额
469 595 var all_coupon_price_m=0; //所有的订单用户使用优惠券价格
470   - var umoney = th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money;
  596 + var all_cutprice=0; //所有的优惠减件
  597 + var all_order_prom=0; //所有的订单优惠
471 598  
  599 + var umoney = th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money;
472 600 var freight_free = ee.freight_free; //全场满多少包邮
473 601 var no_ex_id=ee.no_ex_id;
474 602 var no_ex_good=null;
... ... @@ -483,11 +611,25 @@ Page({
483 611 by_qc=res.data.data[0];
484 612 }
485 613 })
486   - }
487   -
488   - var c_arr=th.data.cartlist;
  614 + };
  615 + var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist));
489 616 //---循环购物车---
490   - for(var i=0;i<c_arr.length;i++){
  617 + for(var i in c_arr){
  618 + //因为搭配购买也是再这里计算,搭配购的is_b_now==1
  619 + if(th.data.is_b_now==0) {
  620 + //此时物流的选择方式要用th.data.cartlist;
  621 + c_arr[i].exp_type = th.data.cartlist[i].exp_type;
  622 + c_arr[i].wind = th.data.cartlist[i].wind;
  623 + if(th.data.cartlist[i].check_quan_price_list) c_arr[i].check_quan_price_list= th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格
  624 + if(th.data.cartlist[i].check_quan_ware_list) c_arr[i].check_quan_ware_list= th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品
  625 + }else{
  626 + c_arr[i].exp_type = th.data.bn_exp_type; //配送方式
  627 + c_arr[i].wind = th.data.index; //立即购买选择的物流
  628 + //c_arr[i].=th.data. //立即购买的使用余额
  629 + if(th.data.cartlist) c_arr[i].check_quan_price_list= th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格
  630 + if(th.data.cartlist) c_arr[i].check_quan_ware_list= th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品
  631 + }
  632 +
491 633 var cart_item=c_arr[i];
492 634 var pickid=cart_item.pickup_id;
493 635 var o_price=0;
... ... @@ -499,13 +641,113 @@ Page({
499 641 for(var j=0;j<item.length;j++){
500 642 o_price += item[j].goods_price * item[j].goods_num;
501 643 }
502   -
503   - th.data.cartlist[i].goods_price = o_price.toFixed(2); //商品总费用
  644 + var f_o_price=o_price;
  645 + var prom_g=th.data.prom_goods_map[pickid];
  646 +
  647 + //判断包邮券的钱
  648 + var q_conditin=0;
  649 + q_conditin=o_price;
  650 + //---如果该门店的相关活动,就要算一下减价--
  651 + if(th.data.prom_goods_map[pickid]){
  652 + var ob=th.data.prom_goods_map[pickid];
  653 + for(var ii in ob){
  654 + var item_map=ob[ii];
  655 + if(item_map.bs==undefined || item_map.bs==null) {
  656 + //等待,获取一下优惠活动的信息
  657 + await getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
  658 + data: {
  659 + price: item_map.price, prom_id: item_map.prom_id,
  660 + goods_num: item_map.goods_num, user_id: getApp().globalData.user_id,
  661 + is_bz: item_map.is_bz
  662 + }
  663 + }).then(res => {
  664 + if (res.data.code == 0 && res.data.data.condition) {
  665 + var get_data = res.data.data;
  666 + item_map.is_bz = get_data.is_bz; //是不是倍增
  667 + item_map.bs = get_data.bs; //是不是倍数
  668 + item_map.is_past = get_data.is_past; //是不是包邮
  669 + item_map.prom_price = get_data.price?get_data.price:item_map.price;
  670 + item_map.s_intValue = get_data.intValue;
  671 + item_map.s_coupon_id = get_data.coupon_id;
  672 + item_map.s_coupon_num = get_data.coupon_num;
  673 + if(get_data.gift_id && get_data.goodsinfo) {
  674 + item_map.gift_id = get_data.gift_id;
  675 + item_map.gift_goods_id = get_data.goods_id;
  676 + item_map.gift_goods_name = get_data.goods_name;
  677 + item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : '';
  678 + item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : '';
  679 + item_map.gift_original_img = get_data.goodsinfo.original_img;
  680 + item_map.gift_limit_num = get_data.limit_num;
  681 + item_map.gift_storecount = get_data.gift_storecount;
  682 + item_map.gift_weight = get_data.goodsinfo.weight;
  683 + item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type;
  684 + }
  685 + item_map.s_libao = get_data.libao;
  686 + item_map.s_lb_num = get_data.lb_num;
  687 + }
  688 + })
  689 + }
  690 + //--------循环计算商品是不是包邮,是不是使用优惠券-----------
  691 + for(var j=0;j<item.length;j++){
  692 + if(item[j].prom_type==3 && item[j].prom_id==item_map.prom_id){
  693 + item[j].is_xz_yh= item_map.is_xz_yh;
  694 + item[j].is_past= item_map.is_past;
  695 + }
  696 + }
  697 + //有活动,且优惠活动并没有限制使用优惠券,且有减价
  698 + //if(item_map && !item_map.is_xz_yh && item_map.price) q_conditin=o_price-item_map.price;
  699 + //--看有没有减价--
  700 + if(item_map.prom_price && item_map.price-item_map.prom_price){
  701 + if(cart_item.prom_pt_json){
  702 + cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0})
  703 + }else{
  704 + cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}];
  705 + }
  706 +
  707 + o_price-=(item_map.price-item_map.prom_price);
  708 + //如果有限制使用优惠券,就要减掉参与的活动商品的钱
  709 + if(!item_map.is_xz_yh) q_conditin=o_price;
  710 + }
  711 +
  712 + //--优惠多少钱--
  713 + if(!cart_item.cut_price) cart_item.cut_price=0;
  714 + cart_item.cut_price+=(item_map.price-item_map.prom_price);
  715 + //---如果有送积分---
  716 + if(item_map.s_intValue){
  717 + if(!cart_item.s_intValue) cart_item.s_intValue=0;
  718 + cart_item.s_intValue+=item_map.s_intValue;
  719 + }
  720 + //-- 如果有送优惠券的情况 --
  721 + if(item_map.s_coupon_id){
  722 + if(!cart_item.s_coupon_id) {
  723 + cart_item.s_coupon_id=item_map.s_coupon_id+"";
  724 + cart_item.g_coupon_num=[{'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}];
  725 + }
  726 + else{
  727 + cart_item.s_coupon_id+=","+item_map.s_coupon_id;
  728 + cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num})
  729 + }
  730 + }
  731 + //-- 如果有送优包邮券的情况 --
  732 + if(item_map.s_libao){
  733 + if(!cart_item.s_libao) {
  734 + cart_item.s_libao=item_map.s_libao+"";
  735 + cart_item.g_lb_num=[{'l_id':item_map.s_libao,"num": item_map.s_lb_num}];
  736 + }
  737 + else{
  738 + cart_item.s_libao+=","+item_map.s_libao;
  739 + cart_item.g_lb_num.push({'l_id':item_map.s_libao,"num": item_map.s_lb_num})
  740 + }
  741 + }
  742 + }
  743 + }
  744 +
  745 + cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算
504 746 //计算物流费用
505   - th.data.cartlist[i].shipping_price = 0;
  747 + cart_item.shipping_price = 0;
506 748  
507 749 //--有不包邮区域,且不免运费,全场的计算--
508   - if(no_ex_id && freight_free>0 && o_price>freight_free && c_arr[i].exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){
  750 + if(no_ex_id && freight_free>0 && o_price>=freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){
509 751 //如果有设置不包邮区域的时候
510 752 if(by_qc.region_list!="" && by_qc.region_list!=null && by_qc.region_list!=undefined ){
511 753 if(th.check_by_area(by_qc.region_list)){
... ... @@ -519,13 +761,13 @@ Page({
519 761 }
520 762 }
521 763  
522   - //--如果是物流,且选择了地址,就要开始显示包邮券--
523   - if (c_arr[i].exp_type == 0 && th.data.user_addr != null) {
  764 + //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额--
  765 + if (cart_item.exp_type == 0 && th.data.user_addr != null) {
524 766 //看是不是有调用过包邮券
525 767 if(!th.data.isget_by_quan[pickid]){
526   - //--判断要不要显示包邮券,链式调用接口---
527   - getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{
528   - data:{store_id:os.stoid,isuse:0,condition:o_price,user_id:getApp().globalData.user_id,pageSize:2000}
  768 + //--判断要不要显示包邮券,调用接口,因为有for循环---
  769 + await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{
  770 + data:{store_id:os.stoid,isuse:0,condition:q_conditin,user_id:getApp().globalData.user_id,pageSize:2000}
529 771 }).then(res=>{
530 772 if(res.data.code==0 && res.data.data.total>0){
531 773 //此时要循环判断包邮的地区,不包邮商品是不是符合
... ... @@ -538,7 +780,6 @@ Page({
538 780 for(var ii in goods){
539 781 g_arr.push(goods[ii].goods_id);
540 782 }
541   -
542 783 if(item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域
543 784 if(item.goods_list){
544 785 var no_goods_arr=item.goods_list.split(",");
... ... @@ -548,7 +789,10 @@ Page({
548 789 }
549 790 if(arr){
550 791 th.data.get_by_quan_list_cart[pickid]=arr;
551   - th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart});
  792 + //th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart});
  793 + if(th.data.is_b_now){
  794 + th.setData({get_by_quan_list:arr});
  795 + }
552 796 }
553 797 th.data.isget_by_quan[pickid]=1;
554 798 }
... ... @@ -589,18 +833,25 @@ Page({
589 833 for(var j=0;j<item.length;j++){
590 834 //如果都包邮,都没必要等级数量了
591 835 if(th.data.is_quan_by[pickid]) continue;
  836 + //如果是优惠活动是包邮,就不用计算包邮的费用了
  837 + if(item[j].is_past) continue;
592 838 //是不是不包邮的商品
593 839 var is_good_no_by=0;
594 840 if(no_ex_good){
595 841 is_good_no_by=th.check_by_goods(no_ex_good,item[j].goods_id);
596 842 }
597 843 //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮
598   - if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1) continue;
  844 + if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){
  845 + continue;
  846 + }
599 847 //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算--
600   - if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by) continue;
  848 + if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){
  849 + continue;
  850 + }
  851 +
601 852  
602 853 //----------------如果是选择了物流---------------------
603   - if (c_arr[i].exp_type == 0 && item[j].is_free_shipping==0){
  854 + if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){
604 855 //如果地址不为空
605 856 if (th.data.user_addr!=null){
606 857 switch (item[j]['exp_sum_type']) {
... ... @@ -619,24 +870,24 @@ Page({
619 870 }
620 871 }
621 872 }
622   -
623   -
  873 +
  874 +
624 875 //计算物流价格
625 876 if (c_arr[i].exp_type == 0) {
626 877 freight_free=0; //后面不在进行判断
627 878 var code = th.data.wu_arr[c_arr[i].wind].code;
628   - th.data.cartlist[i].shipping_price =
  879 + cart_item.shipping_price =
629 880 th.calculatewuliu(code, o_shipping_price, goods_weight,
630 881 goods_piece,th.data.user_addr, freight_free, o_price, rs);
631 882  
632 883 if(!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby!=1){
633   - if( th.data.cartlist[i].shipping_price ==0) th.data.is_by[pickid]=0; //已经全场包邮,就不要选择券了
  884 + if( cart_item.shipping_price ==0) th.data.is_by[pickid]=1; //已经全场包邮,就不要选择券了
634 885 }
635 886 }else{
636   - th.data.cartlist[i].shipping_price=0;
  887 + cart_item.shipping_price=0;
637 888 }
638 889  
639   - th.data.cartlist[i].shipping_price=th.data.cartlist[i].shipping_price.toFixed(2);
  890 + cart_item.shipping_price=cart_item.shipping_price.toFixed(2);
640 891 //---如果有选择优惠券的情况下---
641 892 var quan_price=0;
642 893 var coupon_price=0;
... ... @@ -660,7 +911,7 @@ Page({
660 911 if (res.data.code == 0 && res.data.data.length > 0) {
661 912 var q_data = res.data.data;
662 913 //--存储商品优惠的内容--
663   - th.data.cartlist[i].quan_youhui_list = q_data;
  914 + cart_item.quan_youhui_list = q_data;
664 915 for (var k in q_data)
665 916 quan_price += q_data[k].WareCashSum;
666 917 }
... ... @@ -669,52 +920,96 @@ Page({
669 920 }
670 921  
671 922 //总价计算,总价不包含运费
672   - th.data.cartlist[i].order_amount= (o_price -quan_price).toFixed(2);
673   - th.data.cartlist[i].total_amount= o_price.toFixed(2);
  923 + cart_item.order_amount= (o_price -quan_price).toFixed(2);
  924 + cart_item.total_amount= f_o_price.toFixed(2);
  925 +
  926 + var order_prom_amount=0; var order_prom_id=0; var o_condition=cart_item.order_amount;
  927 + var order_m=0;
  928 + //---判断是不是有订单优惠---
  929 + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion",{
  930 + data:{store_id:os.stoid,orderAmount:cart_item.order_amount}
  931 + }).then(res=>{
  932 + if(res.data.code==0){
  933 + var ord_prom=res.data.data;
  934 + order_prom_id = ord_prom['id'];
  935 + switch (ord_prom['type']) {
  936 + case 0:
  937 + order_m = Math.round(o_condition * ord_prom['expression'])/100;//满额打折
  938 + order_prom_amount=(o_condition -order_m).toFixed(2);
  939 + break;
  940 + case 1:
  941 + //order_m = o_condition - ord_prom['expression'];//满额优惠金额
  942 + order_prom_amount= ord_prom['expression'];
  943 + break;
  944 + }
  945 + }
  946 + })
674 947  
  948 + cart_item.order_prom_amount=0;
  949 + //--订单优惠的显示--
  950 + if(order_prom_id>0){
  951 + cart_item.order_amount= (o_price -quan_price-order_prom_amount).toFixed(2);
  952 + cart_item.order_prom_id=order_prom_id;
  953 + cart_item.order_prom_amount=order_prom_amount;
  954 + }
675 955 coupon_price=quan_price;
676   - if( th.data.cartlist[i].order_amount<0){
677   - th.data.cartlist[i].order_amount=0;
  956 + if( cart_item.order_amount<0){
  957 + cart_item.order_amount=0;
678 958 coupon_price=o_price;
679 959 }
680 960  
681   - th.data.cartlist[i].total_amount= parseFloat(th.data.cartlist[i].total_amount)+parseFloat(th.data.cartlist[i].shipping_price); //总金额
682   - th.data.cartlist[i].order_amount=parseFloat(th.data.cartlist[i].order_amount)+parseFloat(th.data.cartlist[i].shipping_price); //总金额
  961 + cart_item.total_amount= parseFloat(cart_item.total_amount)+parseFloat(cart_item.shipping_price); //总金额
  962 + cart_item.order_amount=parseFloat(cart_item.order_amount)+parseFloat(cart_item.shipping_price); //总金额
  963 + cart_item.total_amount= cart_item.total_amount.toFixed(2);
  964 + cart_item.order_amount=cart_item.order_amount.toFixed(2);
683 965  
684   - th.data.cartlist[i].total_amount= th.data.cartlist[i].total_amount.toFixed(2);
685   - th.data.cartlist[i].order_amount=th.data.cartlist[i].order_amount.toFixed(2);
  966 + //搭配购在使用余额
  967 + if(th.data.bn_use_money==1 && th.data.is_b_now==1){
  968 +
  969 + if (umoney > cart_item.order_amount) {
  970 + cart_item.user_money = cart_item.order_amount;
  971 + umoney = umoney - cart_item.order_amount;
  972 + }else {
  973 + cart_item.user_money = umoney;
  974 + umoney=0;
  975 + }
686 976  
687   - //--------------如果使用余额---------------------
688   - if (th.data.js_use_money == 1) {
689   - if (umoney > th.data.cartlist[i].order_amount) {
690   - th.data.cartlist[i].user_money = th.data.cartlist[i].order_amount;
691   - umoney = umoney - th.data.cartlist[i].order_amount;
692   - }else {
693   - th.data.cartlist[i].user_money = umoney;
694   - umoney=0;
695   - }
696 977 }else{
697   - th.data.cartlist[i].user_money=0;
698   - }
  978 + //--------------如果使用余额,购物车购买---------------------
  979 + if (th.data.js_use_money == 1) {
  980 + if (umoney > cart_item.order_amount) {
  981 + cart_item.user_money = cart_item.order_amount;
  982 + umoney = umoney - cart_item.order_amount;
  983 + }else {
  984 + cart_item.user_money = umoney;
  985 + umoney=0;
  986 + }
  987 + }else{
  988 + cart_item.user_money=0;
  989 + }
  990 + }
  991 +
  992 +
699 993  
700   - th.data.cartlist[i].user_money = parseFloat(th.data.cartlist[i].user_money).toFixed(2);
  994 + cart_item.user_money = parseFloat(cart_item.user_money).toFixed(2);
701 995  
702   - if (coupon_price>0) th.data.cartlist[i].coupon_price=coupon_price.toFixed(2);
703   - else th.data.cartlist[i].coupon_price = coupon_price
704   - if(quan_no) th.data.cartlist[i].quan_no = quan_no;
  996 + if (coupon_price>0) cart_item.coupon_price=coupon_price.toFixed(2);
  997 + else cart_item.coupon_price = coupon_price
  998 + if(quan_no) cart_item.quan_no = quan_no;
705 999  
706   -
707   - th.data.cartlist[i].goods_price = o_price.toFixed(2);
708   - th.data.cartlist[i].order_amount= th.data.cartlist[i].order_amount- th.data.cartlist[i].user_money; //会员使用余额
709 1000  
  1001 + //cart_item.goods_price = o_price.toFixed(2);
  1002 + cart_item.order_amount= cart_item.order_amount- cart_item.user_money; //会员使用余额
710 1003  
711   - all_price += parseFloat(o_price);
712   - all_total_m += parseFloat(th.data.cartlist[i].total_amount);
713   - all_shipping_m += parseFloat(th.data.cartlist[i].shipping_price);
714   - all_order_m += parseFloat(th.data.cartlist[i].order_amount);
715   - all_user_m += parseFloat(th.data.cartlist[i].user_money);
716   - all_coupon_price_m+= parseFloat(th.data.cartlist[i].coupon_price);
717 1004  
  1005 + all_price += parseFloat(f_o_price);
  1006 + all_total_m += parseFloat(cart_item.total_amount);
  1007 + all_shipping_m += parseFloat(cart_item.shipping_price);
  1008 + all_order_m += parseFloat(cart_item.order_amount);
  1009 + all_user_m += parseFloat(cart_item.user_money);
  1010 + all_coupon_price_m+= parseFloat(cart_item.coupon_price);
  1011 + all_cutprice+=parseFloat(cart_item.cut_price);
  1012 + all_order_prom+=parseFloat(cart_item.order_prom_amount);
718 1013 }
719 1014  
720 1015 all_shipping_m=parseFloat(all_shipping_m).toFixed(2);
... ... @@ -724,6 +1019,8 @@ Page({
724 1019 all_user_m = parseFloat(all_user_m).toFixed(2);
725 1020 all_total_m = parseFloat(all_total_m).toFixed(2);
726 1021 all_coupon_price_m = parseFloat(all_coupon_price_m).toFixed(2);
  1022 + all_cutprice=all_cutprice.toFixed(2);
  1023 + all_order_prom=all_order_prom.toFixed(2);
727 1024  
728 1025 var atxt = "formData.total_amount";
729 1026 var atxt1 = "formData.order_amount";
... ... @@ -731,37 +1028,54 @@ Page({
731 1028 var atxt3 = "formData.user_money";
732 1029 var atxt4 = "formData.shipping_price";
733 1030 var atxt5 = "formData.coupon_price";
  1031 + var atxt6 = "formData.cut_price";
  1032 + var atxt7 = "formData.order_prom_amount";
734 1033  
735 1034 th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m,
736   - [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, [atxt5]: all_coupon_price_m })
737   -
  1035 + [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m,
  1036 + [atxt5]: all_coupon_price_m,[atxt6]: all_cutprice,
  1037 + [atxt7]: all_order_prom,
  1038 + })
  1039 + th.data.order_prom_list_cart=c_arr;
738 1040  
739 1041 });
740 1042 });
741 1043 },
742 1044 //---------计算立即购买----------
743 1045 calculatePrice2: function () {
744   -
745 1046 var th = this, good = this.data.bn_goods;
  1047 + //搭配的计算要用购物的车计算方法
  1048 + if(good.prom_type==5){
  1049 + th.calculatePrice();
  1050 + return false;
  1051 + }
746 1052 //-----------计算商品总价--------------
747 1053 var allpice = good.shop_price * good.buynum;
  1054 + var cut_price=0;
  1055 + if(good.prom_type==3 && good.prom_price){
  1056 + cut_price=allpice-good.prom_price;
  1057 + }
748 1058 allpice=parseFloat(allpice).toFixed(2);
749 1059 var txt = "formData.all_price";
750 1060 th.setData({ [txt]: allpice, });
751   - console.log(th.data.formData);
  1061 + if(cut_price){
  1062 + var c_txt="formData.cut_price";
  1063 + th.setData({ [c_txt]: cut_price, });
  1064 +
  1065 + }
752 1066  
753 1067 to.getConfig2(function (ee) {
754 1068 to.getwuliuprice(async function (rs) {
755 1069  
756 1070 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
757   - //-----------当地址不为空,且是物流时,计算物流费用----------
758   - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 ){
759   -
760   - //看是不是有调用过包邮券
761   - if(!th.data.isget_by_quan[th.data.bn_pick]){
762   - //--判断要不要显示包邮券,链式调用接口---
  1071 + //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮----------
  1072 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){
  1073 + //看是不是有调用过包邮券
  1074 + if(!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh!=1){
  1075 + var condition=allpice-cut_price;
  1076 + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额---
763 1077 getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{
764   - data:{store_id:os.stoid,isuse:0,condition:allpice,user_id:getApp().globalData.user_id,pageSize:2000}
  1078 + data:{store_id:os.stoid,isuse:0,condition:condition,user_id:getApp().globalData.user_id,pageSize:2000}
765 1079 }).then(res=>{
766 1080 if(res.data.code==0 && res.data.data.total>0){
767 1081 //此时要循环判断包邮的地区,不包邮商品是不是符合
... ... @@ -776,7 +1090,7 @@ Page({
776 1090 if(arr){
777 1091 th.setData({get_by_quan_list:arr});
778 1092 }
779   - th.data.isget_by_quan[th.data.bn_pick]=1;
  1093 + th.data.isget_by_quan[th.data.bn_pick]=1;
780 1094 }
781 1095 })
782 1096 }
... ... @@ -799,14 +1113,18 @@ Page({
799 1113 var freight_free = ee.freight_free; //全场满多少包邮
800 1114 var no_ex_id=ee.no_ex_id;
801 1115 th.data.is_no_by[th.data.bn_pick]=0;
802   -
  1116 +
  1117 +
  1118 + var no_by_data=null;
  1119 + var gift_freight_free=freight_free;
803 1120 //有不包邮区域,且不免运费
804   - if(no_ex_id && freight_free>0 && freight_free<=allpice){
  1121 + if(no_ex_id && freight_free>0 && freight_free<=allpice-cut_price){
805 1122 //-----------获取不包邮区域,不包邮商品-------
806 1123 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{
807 1124 data:{store_id:os.stoid,id:no_ex_id}
808 1125 }).then(res=>{
809 1126 if(res.data.code==0){
  1127 + no_by_data=res.data.data[0];
810 1128 //如果有设置不包邮区域的时候
811 1129 if(res.data.data[0].region_list){
812 1130 if(th.check_by_area(res.data.data[0].region_list)){
... ... @@ -829,7 +1147,13 @@ Page({
829 1147 //--------------开始计算物流------------------
830 1148 var shipping_price=
831 1149 th.calculatewuliu(code, o_shipping_price, goods_weight,
832   - goods_piece, th.data.user_addr, freight_free, allpice, rs);
  1150 + goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs);
  1151 +
  1152 + //如果有赠品的时候,也要计算赠品的物流费用
  1153 + if(th.data.buy_now_gift_goods){
  1154 + shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, allpice-cut_price, rs,shipping_price,no_by_data);
  1155 + }
  1156 +
833 1157 if(shipping_price<=0){
834 1158 th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券
835 1159 }
... ... @@ -863,39 +1187,132 @@ Page({
863 1187 }
864 1188 })
865 1189 }
866   -
867 1190 }
868 1191 //-----------------支付价,优惠券不减物流-----------------
869 1192 var total_m = (parseFloat(allpice)).toFixed(2);
870   - var order_m = (parseFloat(allpice)-quan_price).toFixed(2);
871   -
  1193 + var order_m = (parseFloat(allpice-cut_price)-quan_price).toFixed(2);
872 1194 var coupon_price=quan_price; //优惠券优惠了多少钱
873 1195 if(order_m<0) {
874 1196 order_m=0;coupon_price=parseFloat(order_m).toFixed(2);
875 1197 }
  1198 + //--看一下有没有订单优惠--
  1199 + var o_condition=parseFloat(order_m);
  1200 + if(o_condition>0){
  1201 + th.check_is_order_prom(o_condition,function () {
  1202 + var order_prom_amount=0; var order_prom_id=0;
  1203 + if(th.data.order_prom[th.data.bn_pick]){
  1204 + var ord_prom=th.data.order_prom[th.data.bn_pick];
  1205 + order_prom_id = ord_prom['id'];
  1206 + switch (ord_prom['type']) {
  1207 + case 0:
  1208 + order_m = Math.round(o_condition * ord_prom['expression'])/100;//满额打折
  1209 + order_prom_amount=(o_condition -order_m).toFixed(2);
  1210 + break;
  1211 + case 1:
  1212 + order_m = o_condition - ord_prom['expression'];//满额优惠金额
  1213 + order_prom_amount= ord_prom['expression'];
  1214 + break;
  1215 + }
  1216 + }
  1217 + //--订单优惠的显示--
  1218 + if(order_prom_id>0){
  1219 + var order_prom_txt1="formData.order_prom_id";
  1220 + var order_prom_txt2="formData.order_prom_amount";
  1221 + th.setData({ [order_prom_txt1]: order_prom_id,[order_prom_txt2]: order_prom_amount})
  1222 + }
876 1223  
877   - total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);
878   - order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);
879   -
880   - var atxt= "formData.total_amount";
881   - th.setData({ [atxt]: total_m, })
882   -
883   - var txt = "formData.user_money";
884   - var txt2 = "formData.order_amount";
885   - var txt3="formData.coupon_price";
886   - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
887   - //--------------如果使用余额---------------------
888   - if (th.data.bn_use_money == 1) {
889   - if (amoney> order_m) {
890   - order_m = order_m.toFixed(2);
891   - th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price })
  1224 + total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);
  1225 + order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);
  1226 + var atxt= "formData.total_amount";
  1227 + th.setData({ [atxt]: total_m, })
  1228 +
  1229 + var txt = "formData.user_money";
  1230 + var txt2 = "formData.order_amount";
  1231 + var txt3="formData.coupon_price";
  1232 + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
  1233 + //--------------如果使用余额---------------------
  1234 + if (th.data.bn_use_money == 1) {
  1235 + if (amoney> order_m) {
  1236 + order_m = order_m.toFixed(2);
  1237 + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price })
  1238 + }else{
  1239 + order_m =parseFloat(order_m - amoney);
  1240 + order_m = order_m.toFixed(2);
  1241 + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price })
  1242 + }
  1243 + }else{
  1244 + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price })
  1245 + }
  1246 + //优惠活动送积分
  1247 + if(good.s_intValue){
  1248 + txt = "formData.give_integral";
  1249 + th.setData({ [txt]:good.s_intValue });
  1250 + }
  1251 + //优惠送券
  1252 + if(good.s_coupon_id){
  1253 + var i_txt = "formData.give_coupon_id";
  1254 + //这个是json格式的
  1255 + var i_txt1 = "formData.g_coupon_num";
  1256 + var ob=[{"num":good.s_coupon_num,"c_id":good.s_coupon_id}];
  1257 + ob=JSON.stringify(ob);
  1258 + th.setData({ [i_txt]:good.s_coupon_id,[i_txt1]:ob });
  1259 + }
  1260 + //优惠礼包
  1261 + if(good.s_libao){
  1262 + var l_txt = "formData.give_lb_id";
  1263 + //这个是json格式的
  1264 + var l_txt1 = "formData.g_lb_num";
  1265 + var ob=[{"num":good.s_lb_num,"l_id":good.s_libao}];
  1266 + ob=JSON.stringify(ob);
  1267 + th.setData({ [l_txt]:good.s_libao,[l_txt1]:ob });
  1268 + }
  1269 + })
  1270 + }else{
  1271 + total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);
  1272 + order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);
  1273 + var atxt= "formData.total_amount";
  1274 + th.setData({ [atxt]: total_m, })
  1275 +
  1276 + var txt = "formData.user_money";
  1277 + var txt2 = "formData.order_amount";
  1278 + var txt3="formData.coupon_price";
  1279 + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
  1280 + //--------------如果使用余额---------------------
  1281 + if (th.data.bn_use_money == 1) {
  1282 + if (amoney> order_m) {
  1283 + order_m = order_m.toFixed(2);
  1284 + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price })
  1285 + }else{
  1286 + order_m =parseFloat(order_m - amoney);
  1287 + order_m = order_m.toFixed(2);
  1288 + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price })
  1289 + }
892 1290 }else{
893   - order_m =parseFloat(order_m - amoney);
894   - order_m = order_m.toFixed(2);
895   - th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price })
  1291 + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price })
  1292 + }
  1293 + //优惠活动送积分
  1294 + if(good.s_intValue){
  1295 + txt = "formData.give_integral";
  1296 + th.setData({ [txt]:good.s_intValue });
  1297 + }
  1298 + //优惠送券
  1299 + if(good.s_coupon_id){
  1300 + var i_txt = "formData.give_coupon_id";
  1301 + //这个是json格式的
  1302 + var i_txt1 = "formData.g_coupon_num";
  1303 + var ob=[{"num":good.s_coupon_num,"c_id":good.s_coupon_id}];
  1304 + ob=JSON.stringify(ob);
  1305 + th.setData({ [i_txt]:good.s_coupon_id,[i_txt1]:ob });
  1306 + }
  1307 + //优惠礼包
  1308 + if(good.s_libao){
  1309 + var l_txt = "formData.give_lb_id";
  1310 + //这个是json格式的
  1311 + var l_txt1 = "formData.g_lb_num";
  1312 + var ob=[{"num":good.s_lb_num,"l_id":good.s_libao}];
  1313 + ob=JSON.stringify(ob);
  1314 + th.setData({ [l_txt]:good.s_coupon_id,[l_txt1]:ob });
896 1315 }
897   - }else{
898   - th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price })
899 1316 }
900 1317  
901 1318 });
... ... @@ -904,13 +1321,14 @@ Page({
904 1321  
905 1322 //--------------------提交订单-----------------------
906 1323 async submitForm(t){
  1324 + var sub_value=t;
  1325 +
907 1326 if(this.data.is_summit_ing==1) return false; //--提交中退出--
908 1327 this.data.is_summit_ing=1;
909 1328 var th=this,pdata=new Array();
910 1329 var ff=true;
911 1330 //------------立即购买-------------
912   - if (th.data.is_b_now==1){
913   - console.log("buy_new");
  1331 + if (th.data.is_b_now==1 && th.data.bn_goods.prom_type!=5){
914 1332  
915 1333 if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){
916 1334 ff = false; getApp().my_warnning("请选择收货地址",0,th);
... ... @@ -920,17 +1338,12 @@ Page({
920 1338 var addr = th.data.user_addr;
921 1339 if (th.data.bn_exp_type == 1) addr=null;
922 1340  
923   - console.log(th.data.formData);
924   - console.log(th.data.wu_arr);
925   - console.log(th.data.bn_exp_type);
926   -
927 1341 if(th.data.bn_exp_type==0)
928 1342 if(th.data.wu_arr==null || th.data.wu_arr.length<=0){
929 1343 getApp().my_warnning("读取物流失败",0,th);
930 1344 return false;
931 1345 }
932 1346  
933   -
934 1347 var item={
935 1348 'user_id': to.globalData.user_id,
936 1349 'consignee': addr == null ? "" : addr.consignee,
... ... @@ -957,8 +1370,39 @@ Page({
957 1370 'exp_type': th.data.bn_exp_type, //配送方式
958 1371 'order_goods':new Array(),
959 1372 };
  1373 + //是不是重新提交
  1374 + if(th.data.is_continue==1) item.is_continue=1;
  1375 +
  1376 + var order_prom_list={};
  1377 + //--判断有没有优惠活动--
  1378 + if(th.data.order_prom[item.pickup_id]){
  1379 + if(th.data.formData.order_prom_amount>0){
  1380 + order_prom_list.order_prom_id=th.data.formData.order_prom_id;
  1381 + order_prom_list.order_prom_amount=th.data.formData.order_prom_amount;
  1382 + }
  1383 + }
  1384 +
  1385 + //--判断优惠活动的提交--
  1386 + if(th.data.formData.cut_price>0){
  1387 + order_prom_list.discount_amount=th.data.formData.cut_price.toFixed(2);
  1388 + var ob=[{"prom_id":th.data.bn_goods.prom_id,"dis":th.data.formData.cut_price.toFixed(2),"ispt":0}]
  1389 + order_prom_list.prom_pt_json=JSON.stringify(ob);
  1390 + }
  1391 + if(th.data.formData.give_integral>0){
  1392 + order_prom_list.give_integral=th.data.formData.give_integral;
  1393 + }
  1394 + if(th.data.formData.give_coupon_id>0){
  1395 + order_prom_list.give_coupon_id=th.data.formData.give_coupon_id;
  1396 + order_prom_list.g_coupon_num=th.data.formData.g_coupon_num;
  1397 + }
  1398 + if(th.data.formData.give_lb_id>0){
  1399 + order_prom_list.give_lb_id=th.data.formData.give_lb_id;
  1400 + order_prom_list.g_lb_num=th.data.formData.g_lb_num;
  1401 + }
  1402 + item.order_prom_list=order_prom_list;
  1403 +
960 1404 //组装优惠券的钱
961   - if(th.data.formData.coupon_price){
  1405 + if(parseFloat(th.data.formData.coupon_price)>0){
962 1406 item.coupon_price=th.data.formData.coupon_price;
963 1407 item.coupon_no=th.data.using_quan[th.data.bn_pick].coupon_no;
964 1408 }
... ... @@ -992,7 +1436,6 @@ Page({
992 1436 return false;
993 1437 }
994 1438 }
995   -
996 1439 //--组装优惠券的钱--
997 1440 if(th.data.formData.coupon_price){
998 1441 item.coupon_price=th.data.formData.coupon_price;
... ... @@ -1000,8 +1443,26 @@ Page({
1000 1443 goods.quan_num=th.data.formData.coupon_price;
1001 1444 goods.quan_no= item.coupon_no;
1002 1445 }
1003   -
1004 1446 item.order_goods.push(goods);
  1447 +
  1448 + //--如果有赠品的时候,赠品也要提交---
  1449 + if(th.data.buy_now_gift_goods){
  1450 + var gift_gg=th.data.buy_now_gift_goods;
  1451 + var g_goods={
  1452 + 'goods_id': gift_gg.goods_id,
  1453 + 'goods_name': gift_gg.goods_name,
  1454 + 'goods_sn': gift_gg.goods_sn,
  1455 + 'goods_num': gift_gg.buynum,
  1456 + 'market_price': gift_gg.market_price,
  1457 + 'goods_price': 0,
  1458 + 'member_goods_price': 0,
  1459 + 'store_id': oo.stoid,
  1460 + 'is_gift':1,
  1461 + 'gift_id':gift_gg.gift_id,
  1462 + 'prom_id':gift_gg.prom_id,
  1463 + };
  1464 + item.order_goods.push(g_goods);
  1465 + }
1005 1466 pdata.push(item);
1006 1467  
1007 1468 console.log(pdata);
... ... @@ -1022,8 +1483,10 @@ Page({
1022 1483 return false;
1023 1484 }
1024 1485  
1025   - for (var i = 0; i < th.data.cartlist.length;i++){
1026   - var t_item = th.data.cartlist[i];
  1486 + var order_prom_list_cart=th.data.order_prom_list_cart;
  1487 + //--组装推送数据--
  1488 + for (var i = 0; i < order_prom_list_cart.length;i++){
  1489 + var t_item = order_prom_list_cart[i];
1027 1490 var item = {
1028 1491 'user_id': to.globalData.user_id,
1029 1492 'consignee': addr == null ? th.data.userinfo.mobile : addr.consignee,
... ... @@ -1049,17 +1512,42 @@ Page({
1049 1512 'exp_type': t_item.exp_type, //配送方式
1050 1513 'order_goods': new Array(),
1051 1514 };
  1515 + //是不是重新提交
  1516 + if(th.data.is_continue==1) item.is_continue=1;
1052 1517  
1053 1518 //组装优惠券的钱
1054 1519 if(t_item.coupon_price) {
1055 1520 item.coupon_price = t_item.coupon_price;
1056 1521 item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no;
1057   - }
1058   - if(t_item.quan_no) {
  1522 + }else if(t_item.quan_no) {
1059 1523 item.coupon_no = t_item.quan_no;
1060 1524 item.coupon_price = 0;
1061 1525 }
1062 1526  
  1527 + var order_prom_list={};
  1528 + //--判断有没有优惠活动--
  1529 + if(t_item.order_prom_amount>0){
  1530 + order_prom_list.order_prom_id=t_item.order_prom_id;
  1531 + order_prom_list.order_prom_amount=t_item.order_prom_amount;
  1532 + }
  1533 + //--判断优惠活动的提交--
  1534 + if(t_item.cut_price>0){
  1535 + order_prom_list.discount_amount=t_item.cut_price.toFixed(2);
  1536 + order_prom_list.prom_pt_json=JSON.stringify(t_item.prom_pt_json);
  1537 + }
  1538 + if(t_item.s_intValue>0){
  1539 + order_prom_list.give_integral=t_item.s_intValue;
  1540 + }
  1541 + if(t_item.s_coupon_id>0){
  1542 + order_prom_list.give_coupon_id=t_item.s_coupon_id;
  1543 + order_prom_list.g_coupon_num= JSON.stringify(t_item.g_coupon_num);
  1544 + }
  1545 + if(t_item.s_libao>0){
  1546 + order_prom_list.give_lb_id=t_item.s_libao;
  1547 + order_prom_list.g_lb_num=JSON.stringify(t_item.g_lb_num);
  1548 + }
  1549 + if(Object.keys(order_prom_list).length>0)
  1550 + item.order_prom_list=order_prom_list;
1063 1551 //-------------让商品添加到商品列表--------------------
1064 1552 for (var k = 0; k < t_item.goods.length;k++){
1065 1553 var g_item = t_item.goods[k];
... ... @@ -1085,14 +1573,31 @@ Page({
1085 1573 }
1086 1574 }
1087 1575  
1088   - //如果是秒杀,团购,积分购,拼团
1089   - if (g_item.prom_type==1){
1090   - goods.prom_type = g_item.prom_type;
1091   - goods.prom_id = g_item.prom_id;
1092   - }else{
1093   - goods.prom_type = 0;goods.prom_id =0;
  1576 + //--判断活动的类型--
  1577 + switch (g_item.prom_type) {
  1578 + case 1:
  1579 + goods.prom_type = g_item.prom_type;
  1580 + goods.prom_id = g_item.prom_id;
  1581 + break;
  1582 + case 3:
  1583 + goods.prom_type=3;
  1584 + goods.prom_id=g_item.prom_id;
  1585 + if(g_item.is_gift){
  1586 + goods.is_gift=g_item.is_gift;
  1587 + goods.gift_id=g_item.gift_id;
  1588 + }
  1589 + break;
  1590 + case 5:
  1591 + goods.prom_type=5;
  1592 + goods.prom_id=g_item.prom_id;
  1593 + if(g_item.is_collocation){
  1594 + goods.is_collocation=g_item.is_collocation;
  1595 + }
  1596 + break
  1597 + default:
  1598 + goods.prom_type = 0;goods.prom_id =0;
1094 1599 }
1095   -
  1600 +
1096 1601 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1097 1602 if(goods.prom_type==0 && th.data.sales_rules==2){
1098 1603 var isok=1;
... ... @@ -1115,6 +1620,7 @@ Page({
1115 1620  
1116 1621 if (pdata.length==0) return;
1117 1622 var str = JSON.stringify(pdata);
  1623 +
1118 1624 wx.showLoading({title: "加载中"});
1119 1625 wx.request({
1120 1626 url: oo.url + '/api/weshop/order/createWxdOrder',
... ... @@ -1195,6 +1701,25 @@ Page({
1195 1701 else{
1196 1702 //--内容换行--
1197 1703 var msg=data.msg;
  1704 + //赠品活动已经取消,无法赠送,是否继续买单?
  1705 + if(msg.indexOf("是否继续买单")>0){
  1706 + wx.showModal({
  1707 + title:"提示",
  1708 + content: data.msg,
  1709 + cancelText:'取消',
  1710 + confirmText:'确定',
  1711 + showCancel: true,
  1712 + success(res){
  1713 + if(res.cancel){
  1714 + return;
  1715 + }else if(res.confirm){
  1716 + th.data.is_continue=1;
  1717 + th.submitForm(sub_value);
  1718 + }
  1719 + }
  1720 + })
  1721 + return;
  1722 + }
1198 1723 if(msg.length>13){
1199 1724 msg=msg.slice(0, 13) + "\r\n"+ msg.slice(13);
1200 1725 }
... ... @@ -1458,14 +1983,12 @@ Page({
1458 1983  
1459 1984 //对于在其他门店已经选择了的券 要判断是否显示到界面
1460 1985 for(var i in quanlist){
1461   - var is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid);
1462   - if(is_using) quanlist[i].is_using=1;
  1986 + quanlist[i].is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid);
1463 1987 }
1464 1988  
1465   - if(get_by_quan_list_cart){
  1989 + if(get_by_quan_list_cart){
1466 1990 for(var i in get_by_quan_list_cart){
1467   - var is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid);
1468   - if(is_using) quanlist[i].is_using=1;
  1991 + get_by_quan_list_cart[i].is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid);
1469 1992 }
1470 1993 th.setData({by_quan_list_cart:get_by_quan_list_cart});
1471 1994 }
... ... @@ -1604,31 +2127,23 @@ Page({
1604 2127 return;
1605 2128 }
1606 2129  
  2130 + var pickid=th.data.selected_quan_pick; //现在选择的是哪一个门店
1607 2131 var ind = e.currentTarget.dataset.ind;
1608 2132 //--如果是立即购买的部分--
1609 2133 var txt="";var txt1=""; var quan_item=null;
1610 2134 if(th.data.is_b_now){
1611 2135 quan_item = this.data.get_by_quan_list[ind];
1612 2136 txt = "get_by_quan_list[" + ind + "].show_red";
  2137 + var obj = {}; obj[txt] = 1;
  2138 + this.setData(obj);
1613 2139 }else{
1614   - txt = "by_quan_list_cart[" + ind + "].show_red";
1615   - quan_item = th.data.by_quan_list_cart[ind]
1616   -
1617   - }
1618   - var obj = {}; obj[txt] = 1;
1619   - if (quan_item.show_red) {
1620   - obj[txt] = 0;
1621   - }
1622   -
1623   - //购物车购买过来的商品
1624   - if(txt1){
1625   - obj[txt1] = 1;
1626   - if (quan_item.show_red) {
1627   - obj[txt1] = 0;
1628   - }
  2140 + txt= "by_quan_list_cart[" + ind + "].show_red";
  2141 + quan_item = th.data.by_quan_list_cart[ind];
  2142 + var obj = {}; obj[txt] = 1;
  2143 + this.setData(obj);
  2144 + th.data.get_by_quan_list_cart[pickid]=JSON.parse(JSON.stringify(th.data.by_quan_list_cart)); //要把选中的弄回数组
1629 2145 }
1630 2146  
1631   - this.setData(obj);
1632 2147 if(using_quan[th.data.selected_quan_pick]){
1633 2148 using_quan[th.data.selected_quan_pick].is_nouse_red=0;
1634 2149 }
... ... @@ -1640,12 +2155,12 @@ Page({
1640 2155  
1641 2156 //--确认使用券---
1642 2157 confirm_quan:function () {
1643   - var using_quan=this.data.using_quan
1644   - var pickid=this.data.selected_quan_pick;
  2158 + var using_quan=this.data.using_quan; //正在使用中的券列表
  2159 + var pickid=this.data.selected_quan_pick; //选中的门店ID
1645 2160 var th=this;
1646   - var selected_quan_list=this.data.selected_quan_list;
1647   - var get_by_quan_list=this.data.get_by_quan_list;
1648   - var by_quan_list_cart=this.data.by_quan_list_cart;
  2161 + var selected_quan_list=this.data.selected_quan_list; //选择了那个门店的券列表
  2162 + var get_by_quan_list=this.data.get_by_quan_list; //立即购买的包邮券列表
  2163 + var by_quan_list_cart=this.data.by_quan_list_cart; //购物车购买的包邮券列表
1649 2164 //选择了的券
1650 2165 var sele_quan=null;
1651 2166  
... ... @@ -1747,7 +2262,6 @@ Page({
1747 2262 }
1748 2263 }
1749 2264 if(!is_find) arr.push(item);
1750   -
1751 2265 }
1752 2266 return arr;
1753 2267 },
... ... @@ -1868,68 +2382,96 @@ Page({
1868 2382 },
1869 2383 //-----获取购物车进来的劵-------
1870 2384 get_cart_quan:function () {
1871   - var arr=this.data.cartlist,th=this;
1872   - //------------开始计算使用优惠券相关------------
1873   - for(var ind in arr){
1874   - var ep=arr[ind];
1875   - var goodlist=ep.goods;
1876   - //--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西
1877   - //就要把相应的值,写入cartlist数组中--
1878   - var ckeck_quan_price=0,
1879   - check_quan_price_list='',
1880   - check_quan_ware_list='';
1881   -
1882   - for(var i in goodlist){
1883   - var gd=goodlist[i];
1884   - //--如果是秒杀就跳出--
1885   - if(gd.prom_type==1){ continue; }
1886   - var item_price=gd.goods_price*gd.goods_num;
1887   - ckeck_quan_price+=item_price;
1888   -
1889   - //--组装价格list--
1890   - if (check_quan_price_list) {
1891   - check_quan_price_list += "," +item_price;
1892   - } else {
1893   - check_quan_price_list = item_price;
1894   - }
1895   - //--组装商品的线下erpwareid--
1896   - if (check_quan_ware_list) {
1897   - check_quan_ware_list += "," +gd['erpwareid'];
1898   - } else {
1899   - check_quan_ware_list = gd['erpwareid'];
1900   - }
1901   - }
  2385 + var th=this;
  2386 + var is_xz_yh=1;
  2387 + //等待值的出现
  2388 + getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
  2389 + var arr=th.data.order_prom_list_cart;
  2390 + //如果系统有限制使用优惠券
  2391 + if(th.data.is_close_quan) return false;
  2392 + //------------开始计算使用优惠券相关------------
  2393 + for(var ind in arr){
  2394 + var ep=arr[ind];
  2395 + var goodlist=ep.goods;
  2396 + var pickup_id=ep.pickup_id;
  2397 + //--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西
  2398 + //就要把相应的值,写入cartlist数组中--
  2399 + var ckeck_quan_price=0,
  2400 + check_quan_price_list='',
  2401 + check_quan_ware_list='';
  2402 +
  2403 + for(var i in goodlist){
  2404 + var gd=goodlist[i];
  2405 + //--如果是秒杀就跳出,如果是赠品,如果是限制使用优惠券--
  2406 + if(gd.prom_type==1 || gd.is_gift ){ continue; }
  2407 + //如果有限制使用优惠券,就要返回
  2408 + if(gd.prom_type==3){
  2409 + if(th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue;
  2410 + th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele=1;
  2411 + }
  2412 + is_xz_yh=0;
  2413 + var item_price=gd.goods_price*gd.goods_num;
  2414 + ckeck_quan_price+=item_price;
  2415 + //--组装价格list--
  2416 + if (check_quan_price_list) {
  2417 + check_quan_price_list += "," +item_price;
  2418 + } else {
  2419 + check_quan_price_list = item_price;
  2420 + }
  2421 + //--组装商品的线下erpwareid--
  2422 + if (check_quan_ware_list) {
  2423 + check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);
  2424 + } else {
  2425 + check_quan_ware_list = encodeURIComponent(gd['erpwareid']);
  2426 + }
  2427 + }
  2428 + //优惠券优惠的金额要控制到优惠券的选择条件
  2429 + var cut_price=0;
  2430 + for(var i in th.data.prom_goods_map[pickup_id]){
  2431 + var obj=th.data.prom_goods_map[pickup_id][i];
  2432 + if(obj.coupon_sele){
  2433 + cut_price+=obj.price-obj.prom_price;
  2434 + }
  2435 + }
  2436 +
  2437 + arr[ind].ckeck_quan_price=ckeck_quan_price-cut_price;
  2438 + arr[ind].check_quan_ware_list=check_quan_ware_list;
  2439 + arr[ind].check_quan_price_list=check_quan_price_list;
  2440 +
  2441 + //是否关闭使用优惠券
  2442 + if (th.data.is_close_quan != 1 && !is_xz_yh) {
  2443 + //--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
  2444 + var url="/api/weshop/couponList/getUseCouponList";
  2445 + await app.request.promiseGet(url,{ data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100}}).then(res=>{
  2446 + if (res.data.code == 0) {
  2447 + var quan_list = res.data.data.pageData;
  2448 + arr[ind].quan_list = th.check_is_frozenQuan(quan_list, th.data.frozenQuan);
  2449 + }
  2450 + })
  2451 + }
  2452 + }
  2453 +
  2454 + //如果是搭配购的立即购买的时候
  2455 + if(th.data.is_b_now){
  2456 + var quanlist=arr[0].quan_list;
  2457 + th.setData({selected_quan_list:quanlist,cartlist:arr})
  2458 + }else{
  2459 + th.setData({cartlist:arr })
  2460 + }
  2461 +
  2462 +
  2463 + })
  2464 + },
1902 2465  
1903   - arr[ind].ckeck_quan_price=ckeck_quan_price;
1904   - arr[ind].check_quan_ware_list=check_quan_ware_list;
1905   - arr[ind].check_quan_price_list=check_quan_price_list;
1906   -
1907   - //是否关闭使用优惠券
1908   - if (th.data.is_close_quan != 1) {
1909   - var frozenQuan=null;
1910   - var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
1911   - app.request.promiseGet(url0,{1:1}).then(res=>{
1912   - if(res.data.code==0){ frozenQuan=res.data.data; th.data.frozenQuan=frozenQuan; }
1913   - //--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
1914   - var url="/api/weshop/couponList/getUseCouponList";
1915   - app.request.time_limit_get(6,url,{
1916   - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100},
1917   - success:function (res) {
1918   - if (res.data.code == 0) {
1919   - arr[ind].quan_list = res.data.data.pageData;
1920   - arr[ind].quan_list = th.check_is_frozenQuan(arr[ind].quan_list, frozenQuan);
1921   - th.setData({cartlist:arr })
1922   - }
1923   - }
1924   - })
1925   - })
1926   - }
1927   - }
1928   - },
1929 2466 //------ 获取立即购买的购物车的劵 --------
1930 2467 get_buy_now_quan:function () {
1931 2468 var quanlist=null,th=this,frozenQuan = null;
1932   - if(th.data.is_close_quan != 1)
  2469 + var good = this.data.bn_goods;
  2470 + if(good.prom_price){
  2471 + th.data.ckeck_quan_price=good.prom_price;
  2472 + }
  2473 + //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券--
  2474 + if(th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh!=1)
1933 2475 {
1934 2476 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1935 2477 var url="/api/weshop/couponList/getUseCouponList";
... ... @@ -1942,7 +2484,7 @@ Page({
1942 2484 storeId: oo.stoid,
1943 2485 userId: app.globalData.user_id,
1944 2486 BuySum: th.data.ckeck_quan_price,
1945   - WareIds: th.data.check_quan_ware_list,
  2487 + WareIds: encodeURIComponent(th.data.check_quan_ware_list),
1946 2488 pageSize: 100
1947 2489 },
1948 2490 success: function (res) {
... ... @@ -1956,9 +2498,9 @@ Page({
1956 2498 }
1957 2499 })
1958 2500 })
1959   -
1960 2501 }
1961 2502 },
  2503 +
1962 2504 //检查区域是不是包邮
1963 2505 check_area:function(arr){
1964 2506 var user_addr=this.data.user_addr;
... ... @@ -1990,7 +2532,158 @@ Page({
1990 2532 var arr=goods_list.split(",");
1991 2533 var check=this.check_good(arr,goods_id);
1992 2534 return !check;
1993   - }
  2535 + },
  2536 +
  2537 + //立即购买获取优惠活动的内容
  2538 + buy_now_prom_goods:function (prom_id,arr,func) {
  2539 + var price=arr.shop_price*arr.goods_num;
  2540 + var prom=null;
  2541 + getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+prom_id,{}).then(res=>{
  2542 + if(res.data.code==0){
  2543 + prom=res.data.data;
  2544 + return getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
  2545 + data: {
  2546 + price: price,
  2547 + prom_id: prom_id,
  2548 + goods_num: arr.goods_num,
  2549 + user_id: getApp().globalData.user_id,
  2550 + is_bz: prom.is_bz
  2551 + }
  2552 + })
  2553 + }else {
  2554 + func(arr);
  2555 + }
  2556 + }).then(res=>{
  2557 + if(res.data.code==0){
  2558 + var get_data=res.data.data;
  2559 + arr.is_bz=prom.is_bz; //是不是倍增
  2560 + arr.is_xz_yh=prom.is_xz_yh; //是不是优惠
  2561 + arr.bs=get_data.bs; //是不是倍数
  2562 + arr.is_past=get_data.is_past; //是不是包邮
  2563 + arr.prom_price=get_data.price?get_data.price:price;
  2564 + arr.s_intValue=get_data.intValue;
  2565 + arr.s_coupon_id=get_data.coupon_id;
  2566 + arr.s_coupon_num=get_data.coupon_num;
  2567 + //-- 看是不是有赠品 --
  2568 + if(get_data.gift_id) {
  2569 + arr.gift_id = get_data.gift_id;
  2570 + arr.gift_goods_id = get_data.goods_id;
  2571 + arr.gift_goods_name = get_data.goods_name;
  2572 + arr.gift_goods_color = get_data.goodsinfo.goods_color;
  2573 + arr.gift_goods_spec = get_data.goodsinfo.goods_spec;
  2574 + arr.gift_original_img = get_data.goodsinfo.original_img;
  2575 + arr.gift_weight = get_data.goodsinfo.weight;
  2576 + arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type;
  2577 + arr.gift_limit_num = get_data.limit_num;
  2578 + arr.gift_storecount = get_data.gift_storecount;
  2579 + }
  2580 + arr.s_libao=get_data.libao;
  2581 + arr.s_lb_num=get_data.lb_num;
  2582 + arr.prom_id=prom_id;
  2583 + }
  2584 + func(arr);
  2585 + })
  2586 + },
  2587 + //--检查订单优惠--
  2588 + check_is_order_prom:function (condition,func,pick) {
  2589 + var th=this;
  2590 + if(this.data.is_b_now==1) pick=this.data.bn_pick;
  2591 + //---获取订单优惠---
  2592 + getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion",{
  2593 + data:{store_id:os.stoid,orderAmount:condition}
  2594 + }).then(res=>{
  2595 + if(res.data.code==0) {
  2596 + var data = res.data.data;
  2597 + th.data.order_prom[pick]=data;
  2598 + }
  2599 + func();
  2600 + })
  2601 + },
  2602 +
  2603 + //--- 加入优惠活动的映射中 ---
  2604 + add_prom_goods_map:async function (item) {
  2605 + var th=this;
  2606 + var pickid=item.pick_id;
  2607 + var map=th.data.prom_goods_map;
  2608 + var obj=map[pickid];
  2609 +
  2610 + if(map[pickid]){
  2611 + if(map[pickid][item.prom_id]){
  2612 + var ob=map[pickid][item.prom_id];
  2613 + ob.price+=item.goods_price*item.goods_num;
  2614 + ob.goods_num+=item.goods_num;
  2615 + }else{
  2616 + var prom=null;
  2617 + await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+item.prom_id,{}).then(res=>{
  2618 + if(res.data.code==0){ prom=res.data.data; }
  2619 + })
  2620 + var ob={};
  2621 + ob.prom_id=item.prom_id;
  2622 + ob.price=item.goods_price*item.goods_num;
  2623 + ob.goods_num=item.goods_num;
  2624 + ob.is_bz=prom.is_bz;
  2625 + ob.is_xz_yh=prom.is_xz_yh;
  2626 + map[pickid][item.prom_id]=ob;
  2627 + }
  2628 + }else{
  2629 + var ob={};
  2630 + var prom=null;
  2631 + await getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+item.prom_id,{}).then(res=>{
  2632 + if(res.data.code==0){ prom=res.data.data; }
  2633 + })
  2634 + ob.prom_id=item.prom_id;
  2635 + ob.price=item.goods_price*item.goods_num;
  2636 + ob.goods_num=item.goods_num;
  2637 + ob.is_bz=prom.is_bz;
  2638 + ob.is_xz_yh=prom.is_xz_yh;
  2639 + var obj={};
  2640 + obj[item.prom_id]=ob;
  2641 + map[pickid]=obj;
  2642 +
  2643 + }
  2644 + },
  2645 +
  2646 + //计算立即购买赠品的物流费用
  2647 + get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data) {
  2648 + var good=this.data.buy_now_gift_goods;
  2649 + var goods_weight=-1, goods_piece=-1;
  2650 + var gift_shipping_price=0;
  2651 + var th=this;
  2652 + switch (good['exp_sum_type']) {
  2653 + case 1:
  2654 + //统一运费
  2655 + gift_shipping_price += good['uniform_exp_sum']; break;
  2656 + case 2:
  2657 + if (goods_weight < 0) goods_weight = 0;
  2658 + //累积商品重量 每种商品的重量 * 数量
  2659 + goods_weight += good['weight'] * good['buynum'];break;
  2660 + case 3:
  2661 + if (goods_piece < 0) goods_piece = 0;
  2662 + //累积商品数量
  2663 + goods_piece += good['buynum']; break;
  2664 + }
  2665 +
  2666 + //如果有设置不包邮区域的时候
  2667 + if(no_by_data && no_by_data.region_list){
  2668 + if(th.check_by_area(no_by_data.region_list)){
  2669 + gift_freight_free=0;
  2670 + th.data.is_no_by[th.data.bn_pick]=1;
  2671 + }
  2672 + }
  2673 + //如果有设置不包邮商品
  2674 + if(no_by_data && no_by_data.goods_list && gift_freight_free){
  2675 + if(th.check_by_goods(no_by_data.goods_list)){
  2676 + gift_freight_free=0;
  2677 + th.data.is_no_by[th.data.bn_pick]=1;
  2678 + }
  2679 + }
  2680 + var t_shipping_price=
  2681 + this.calculatewuliu(code, gift_shipping_price, goods_weight,
  2682 + goods_piece, user_addr, gift_freight_free, allpice, rs);
  2683 + return t_shipping_price+shipping_price;
  2684 +
  2685 + }
  2686 +
1994 2687  
1995 2688  
1996 2689 });
... ...
pages/cart/cart2/cart2.wxml
... ... @@ -41,7 +41,8 @@
41 41 <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> <view>门店:{{item.pname}}</view></view>
42 42 <view class="order-detail" wx:for="{{item.goods}}" wx:for-index="idx" wx:for-item="items">
43 43 <!----商品图片----->
44   - <view class="goods-img">
  44 + <view class="goods-img" style="position: relative">
  45 + <image wx:if="{{items.is_gift}}" src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image>
45 46 <image class="wh100" src="{{items.original_img}}" binderror='cart_set_err'
46 47 data-err='cartlist[{{pidx}}].goods[{{idx}}].original_img' ></image>
47 48 </view>
... ... @@ -69,10 +70,10 @@
69 70 </navigator>
70 71  
71 72 </view>
72   -
  73 + <view style="display: none;">!!!!---{{item.quan_list.length}}---!!!</view>
73 74 <!-----使用优惠券------>
74 75 <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list"
75   - wx:if="{{item.quan_list && item.quan_list.length>0 }}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}">
  76 + wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}">
76 77 <view class="work-frame flex-space-between">
77 78 <view class="work">优惠券</view>
78 79 <view class="xc-right-frame">
... ... @@ -190,14 +191,62 @@
190 191 <view class="goods-num">x{{bn_goods.buynum}}</view>
191 192 </view>
192 193 </navigator>
193   -
  194 +
194 195 </view>
195   - <view class="set-mes">
  196 + <!-- 赠品的显示 -->
  197 + <view class="order-detail" wx:if="{{buy_now_gift_goods}}">
  198 + <view class="goods-img" style="position: relative">
  199 + <image src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image>
  200 +
  201 + <image class="wh100" src="{{buy_now_gift_goods.original_img}}" binderror='cart_set_err' data-err="buy_now_gift_goods.original_img"></image>
  202 + </view>
  203 + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{buy_now_gift_goods.goods_id}}">
  204 + <view class="goods-name">{{buy_now_gift_goods.goods_name}}</view>
  205 + <!-- 商品属性 -->
  206 + <view class="flex-vertical fs28 xc-ash color-gray n_guige">
  207 + <view class="goods-color">
  208 + <block><text>{{filters.show_gui_ge(buy_now_gift_goods.goods_spec,buy_now_gift_goods.goods_color)}}</text></block>
  209 + </view>
  210 + </view>
  211 + <!-----商品名称规格------>
  212 + <view class="order-num flex-space-between">
  213 + <view class="co-red">¥<text class="fs36">0</text></view>
  214 + <view class="goods-num">x{{buy_now_gift_goods.buynum}}</view>
  215 + </view>
  216 + </navigator>
  217 + </view>
  218 +
  219 +
  220 + <block wx:if="{{collocation_goods}}">
  221 + <!-- 搭配购买的功能实现 -->
  222 + <view class="order-detail" wx:for="{{collocation_goods}}">
  223 + <view class="goods-img">
  224 + <image class="wh100" src="{{imgUrl+item.original_img}}" binderror='err_img_collocation' data-err="item.original_img"></image>
  225 + </view>
  226 + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">
  227 + <view class="goods-name">{{item.goods_name}}</view>
  228 + <!-- 商品属性 -->
  229 + <view class="flex-vertical fs28 xc-ash color-gray n_guige">
  230 + <view class="goods-color">
  231 + <block><text>{{filters.show_gui_ge(item.goods_spec,item.goods_color)}}</text></block>
  232 + </view>
  233 + </view>
  234 + <!-----商品名称规格------>
  235 + <view class="order-num flex-space-between">
  236 + <view class="co-red">¥<text class="fs36">{{item.price}}</text></view>
  237 + <view class="goods-num">x{{item.goods_num}}</view>
  238 + </view>
  239 + </navigator>
  240 + </view>
  241 + </block>
  242 +
  243 +
  244 + <view class="set-mes">
196 245 <view wx:if="{{order.store_prom}}"><icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}}
197 246 </view>
198 247  
199 248 <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}"
200   - wx:if="{{selected_quan_list && selected_quan_list.length>0}}">
  249 + wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}">
201 250 <view class="work-frame flex-space-between">
202 251 <view class="work">
203 252 优惠券
... ... @@ -224,11 +273,10 @@
224 273 <view class="yu_er">物流</view>
225 274 </view>
226 275 </view>
227   - <block wx:if="{{bn_exp_type==0}}">
  276 + <block wx:if="{{bn_exp_type==0}}">
228 277 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index'><view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view></view>
229   - </block>
  278 + </block>
230 279 </view>
231   -
232 280 </view>
233 281  
234 282 <!-----使用余额------>
... ... @@ -248,32 +296,32 @@
248 296 </block>
249 297  
250 298 <view class="information">
251   - <view class="item">
  299 + <view class="item" wx:if="{{formData.all_price>0}}">
252 300 <view>商品金额</view>
253 301 <view class="co-red">¥ {{formData.all_price}}元</view>
254 302 </view>
255   - <view class="item">
  303 + <view class="item" wx:if="{{formData.shipping_price>0}}">
256 304 <view>配送费用</view>
257 305 <view class="co-red">¥ {{formData.shipping_price}}元</view>
258 306 </view>
259   -
260 307 <view class="item" wx:if="{{formData.coupon_price>0}}">
261 308 <view>使用优惠券</view>
262 309 <view class="co-red">- ¥ {{formData.coupon_price}}元</view>
263 310 </view>
264   - <!--
265   - <view class="item">
266   - <view>使用积分</view>
267   - <view class="co-red">- ¥ {{orderPrices.integral_money}}元</view>
268   - </view> -->
269   - <view class="item">
  311 + <!-- 优惠活动优惠金额 -->
  312 + <view class="item" wx:if="{{formData.cut_price>0}}">
  313 + <view>优惠活动</view>
  314 + <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view>
  315 + </view>
  316 + <!-- 订单优惠优惠金额 -->
  317 + <view class="item" wx:if="{{formData.order_prom_amount>0}}">
  318 + <view>订单优惠</view>
  319 + <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view>
  320 + </view>
  321 + <view class="item" wx:if="{{formData.user_money>0}}">
270 322 <view>使用余额</view>
271 323 <view class="co-red">- ¥ {{formData.user_money}}元</view>
272 324 </view>
273   - <!-- <view class="item">
274   - <view>优惠活动</view>
275   - <view class="co-red">- ¥ {{orderPrices.order_prom_amount}}元</view>
276   - </view> -->
277 325 </view>
278 326 </view>
279 327  
... ... @@ -426,7 +474,6 @@
426 474 <view class="determine-frame"><view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view></view>
427 475 </view>
428 476 </view>
429   -
430 477 <!----弹起选择物流名的列表---->
431 478 <view wx:if='{{open_express==1}}' >
432 479 <view class="cover-layer flex-center " bindtap='close_express'>
... ... @@ -470,6 +517,4 @@
470 517 </view >
471 518 </view>
472 519  
473   -
474   -
475 520 <warn id="warn"></warn>
476 521 \ No newline at end of file
... ...
pages/cart/cart2/cart2.wxss
... ... @@ -208,8 +208,8 @@ margin:auto;
208 208 height: 100rpx; width: 100%;
209 209 background-color: #fff;
210 210 position: fixed; bottom: 0;left: 0;
211   - border-top:1rpx solid #dee
212   -
  211 + border-top:1rpx solid #dee;
  212 + z-index:9999
213 213 }
214 214  
215 215 .tips-btn {
... ... @@ -346,7 +346,7 @@ margin:auto;
346 346 }
347 347 .xc-frame{
348 348 width: 100%;
349   - height:68.9%;
  349 + height:60%;
350 350 }
351 351  
352 352 .xc-frame .list-frame{
... ... @@ -480,11 +480,7 @@ padding-left: 40rpx;
480 480 margin-top: 30rpx;
481 481  
482 482 }
483   -.cx-popup.radius{
484   -
485   -height: 650rpx;
486 483  
487   -}
488 484 .xc-hook {
489 485 width: 33rpx;
490 486 height: 33rpx;
... ... @@ -512,8 +508,9 @@ border-bottom: 1rpx solid #eee;
512 508 .express_list{
513 509 width: 100%;
514 510 height: 65%;
515   - overflow-y: scroll;
516   - overflow: hidden;
  511 + overflow-y: auto;
  512 + margin-bottom: 10rpx;
  513 +
517 514 }
518 515 .xc-confirms {
519 516 width: 40%;
... ... @@ -821,5 +818,5 @@ margin-left: 20rpx;
821 818 .color-gray{
822 819 color: #808080;
823 820 }
824   -
825   -.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx }
826 821 \ No newline at end of file
  822 +.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx }
  823 +.gift_image{ width: 60rpx; height: 60rpx; position: absolute; top: 0; left: 0}
827 824 \ No newline at end of file
... ...
pages/cart/cart2_pt/cart2_pt.wxml
... ... @@ -129,11 +129,11 @@
129 129 <view class="co-red">¥ {{formData.all_price}}元</view>
130 130 </view>
131 131  
132   - <view class="item">
  132 + <view class="item" wx:if="{{formData.shipping_price>0}}">
133 133 <view>配送费用</view>
134 134 <view class="co-red">¥ {{formData.shipping_price}}元</view>
135 135 </view>
136   - <view class="item">
  136 + <view class="item" wx:if="{{formData.user_money>0}}">
137 137 <view>使用余额</view>
138 138 <view class="co-red">- ¥ {{formData.user_money}}元</view>
139 139 </view>
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -384,14 +384,18 @@ Page({
384 384 getApp().my_warnning("支付失败",0,th);
385 385 })
386 386 }else {
387   - //---用余额支付---
388   - getApp().my_warnning("支付成功",1,th);
389   - setTimeout(function () {
390   - th.setData({ isclose: 0 });
391   - wx.navigateTo({
392   - url: "/pages/user/order_list/order_list"
393   - })
394   - }, 1000)
  387 + if(t.data.code==0){
  388 + //---用余额支付---
  389 + getApp().my_warnning("支付成功",1,th);
  390 + setTimeout(function () {
  391 + th.setData({ isclose: 0 });
  392 + wx.navigateTo({
  393 + url: "/pages/user/order_list/order_list"
  394 + })
  395 + }, 1000)
  396 + }else{
  397 + getApp().my_warnning(t.data.msg,1,th);
  398 + }
395 399 }
396 400 }
397 401 });
... ...
pages/cart/cart_wk/cart_wk.wxml
... ... @@ -96,7 +96,7 @@
96 96 </view>
97 97 </view>
98 98  
99   - <view class='ct_one jc_sb'>
  99 + <view class='ct_one jc_sb' wx:if="{{exp_price>0}}">
100 100 <view class='ct_one_left'>配送费用</view>
101 101 <view class='ct_one_right'>¥<text class='redwz'>{{exp_price}}</text>
102 102 </view>
... ...
pages/goods/categoryList/categoryList.js
1 1 var t = getApp(), e = t.request, oo = t.globalData.setting;
2 2  
  3 +var i = function (i) {
  4 + return i && i.__esModule ? i : {
  5 + default: i
  6 + };
  7 +}(require("../../../utils/LoadMore.js")), a = new i.default(), ut = require("../../../utils/util.js");
  8 +//t = i,e = t
3 9 Page({
4 10 data: {
5   - is_date:true,
6   - scrollHeight: 0,
7   - currentTab:-1,
8   - abc:0,
  11 + is_date:true,
  12 + scrollHeight: 0,
  13 + currentTab:-1,
  14 + abc:0,
9 15 windowHeight:0,
10 16 windowWidth: 0,
11 17 eachLetterHeight:0,
... ... @@ -39,14 +45,35 @@ Page({
39 45 cat_id:0,
40 46 pl_timer: null,//只有品类的定时器
41 47 is_pl_time:0,
42   -
  48 + requestData:null, //风格三的商品数据列表 分页
  49 + stylePage:1, //商品列表分页标识
  50 + //风格三使用
  51 + url: t.globalData.setting.imghost,
  52 + currentPage: 1,
  53 + requestData: null,
  54 + allData: null,
  55 + openFilterModal: !1,
  56 + baseUrl: "api/weshop/goods/page?1=1&orderField=goods_id&orderType=desc&is_mainshow=1&isonsale=1&store_id="+oo.stoid+"&is_recommend=1",
  57 + requestUrl: "",
  58 + tabname: "goods_id", //排序的字段
  59 + adname: "desc", //升降的字段
  60 + is_new: 0,
  61 + is_hot: 0,
  62 + msgStatus:false, //页面显示暂无数据状态
  63 + countDownNum: 3,
  64 + timer: '', //定时器
  65 + lastMsg:false,
  66 + toView:"",
43 67 },
44 68 onLoad: function(tt) {
  69 + var that = this;
  70 + that.get_brand();
  71 +
  72 + clearInterval(that.data.timer);
  73 + that.setData({ countDownNum: 3, stylePage: 1 });
  74 +
45 75 const res = wx.getSystemInfoSync(),
46 76 letters = this.data.letters;
47   -
48   - var that = this;
49   -
50 77 this.setData({
51 78 abc: t.globalData.heigth-88-88-16,
52 79 windowHeight: res.windowHeight,
... ... @@ -77,11 +104,58 @@ Page({
77 104 if (this.data.is_used_share==0){
78 105 this.get_nation();
79 106 }
80   -
  107 +
  108 + //风格三
  109 + //t = i,e = t
  110 + var th = this;
  111 + a.init(this, "", "requestData");
  112 + var url = this.data.baseUrl;
  113 + this.data.is_new = i.is_new;
  114 + this.data.is_hot = i.is_hot;
  115 + if (0 != this.data.cat_id) {
  116 + url += "&cat_id=" + this.data.cat_id;
  117 + }
  118 +
  119 + // this.requestGoodsList(url);
  120 + getApp().getConfig2(function (rs) {
  121 + //计算等级价相关
  122 + var swithc_list = rs.switch_list;
  123 + var sw_arr = JSON.parse(swithc_list);
  124 + //---如果后台又开等级卡的开关---
  125 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  126 + th.setData({ rank_switch: true });
  127 + var user = getApp().globalData.userInfo;
  128 + var ti = setInterval(function () {
  129 + if (!user) return false;
  130 + clearInterval(ti);
  131 + //---回调卡的列表---
  132 + th.getPlusCardType(function (ob) {
  133 + th.setData({ card_list: ob.card_list });
  134 + if (user.card_field) {
  135 + var str = user['card_expiredate'].replace(/-/g, '/');
  136 + var end = new Date(str);
  137 + end = Date.parse(end) / 1000;
  138 + var now = ut.gettimestamp();
  139 +
  140 + //--- 判断是等级会员,且在有效期范围内 ---
  141 + if (user.card_field && now < end) {
  142 + var card_name = ob.name_map.get(user.card_field);
  143 + if (card_name.length > 4) card_name = card_name.substring(0, 4);
  144 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  145 + }
  146 + }
  147 + })
  148 + }, 500)
  149 + }
  150 + });
81 151 },
82 152  
83 153 onShow:function(){
84 154 var that=this;
  155 + that.setData({
  156 + isTabBar: getApp().globalData.isTabBar,
  157 + });
  158 + t.editTabBar(); //显示自定义的底部导航
85 159 //this.requestFirstCategoris();
86 160 if(getApp().globalData.user_id) getApp().requestCardNum();
87 161 getApp().getConfig2(function (e) {
... ... @@ -150,6 +224,7 @@ Page({
150 224 that.setData({ currentTab: 0 });
151 225 }
152 226 })
  227 +
153 228 },
154 229  
155 230 //---------------分类请求接口,数据进行拼装------------------
... ... @@ -180,7 +255,7 @@ Page({
180 255 }
181 256 }
182 257 t.setData({ catelist: arr});
183   - }else{
  258 + } else if (t.data.is_used_share == 1 || t.data.is_used_share == 2){
184 259  
185 260 //---------新的版本----------------
186 261 for (var i = 0; i < dda.length; i++) {
... ... @@ -221,11 +296,11 @@ Page({
221 296 }
222 297 t.setData({one_level_classify:arr});
223 298  
224   - }
  299 + }
225 300 }
226 301 });
227 302 },
228   -
  303 +
229 304 requestCategories: function(t) {
230 305 var s = this;
231 306 e.get("/api/goods/goodsSecAndThirdCategoryList", {
... ... @@ -300,6 +375,7 @@ Page({
300 375  
301 376 //------------手指滑动------------------
302 377 touchmove(e) {
  378 + console.log("手指滑动")
303 379 const x = e.touches[0].clientX,
304 380 y = e.touches[0].clientY,
305 381 lettersPosition = this.data.lettersPosition,
... ... @@ -458,38 +534,57 @@ Page({
458 534 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
459 535  
460 536 },
  537 +
  538 +
  539 + //---图片失败,默认图片---
  540 + bind_Goodsbnerr: function (e) {
  541 + var _errImg = e.target.dataset.errorimg;
  542 + var _errObj = {};
  543 + _errObj[_errImg] ="/miniapp/images/default_g_img.gif";
  544 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  545 + },
461 546 // 新的版本分类点击一级分类
462 547 click_classify:function(e){
463   - this.data.ishaf_three=0;
464   - var indexs=e.currentTarget.dataset.index;
  548 + clearInterval(this.data.timer);
  549 + this.setData({ countDownNum: 3, stylePage: 1, scrollTop: 0});
  550 + this.data.ishaf_three = 0;
  551 + var indexs = e.currentTarget.dataset.index;
465 552 var name = e.currentTarget.dataset.name;
466 553 var cid = e.currentTarget.dataset.cid;
467 554 var pid = e.currentTarget.dataset.pid;
468 555 var arr = e.currentTarget.dataset.arr;
469   -
470   - if (indexs==220){ this.get_brand();}
471   - if (arr!="undefined" && arr!=undefined){
472   - if (arr.length==0){
473   - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name,cat_id:cid,
474   - goodslist: null,is_level_three: 0 });
475   - return false;
476   - }
477   - if (arr.length != 0){
478   - var is_lev_thr=0
479   - for(var i=0;i<arr.length;i++){
480   - if (arr[i].arrays.length>0) {is_lev_thr=1;break; }
481   - }
482   - this.setData({ is_level_three: is_lev_thr });
483   -
484   - if (this.data.is_level_three!=1) {
485   - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
486   - } else {
487   - this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
488   - }
  556 + console.log("cid:=" + cid)
  557 + if (indexs == 220) { this.get_brand(); }
  558 + //==2的时候 请求数据为商品,不为分类
  559 + if (this.data.is_used_share == 2) {
  560 + this.style(this.data.stylePage, cid)
  561 + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,lastMsg: false, });
  562 + }else{
  563 + if (arr != "undefined" && arr != undefined) {
  564 + if (arr.length == 0) {
  565 + this.setData({
  566 + select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,
  567 + goodslist: null, is_level_three: 0
  568 + });
  569 + return false;
  570 + }
  571 + if (arr.length != 0) {
  572 + var is_lev_thr = 0
  573 + for (var i = 0; i < arr.length; i++) {
  574 + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
  575 + }
  576 + this.setData({ is_level_three: is_lev_thr });
  577 +
  578 + if (this.data.is_level_three != 1) {
  579 + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
  580 + } else {
  581 + this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
  582 + }
  583 + }
489 584 }
  585 + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,});
490 586 }
491   - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid});
492   -
  587 +
493 588 },
494 589  
495 590  
... ... @@ -527,4 +622,244 @@ Page({
527 622 this.destroyActivityTimer();
528 623 },
529 624  
  625 +
  626 + //风格三使用
  627 + changeTab: function (t) {
  628 + var ord = t.currentTarget.dataset.href;
  629 + var ad = t.currentTarget.dataset.ad;
  630 + var url = this.data.requestUrl;
  631 +
  632 + if (this.data.tabname != ord) {
  633 + this.setData({ tabname: ord, adname: "desc" });
  634 + } else {
  635 + ad = ad == "desc" ? "asc" : "desc";
  636 + this.setData({ adname: ad });
  637 + }
  638 + this.resetData(), this.requestGoodsList(url);
  639 + },
  640 +
  641 + requestGoodsList: function (t) {
  642 + var that = this;
  643 + that.data.requestUrl = t;
  644 + e.get("/api/weshop/goods/page?1=1", {
  645 + data: { page: that.data.stylePage, cat_id: that.data.cat_id, parent_id: 0, orderField: 'goods_id', orderType: 'desc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 },
  646 + success: function (data) {
  647 + console.log(data.data.data.pageData)
  648 + that.setData({
  649 + requestData: data.data.data.pageData,
  650 + is_go: 1
  651 + });
  652 + that.setData({ is_go: 1 });
  653 + that.data.stylePage++ , null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)),
  654 + wx.stopPullDownRefresh();
  655 + }
  656 + });
  657 + // //不是商品分组的,不是默认排序的
  658 + // if (t.indexOf("group_id") == -1 || e.data.tabname != "goods_id") {
  659 + // t += "&orderField=" + e.data.tabname;
  660 + // t += "&orderType=" + e.data.adname;
  661 + // }
  662 + // + "&parent_id=0&orderField=goods_id&orderType=desc&page="+this.data.page+"&is_mainshow=1&isonsale=1&store_id=1&is_recommend=1"
  663 + // t += "&page=" + e.data.page;
  664 + // a.request(t,
  665 + // function (t) {
  666 + // e.setData({ is_go: 1 });
  667 + // e.data.page++ , null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)),
  668 + // wx.stopPullDownRefresh();
  669 + // },
  670 + // null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid }
  671 + // );
  672 + },
  673 +
  674 + // onReachBottom: function () {
  675 + // console.log('监听上拉:=')
  676 + // var that = this;
  677 + // clearInterval(that.data.timer);
  678 + // that.setData({
  679 + // stylePage: that.data.stylePage + 1,
  680 + // countDownNum: 3,
  681 + // lastMsg: false,
  682 + // });
  683 + // that.style(that.data.stylePage, that.data.cat_id);
  684 + // },
  685 + // onPullDownRefresh: function () {
  686 + // console.log('监听下拉:=' + this.data.requestUrl)
  687 + // this.resetData(), this.requestGoodsList(this.data.requestUrl);
  688 + // },
  689 + // 左侧更新
  690 + scrollLower: function (data) {
  691 + console.log("上拉加载更多", JSON.stringify(data))
  692 + var that = this;
  693 + clearInterval(that.data.timer);
  694 + that.setData({
  695 + stylePage: that.data.stylePage + 1,
  696 + countDownNum: 3,
  697 + lastMsg: false,
  698 + });
  699 + that.style(that.data.stylePage, that.data.cat_id);
  700 + },
  701 +
  702 + //页面版面风格三的时候请求推荐商品 返回
  703 + style: function (page, cid) {
  704 + console.log("page:=" + page)
  705 + var s = this
  706 + e.get("/api/weshop/goods/page?1=1", {
  707 + data: { page: page, cat_id: cid, parent_id: 0, orderField: 'goods_id', orderType: 'desc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 },
  708 + success: function (e) {
  709 + console.log(e.data.data.pageData)
  710 + s.setData({
  711 + dataLength: e.data.data.pageData.length,
  712 + });
  713 + if (e.data.data.pageData.length > 0) {
  714 + s.setData({
  715 + msgStatus: false,
  716 + });
  717 + //如果有数据 怕断分页为第一页的时候直接渲染数据
  718 + if (page > 1) {
  719 + //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面
  720 + var arr = s.data.requestData
  721 + console.log("arr:=" + JSON.stringify(arr))
  722 +
  723 + for (var i = 0; i < e.data.data.pageData.length;i++){
  724 + arr.push(e.data.data.pageData[i]);
  725 + }
  726 + console.log(arr)
  727 + s.setData({
  728 + requestData: arr
  729 + });
  730 +
  731 + }else{
  732 + s.setData({
  733 + requestData: e.data.data.pageData
  734 + });
  735 + if (wx.pageScrollTo) {
  736 + wx.pageScrollTo({
  737 + scrollTop: 0
  738 + })
  739 + }
  740 + }
  741 +
  742 + } else {
  743 + //没有数据页面显示暂无数据
  744 + if (page != 1) {
  745 + var dataArray = s.data.one_level_classify
  746 + var index = s.data.index
  747 + console.log(dataArray[index + 1]['items'])
  748 + s.setData({
  749 + msgStatus: true,
  750 + stylePage: 1,
  751 + index: index + 1,
  752 + select_classify_on: index + 1,
  753 + cat_id: dataArray[index + 1]['items']['id'],
  754 + classify_name: dataArray[index + 1]['items']['name']
  755 + });
  756 + s.style(s.data.stylePage, dataArray[index + 1]['items']['id'])
  757 + }else{
  758 + //没有数据而且是第一页的时候
  759 + s.setData({
  760 + stylePage: 1,
  761 + });
  762 + let countDownNum = 3; //获取倒计时初始值
  763 + s.setData({
  764 + msgStatus: true,
  765 + countDownNum: countDownNum,
  766 + requestData: []
  767 + });
  768 + s.setData({
  769 + timer:setInterval(function () {
  770 + if (countDownNum == 0) {
  771 + clearInterval(s.data.timer);
  772 + //关闭定时器之后,可作其他处理
  773 + s.setData({
  774 + msgStatus: false,
  775 + })
  776 +
  777 + //如果没有数据就把分页初始化成第一页
  778 + //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据
  779 + var dataArray = s.data.one_level_classify
  780 + var index = s.data.index
  781 + console.log(dataArray[index + 1])
  782 + if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){
  783 + console.log("dataArray[index + 1] = undefined")
  784 + s.setData({
  785 + stylePage: 1,
  786 + msgStatus: true,
  787 + lastMsg: true
  788 + });
  789 + }else{
  790 + s.setData({
  791 + stylePage: 1,
  792 + index: index + 1,
  793 + select_classify_on: index + 1,
  794 + cat_id: dataArray[index + 1]['items']['id'],
  795 + classify_name: dataArray[index + 1]['items']['name']
  796 + });
  797 + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']);
  798 + }
  799 +
  800 + }
  801 + countDownNum--;
  802 + s.setData({
  803 + countDownNum: countDownNum
  804 + })
  805 + }, 1000)
  806 +
  807 + })
  808 + }
  809 +
  810 +
  811 + }
  812 + }
  813 + });
  814 + },
  815 +
  816 +
  817 + openFilterModal: function () {
  818 + this.setData({
  819 + openFilterModal: !0
  820 + });
  821 + },
  822 + closeFilterModal: function () {
  823 + this.setData({
  824 + openFilterModal: !1
  825 + });
  826 + },
  827 + filterGoods: function (t) {
  828 + this.resetData(), this.requestGoodsList(t.currentTarget.dataset.href), this.closeFilterModal();
  829 + },
  830 + resetData: function () {
  831 + a.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
  832 + },
  833 +
  834 + //---回复最初的设置---
  835 + restoreData: function () {
  836 + this.setData({
  837 + requestData: null,
  838 + });
  839 + this.data.page = 1;
  840 + },
  841 +
  842 + //--- 获取卡类列表 ---
  843 + getPlusCardType: function (func) {
  844 + var storid = oo.stoid;
  845 + var th = this;
  846 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  847 + var plusCard = res.data.data;
  848 + var arr = [1219, 2089, 3031];
  849 + var new_arr = new Array();
  850 + var card_name_map = new Map();
  851 + var user = getApp().globalData.userInfo;
  852 + for (var i = 0; i < plusCard.length; i++) {
  853 + if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  854 + continue;
  855 + }
  856 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  857 + card_name_map.set(name, plusCard[i].CardName);
  858 + new_arr.push(plusCard[i]);
  859 + }
  860 +
  861 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  862 + func(ob);
  863 + })
  864 + },
530 865 });
531 866 \ No newline at end of file
... ...
pages/goods/categoryList/categoryList.wxml
  1 +<!-- 风格1 -->
1 2 <block wx:if="{{is_used_share==0}}">
2 3 <view class='top_view' wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
3   - <view class="swiper-tab" >
4   - <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}"
5   - data-current="0" bindtap="clickTab">分类</view>
6   - <view wx:if="{{is_show_gb}}" class="swiper-tab-item {{currentTab==1?'active':''}}"
7   - data-current="1" bindtap="clickTab">国家</view>
8   - <view wx:if="{{is_show_pp}}" class="swiper-tab-item {{currentTab==2?'active':''}}"
9   - data-current="2" bindtap="clickTab">品牌</view>
10   - </view>
11   -</view>
  4 + <view class="swiper-tab" >
  5 + <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}"
  6 + data-current="0" bindtap="clickTab">分类</view>
  7 + <view wx:if="{{is_show_gb}}" class="swiper-tab-item {{currentTab==1?'active':''}}"
  8 + data-current="1" bindtap="clickTab">国家</view>
  9 + <view wx:if="{{is_show_pp}}" class="swiper-tab-item {{currentTab==2?'active':''}}"
  10 + data-current="2" bindtap="clickTab">品牌</view>
  11 + </view>
  12 + </view>
12 13 <view class="search-box " bindtap="goseach">
13 14 <view class="search-inner">
14 15 <view class="search-img">
... ... @@ -16,7 +17,7 @@
16 17 </view>
17 18 <input bindfocus="goseach" class="search-cont" placeholder="寻找好口碑" type="text"></input>
18 19 </view>
19   -</view>
  20 + </view>
20 21 <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
21 22 <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;">
22 23 <!--------分类---------->
... ... @@ -84,16 +85,17 @@
84 85 <view class="no-data-title">暂无分类</view>
85 86 <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
86 87 </view>
87   -</block>
  88 + </block>
88 89 <block wx:elif="{{is_do}}">
89 90 <view class="no-data" >
90 91 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
91 92 <view class="no-data-title">商家暂未设置分类</view>
92 93 <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
93 94 </view>
  95 + </block>
94 96 </block>
95   -</block>
96   -<block wx:else>
  97 +<!-- 风格2 -->
  98 +<block wx:elif="{{is_used_share == 1}}">
97 99 <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
98 100 <!-- 新版分类头部 -->
99 101 <view class="xc-search-box flex-center white_b">
... ... @@ -262,4 +264,230 @@
262 264 </view>
263 265 </block>
264 266  
265   -</block>
266 267 \ No newline at end of file
  268 +</block>
  269 +<!-- 风格3 -->
  270 +<block wx:elif="{{is_used_share == 2}}">
  271 + <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
  272 + <!-- 头部 -->
  273 + <view class="xc-search-box flex-center white_b" id="navbar" style="position:fixed;top:0;z-index:99999">
  274 + <view class="share-height t-c" bindtap="getScancode" >
  275 + <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image>
  276 + <view class="fs24">
  277 + 扫一扫
  278 + </view>
  279 + </view>
  280 + <view class="xc-search-inner ">
  281 + <view class="search-img left">
  282 + <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image>
  283 + </view>
  284 + <input bindfocus="goseach" class="search-cont" placeholder="搜索你想要的生活" type="text"></input>
  285 + </view>
  286 + </view>
  287 + <!-- /头部 -->
  288 + <!-- 分类项目内容 -->
  289 + <view class="flex project_height" style="margin-left:-10rpx;">
  290 + <!-- 分类项目的类型 -->
  291 + <view class="project_type" style="height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:120rpx;">
  292 + <view class="project_type-frame" style="margin-bottom:50px;">
  293 + <view wx:if="{{is_show_gb}}">
  294 + <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}">
  295 + <text>国</text><text>家</text>
  296 + </view>
  297 + </view>
  298 + <view wx:if="{{is_show_pp}}">
  299 + <view bindtap="click_classify" class="{{select_classify_on==220?'select_classify':''}} share_type fs30 flex-space-between xc-letter-spacing" wx:if="{{is_brand}}"data-index="220"data-name="品牌">
  300 + <text>品</text><text>牌</text>
  301 + </view>
  302 + </view>
  303 + <view wx:if="{{is_show_pl}}">
  304 + <view wx:for="{{one_level_classify}}" wx:for-item="ittms" >
  305 + <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs30 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}">
  306 + <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}">
  307 + <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index">
  308 + <view>
  309 + {{name}}
  310 + </view>
  311 + </view>
  312 + </view>
  313 + <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}}</view>
  314 + </view>
  315 + </view>
  316 + </view>
  317 + </view>
  318 + </view>
  319 + <!-- 分类项目的内容 -->
  320 + <view class="classify_content" style="margin-left:26%;margin-top:60px">
  321 + <!-- 国家的样式 -->
  322 + <block wx:if="{{select_classify_on==223&&is_show_gb}}">
  323 + <view class="classify_name fs28 flex-space-between">
  324 + <view>{{ishaf_three==1?good_list.name:classify_name}}</view>
  325 +
  326 + </view>
  327 + <view class=" classify_content-frame flex-space-between " >
  328 + <view bindtap="go_nation" class="country_img-frame rel outer_location"wx:for="{{nationlist}}" wx:for-item="bitem" wx:for-index="pidx" data-nid="{{bitem.id}}" >
  329 + <image class="country_img" src="{{iurl}}{{bitem.logo}}"></image>
  330 + <view class='nation_box abs box'>
  331 + <view class='nt_1 t-c line-height' style="height:50rpx">
  332 + <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.name}}</text>
  333 + </view>
  334 + <view class='nt_2 t-c line-height fs24' style="line-height: 50rpx">
  335 + <text class="nation_y_name ellipsis-1 nt_1_t height fs24">{{bitem.enname}}</text>
  336 + </view>
  337 + </view>
  338 + <!--<view class='nation_box abs box' style="top:20rpx">-->
  339 + <!--</view>-->
  340 + </view>
  341 + </view>
  342 + </block>
  343 + <!-- 品牌 -->
  344 + <block wx:if="{{select_classify_on==220&&is_show_pp}}">
  345 +
  346 + <view class="classify_name fs28 flex-space-between">
  347 + <view>{{classify_name}}</view>
  348 + </view>
  349 +
  350 + <view class="classify_content-frame flex flex-wrap">
  351 +
  352 + <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx">
  353 + <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" >
  354 +
  355 + <view class="brand_img t-c">
  356 + <image class=" brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
  357 + <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view>
  358 + </view>
  359 + </view>
  360 +
  361 +
  362 + </block>
  363 + </view>
  364 + </block>
  365 + <!-- 品类-->
  366 + <block wx:if="{{is_show_pl}}">
  367 + <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}">
  368 + <view style="width:100%;height:100%;">
  369 + <view class="classify_name fs28 flex-space-between" id="header" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more' style="position:fixed;z-index:999999;top:65px;width:70%;background-color:#ffffff;left:26%;padding:0 10rpx;">
  370 + <view class="classify_title ellipsis-1">{{classify_name}}</view>
  371 + <view class="flex select_more" >
  372 + <view class="red-co fs24" >更多</view>
  373 + <view class="bg_right width_height"></view>
  374 + </view>
  375 + </view>
  376 + <!-- 显示商品列表开始 -->
  377 + <!-- <view class="classify_content-frame flex-wrap" style="width:100%;overflow:hidden;heigth:100%;"> -->
  378 +
  379 + <!-- <view class="null" style="width:100%;margin-top:70rpx;"></view> -->
  380 + <scroll-view scroll-y scroll-top="{{scrollTop}}" bindscrolltolower='scrollLower' style="height:{{windowHeight}};position:absolute;margin-top:70rpx;top:120rpx;bottom:0;rigth:0;left:26%;width:73%;margin-bottom:50px;">
  381 + <view class="null" style="width:100%;height:1px;"></view>
  382 + <!-- goodslist -->
  383 + <view class="choice_list" style="height:{{msgStatus != true?'100%':''}}">
  384 + <navigator class="choice_item" style="margin-bottom:{{dataLength -1 == index?'100px':'0'}}" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" data-id="{{index}}" wx:key="{{index}}">
  385 + <view class="img-wrap">
  386 + <image src="{{url+item.original_img}}" binderror="bind_Goodsbnerr" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
  387 + </view>
  388 + <view class="item-cont">
  389 + <view class="title">{{item.goods_name}}</view>
  390 + <!-- 判断是否有活动价 -->
  391 + <block wx:if="{{item.prom_price>0}}">
  392 + <!-- 活动价 -->
  393 + <view class="price">¥{{item.prom_price}}</view>
  394 + <view class="comment flex jc_sb">
  395 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  396 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  397 + </view>
  398 + </block>
  399 + <block wx:else>
  400 + <!-- 商品价格,先判断下是后又等级价-->
  401 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  402 + <!-- 当会员是等级卡的时候 -->
  403 + <block wx:if="{{card_field}}">
  404 + <!-- 等级价>0 -->
  405 + <block wx:if="{{item[card_field]>0}}">
  406 + <view class="flex ai_and">
  407 + <view class="price">¥{{item[card_field]}}</view>
  408 + <view class="card_bg">
  409 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  410 + <view class="card_name">{{card_name}}</view>
  411 + </view>
  412 + </view>
  413 + <view class="comment flex jc_sb">
  414 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  415 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  416 + </view>
  417 + </block>
  418 + <block wx:else>
  419 + <view class="price">¥{{item.shop_price}}</view>
  420 + <view class="comment flex jc_sb">
  421 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  422 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  423 + </view>
  424 + </block>
  425 + </block>
  426 + <block wx:else>
  427 + <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}">
  428 + <view class="flex ai-center">
  429 + <view class="price">¥{{item.shop_price}}</view>
  430 + <view class="word-line xc-ash mk_price">¥{{item.market_price}}</view>
  431 + </view>
  432 + <view class="comment flex jc_sb">
  433 + <view class="flex ai_and">
  434 + <view class="">¥{{g_filter.get_card_price(item,card_list,0)}}</view>
  435 + <view class="card_bg">
  436 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  437 + {{g_filter.get_card_price(item,card_list,1)}}
  438 + </view>
  439 + </view>
  440 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  441 + </view>
  442 + </block>
  443 + <block wx:else>
  444 + <view class="price">¥{{item.shop_price}}</view>
  445 + <view class="comment flex jc_sb">
  446 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  447 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  448 + </view>
  449 + </block>
  450 + </block>
  451 + </block>
  452 + <block wx:else>
  453 + <view class="price">¥{{item.shop_price}}</view>
  454 + <view class="comment flex jc_sb">
  455 + <view class="word-line xc-ash">¥{{item.market_price}}</view>
  456 + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
  457 + </view>
  458 + </block>
  459 + </block>
  460 + </view>
  461 + </navigator>
  462 + </view>
  463 + <view class="no-data" wx:if="{{msgStatus == true}}">
  464 + <!-- <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> -->
  465 +
  466 + <view wx:if="{{msgStatus == true && lastMsg == false}}" class="no-data-title" style="text-align:center;margin-top:100px">
  467 + <view style="color:#444;line-height:30px;">该类别暂无推荐商品</view><view style="color:#444;line-height:30px;"> {{countDownNum}} 秒后自动跳到下一个类别</view> </view>
  468 + <view wx:elif="{{lastMsg == true && msgStatus == true}}" class="no-data-title" style="text-align:center;margin-top:100px">该类别暂无推荐商品</view>
  469 + <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> -->
  470 + </view>
  471 +
  472 + </scroll-view>
  473 + <!-- /goodslist -->
  474 + </view>
  475 + <!-- 商品列表结束 -->
  476 +
  477 + </block>
  478 + </block>
  479 + </view>
  480 + </view>
  481 + </block>
  482 + <block wx:elif="{{is_do}}">
  483 + <view class="no-data" >
  484 + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
  485 + <view class="no-data-title">商家暂未设置分类</view>
  486 + <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  487 + </view>
  488 + </block>
  489 +
  490 +</block>
  491 +<!-- <view wx:if="{{isTabBar == true}}">
  492 + <import src="../../tabbar/tabbar.wxml" />
  493 + <template is="tabBar" data="{{tabBar}}" />
  494 +</view> -->
267 495 \ No newline at end of file
... ...
pages/goods/categoryList/categoryList.wxss
1 1 /*---nyf 2018-9-7---*/
  2 +
2 3 page{height: 100%; background: #fff;}
3 4 .top_view{ width: 100%;background: #fff;}
  5 +
4 6 .swiper-tab{
5 7 width: 70%;
6 8 text-align: center;
... ... @@ -262,7 +264,7 @@ width: 60%;
262 264 width: 90%;
263 265 margin: auto;
264 266 height: 70rpx;
265   - border-bottom: 1rpx solid #eee;
  267 + border-bottom: 1rpx solid #f5f6f6;
266 268 line-height: 85rpx;
267 269 font-weight: 600;
268 270  
... ... @@ -400,4 +402,7 @@ margin: auto;
400 402 width: 80%;
401 403 }
402 404  
403   -.brand_img_name {color: #666;}
404 405 \ No newline at end of file
  406 +.brand_img_name {color: #666;}
  407 +
  408 +/* 风格三商品列表样式引入 */
  409 +@import "../goodsList/goodsList.wxss";
405 410 \ No newline at end of file
... ...
pages/goods/goodsInfo/filter.wxs
... ... @@ -2,7 +2,13 @@ var is_has = function (text,val) {
2 2 if(text.indexOf(","+val+",")==-1) return false;
3 3 return true
4 4 }
5   -
  5 +function format_tt(ts) {
  6 + if(ts==null || ts==undefined || ts=='') return "";
  7 + var d = getDate(ts*1000)
  8 + var fm=(d.getMonth()+1)+"月"+ d.getDate()+"日";
  9 + return fm;
  10 +}
6 11 module.exports = {
7   - is_has: is_has
  12 + is_has: is_has,
  13 + format_tt:format_tt
8 14 }
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -236,6 +236,10 @@ Page({
236 236 sales_rules:1, //默认是线上销售
237 237  
238 238 wait_for_user_store:null,
  239 +
  240 + prom_goods:null, //商品优惠列表
  241 + order_prom:null, //订单优惠
  242 + collocationGoods:null, //搭配购
239 243  
240 244 },
241 245  
... ... @@ -547,11 +551,11 @@ Page({
547 551 mapurl: mapurl,
548 552 });
549 553  
550   -
551 554 },
552 555  
553 556 //---展示---
554 557 onShow: function() {
  558 +
555 559 var goods_list = null,th = this,that=this;
556 560 var ui = setInterval(function () {
557 561 goods_list = th.selectComponent("#goods_list");
... ... @@ -608,6 +612,8 @@ Page({
608 612 }
609 613 }
610 614  
  615 + ee.check_is_youhui(ee.data.gid);
  616 +
611 617 t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
612 618 var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2);
613 619 t.data.data['disc'] = txt;
... ... @@ -631,43 +637,40 @@ Page({
631 637 //获取统一条形码,普通商品和优惠促销的商品
632 638 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 4 || ee.data.data.prom_type == 5){
633 639 //默认门店要拿下门店库存
634   - if(that.data.sales_rules==2 && that.data.is_newsales_rules){
635   - //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存
636   - getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){
637   - if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){
638   - var lock=0,plist=null;
639   - //先读取门店的lock,采用链式写法,少用await
640   - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
641   - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000}
642   - }).then(res=>{
643   - if(res.data.code==0 && res.data.data.total>0){
644   - for(var i in res.data.data.pageData)
645   - lock+=res.data.data.pageData[i].outQty
646   - }
647   - //---通过接口获取门店的线下库存信息--
648   - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
649   - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid}
650   - })
651   - }).then(res=>{
652   - if(res.data.code==0 && res.data.data.total>0){
653   - plist=res.data.data.pageData[0];
654   - }
655   - if(plist && plist.CanOutQty-lock>0){
656   - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock;
657   - }else{
658   - that.data.fir_def_store.CanOutQty=0;
659   - }
660   - //--给门店赋值线下库存--
661   - th.setData({def_pick_store:that.data.fir_def_store});
662   - //获取门店
663   - ee.get_sto();
664   - })
665   - }else{
666   - //--获取门店--
667   - ee.get_sto();
668   - }
669   - })
670   - }else{
  640 + if(that.data.sales_rules==2 && that.data.is_newsales_rules){
  641 + //获取门店
  642 + ee.get_sto();
  643 + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存
  644 + getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){
  645 + if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){
  646 + var lock=0,plist=null;
  647 + //先读取门店的lock,采用链式写法,少用await
  648 + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  649 + data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000}
  650 + }).then(res=>{
  651 + if(res.data.code==0 && res.data.data.total>0){
  652 + for(var i in res.data.data.pageData)
  653 + lock+=res.data.data.pageData[i].outQty
  654 + }
  655 + //---通过接口获取门店的线下库存信息--
  656 + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  657 + data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid}
  658 + })
  659 + }).then(res=>{
  660 + if(res.data.code==0 && res.data.data.total>0){
  661 + plist=res.data.data.pageData[0];
  662 + }
  663 + if(plist && plist.CanOutQty-lock>0){
  664 + that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock;
  665 + }else{
  666 + that.data.fir_def_store.CanOutQty=0;
  667 + }
  668 + //--给门店赋值线下库存--
  669 + th.setData({def_pick_store:that.data.fir_def_store});
  670 + })
  671 + }
  672 + })
  673 + }else{
671 674 //获取门店
672 675 ee.get_sto();
673 676 }
... ... @@ -926,6 +929,11 @@ Page({
926 929 sku: o.sku,
927 930 };
928 931  
  932 + //如果是积分够,is_integral_normal就要有积分购普通购买字段
  933 + if(o.prom_type==4){
  934 + newd.is_integral_normal=1;
  935 + }
  936 +
929 937 //-----如果是秒杀,团购,积分购,拼团-----
930 938 if (th.data.prom_type == 1) {
931 939 newd.goods_price = th.data.prom_price;
... ... @@ -938,9 +946,11 @@ Page({
938 946  
939 947 th.add_cart_next(e,t,a,o,newd); //加入购物车下一步
940 948  
941   - } else if ( th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) {
  949 + }
  950 + else if ( th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) {
942 951 newd.prom_type = 0;
943 952 newd.prom_id = 0;
  953 +
944 954 //---如果是线下门店销售的时候---
945 955 if(th.data.sales_rules==2){
946 956 var pick=th.get_pick_from_list(th.data.sto_sele_id)
... ... @@ -992,7 +1002,7 @@ Page({
992 1002  
993 1003 //---加入购物车的最后一步---
994 1004 add_cart_next(e,t,a,o,newd,CanOutQty){
995   - var th=this;
  1005 + var th=this,i=getApp().request;
996 1006 //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
997 1007 if(o.prom_type!=1 && o.prom_type!=6){
998 1008 var conf=th.data.bconfig;
... ... @@ -1010,13 +1020,22 @@ Page({
1010 1020 if(getApp().globalData.userInfo['card_field']!=undefined && getApp().globalData.userInfo['card_field']!=null
1011 1021 && getApp().globalData.userInfo['card_field']!="" && card_price>0){
1012 1022 newd.goods_price=card_price;
  1023 + newd.member_goods_price=card_price;
1013 1024 }
1014 1025 }
1015 1026 }
1016 1027 }
1017   -
  1028 +
  1029 +
  1030 +
1018 1031 //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
1019 1032 if ("add" == t.currentTarget.dataset.action) {
  1033 +
  1034 + if(th.data.prom_goods){
  1035 + newd.prom_type = 3;
  1036 + newd.prom_id = th.data.prom_goods[0].prom_id;
  1037 + }
  1038 +
1020 1039 //----先看会员在购物车中是否加入了该商品-----
1021 1040 i.get("/api/weshop/cart/page", {
1022 1041 data: {
... ... @@ -1043,12 +1062,12 @@ Page({
1043 1062 }
1044 1063 }
1045 1064  
1046   -
1047   -
  1065 +
1048 1066 var updata = {
1049 1067 id: item.id,
1050 1068 goods_num: e.data.goodsInputNum + item.goods_num,
1051 1069 goods_price: newd.goods_price,
  1070 + member_goods_price:newd.goods_price,
1052 1071 store_id: th.data.stoid,
1053 1072 };
1054 1073  
... ... @@ -1081,6 +1100,30 @@ Page({
1081 1100 }
1082 1101 //else "exchange" == t.currentTarget.dataset.action ? this.exchange(d) : this.buyNow(d);
1083 1102 else {
  1103 +
  1104 + if(th.data.prom_goods){
  1105 + var prom_d=th.data.prom_goods;
  1106 + for(var i in prom_d){
  1107 + //判断活动有俩种条件,0元 1件
  1108 + var condition_t=prom_d[i].prom_type;
  1109 + switch(condition_t) {
  1110 + case 0: //按钱
  1111 + if(newd.goods_price>=condition_t){
  1112 + newd.prom_type = 3;
  1113 + newd.prom_id = prom_d[i].prom_id;
  1114 + }
  1115 + break
  1116 + case 1://按购买数量
  1117 + if(newd.goods_num>=condition_t){
  1118 + newd.prom_type = 3;
  1119 + newd.prom_id = prom_d[i].prom_id;
  1120 + }
  1121 + break;
  1122 + }
  1123 + }
  1124 +
  1125 + }
  1126 +
1084 1127 newd['pick_name'] = th.data.sto_sele_name;
1085 1128 newd['pick_dis'] = th.data.sto_sele_distr;
1086 1129 th.buyNow(newd);
... ... @@ -1317,6 +1360,8 @@ Page({
1317 1360 data: {
1318 1361 store_id: o.stoid,
1319 1362 user_id: s.globalData.user_id,
  1363 + state:0,
  1364 + is_gift:0
1320 1365 },
1321 1366 success: function(e) {
1322 1367 var num = 0;
... ... @@ -1515,8 +1560,11 @@ Page({
1515 1560 if (item) this.setData({
1516 1561 sele_g: item,
1517 1562 gid: gid
1518   - });
1519   -
  1563 + });
  1564 +
  1565 + that.check_is_youhui(gid)
  1566 +
  1567 +
1520 1568 this.get_sto();
1521 1569 //默认门店要拿下门店库存
1522 1570 if(that.data.sales_rules==2 && that.data.def_pick_store){
... ... @@ -3921,12 +3969,14 @@ Page({
3921 3969 getPlusCardType: function (func) {
3922 3970 var storid = os.stoid;
3923 3971 var th = this;
  3972 + var user=getApp().globalData.userInfo;
3924 3973 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
3925 3974 var plusCard = res.data.data;
3926 3975 var arr = [1219, 2089, 3031];
3927 3976 var new_arr = new Array();
3928 3977 var card_name_map=new Map();
3929 3978 for (var i = 0; i < plusCard.length; i++) {
  3979 + if((user.card_field==null || user.card_field=="") && plusCard[i].IsStopBuy==true) continue;
3930 3980 var name="card"+plusCard[i].CorrPrice.toLowerCase();
3931 3981 card_name_map.set(name,plusCard[i].CardName);
3932 3982 }
... ... @@ -3951,9 +4001,51 @@ Page({
3951 4001 return item;
3952 4002 }
3953 4003 }
3954   - }
3955   -
  4004 + },
  4005 + //-----显示优惠券的时候情况-----
  4006 + show_more_cx:function () {
  4007 + if(this.data.is_more_cx){
  4008 + this.setData({is_more_cx:0});
  4009 + }else{
  4010 + this.setData({is_more_cx:1});
  4011 + }
  4012 + },
  4013 +
  4014 + //----跳转到搭配购买----
  4015 + go_prom_list:function () {
  4016 + wx.navigateTo({ url: "../../../packageA/pages/prom_list/prom_list?goods_id="+this.data.gid, })
  4017 + },
  4018 +
  4019 + //---检查有没有优惠活动---
  4020 + check_is_youhui:function(gid){
  4021 + var th=this;
  4022 + //调用接口判断订单优惠,
  4023 + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+gid+"/0", {}).then(res => {
  4024 + if(res.data.code==0){
  4025 + var r_data=res.data.data;
  4026 + var max=0,min=0;
  4027 + if(r_data.collocationList){
  4028 + for(var i in r_data.collocationList){
  4029 + if(max==0) max=r_data.collocationList[i].price;
  4030 + if(min==0) min=r_data.collocationList[i].price;
  4031 +
  4032 + if(max<parseFloat(r_data.collocationList[i].price)) max=r_data.collocationList[i].price;
  4033 + if(min>parseFloat(r_data.collocationList[i].price)) min=r_data.collocationList[i].price;
  4034 + }
  4035 + r_data.collocationPromList.max=(max+th.data.data.shop_price).toFixed(2);
  4036 + r_data.collocationPromList.min=(min+th.data.data.shop_price).toFixed(2);
  4037 + }
  4038 + th.setData({
  4039 + order_prom:r_data.promOrder,
  4040 + collocationGoods:r_data.collocationPromList,
  4041 + prom_goods:r_data.promGoodsLists,
  4042 + })
  4043 + }
  4044 + })
  4045 + }
3956 4046  
  4047 +
  4048 +
3957 4049  
3958 4050  
3959 4051 });
... ...
pages/goods/goodsInfo/goodsInfo.wxml
1 1 <import src="../../../utils/wxParse/wxParse.wxml"></import>
2 2 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
3 3 <wxs module="g_filters" src="g_filter.wxs"></wxs>
4   -<wxs module="" src="filter.wxs"></wxs>
  4 +<wxs module="tool" src="filter.wxs"></wxs>
  5 +
5 6 <!-- 商品内容区域,普通商品,秒杀,拼团 -->
6 7 <block wx:if="{{isshow}}">
7 8 <view class="container">
... ... @@ -434,11 +435,77 @@
434 435 </view>
435 436 </view>
436 437 </view>
  438 +
  439 + <!-- 要判断是不是有促销活动 -->
  440 + <block wx:if="{{prom_goods}}">
  441 + <view class="cx-frame flex" style="position: relative; height: auto" >
  442 + <view class="cx-sizs wsize">促销</view>
  443 + <!-- 中间显示层 -->
  444 + <view style="margin-top: 36rpx">
  445 + <view class="cx_show_view flex fs28" wx:for="{{prom_goods}}">
  446 + <view class="prom_condition">消费满{{item.condition}}<text wx:if="{{item.prom_type==1}}">件</text><text wx:else>元</text></view>
  447 + <view class="word {{is_more_cx?'':'ellipsis-1'}}">
  448 + <text wx:if="{{item.money>0}}">减价{{item.money}}元;</text>
  449 + <text wx:if="{{item.sale>0}}">打{{item.sale}}折;</text>
  450 + <text wx:if="{{item.past==1}}">包邮;</text>
  451 + <text wx:if="{{item.intValue>0}}">送{{tem.intValue}}积分;</text>
  452 + <text wx:if="{{item.couponId>0}}">送{{item.couponMoney}}元优惠券;</text>
  453 + <text wx:if="{{item.gift_id>0}}">送商品{{item.goods_name}};</text>
  454 + <text wx:if="{{item.lb_id>0}}">送{{item.lbtitle}};</text>
  455 + </view>
  456 + </view>
  457 +
  458 + </view>
  459 + <view data-coupon="1" bindtap="show_more_cx" class="cx-obtain-coupon wsize">
  460 + <text class="bg_jj {{is_more_cx?'down1':''}}"></text>
  461 + </view>
  462 + </view>
  463 + </block>
  464 +
  465 + <!-- 要判断是不是有订单优惠 -->
  466 + <block wx:if="{{order_prom}}">
  467 + <view class="cx-frame flex" style="position: relative; height: auto" >
  468 + <view class="cx-sizs wsize" style="width: 144rpx">订单优惠</view>
  469 + <!-- 中间显示层 -->
  470 + <view class="flex ai-center">
  471 + <image class="hui_img" src="{{iurl}}/miniapp//images/hui.png"></image>
  472 + <view class="order_hui">
  473 + <view class="fs28 ellipsis-1">{{order_prom.name}}</view>
  474 + <view class="fs26" >(活动时间:{{tool.format_tt(order_prom.start_time)}} - {{tool.format_tt(order_prom.end_time)}})</view>
  475 + </view>
  476 + </view>
  477 + </view>
  478 + </block>
  479 +
  480 +
437 481 <view class="bz_view one_elli" wx:if="{{bconfig}}">
438 482 <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image>
439 483 <text>{{bconfig.service_bz}}</text>
440 484 </view>
441 485  
  486 +
  487 + <!--- 搭配促销 ---->
  488 + <view class="dp_cx_view" wx:if="{{collocationGoods}}">
  489 + <view class="bb_view">
  490 + <view>优惠热配</view>
  491 + <view class="red_bb" bindtap="go_prom_list">查看全部
  492 + <text class="bg_jj"></text>
  493 + </view>
  494 + </view>
  495 +
  496 + <!-- 搭配的显示 -->
  497 + <view class="flex" bindtap="go_prom_list">
  498 + <image class="dp_img" src="{{iurl+collocationGoods.img_url}}"></image>
  499 + <view class="act_content">
  500 + <view class="fs32">{{collocationGoods.title}}</view>
  501 + <view class="fs30 color_b" wx:if="{{collocationGoods.max!=collocationGoods.min}}">搭配价¥{{collocationGoods.min}}-{{collocationGoods.max}}</view>
  502 + <view class="fs30 color_b" wx:else>搭配价¥{{collocationGoods.min}}</view>
  503 + <view class="fs30 color-gray">活动至{{filters.format_time(collocationGoods.end_time,1)}}</view>
  504 + </view>
  505 + </view>
  506 + </view>
  507 +
  508 +
442 509 <!--- 宝贝评价 ---->
443 510 <view style="overflow: hidden">
444 511 <view class="bb_view">
... ... @@ -1029,6 +1096,8 @@
1029 1096 </view>
1030 1097  
1031 1098 </view>
  1099 +
  1100 +
1032 1101 <!----弹起来,选择规格数量,拼单商品购买------>
1033 1102 <view hidden="{{!openSpecModal_pt}}">
1034 1103 <view bindtap="closeSpecModal" class="cover-layer"></view>
... ...
pages/goods/goodsInfo/goodsInfo.wxss
... ... @@ -333,8 +333,11 @@ image {
333 333 width: 29%;
334 334 }
335 335  
336   -.join-cart>view.new_split {
337   - width: 14%;
  336 +.join-cart>.new_split {
  337 + width: 13%;
  338 + text-align: center;
  339 + padding: 0;
  340 + margin: 0;
338 341 }
339 342  
340 343 .cart-ico {
... ... @@ -957,6 +960,8 @@ left:31rpx;}
957 960 transform: rotate(45deg);display:inline-block;
958 961 margin-bottom:3rpx;
959 962 }
  963 +.bg_jj.down1{transform: rotate(135deg);}
  964 +
960 965 /* 顶部边框 */
961 966 .topframe{
962 967 width: 100%;
... ... @@ -2302,6 +2307,7 @@ width: 100%;
2302 2307 height: 91.9%;
2303 2308  
2304 2309 }
  2310 +
2305 2311 .popup-frame{
2306 2312 position: fixed;
2307 2313 bottom:99rpx;
... ... @@ -2567,4 +2573,29 @@ button.custom-service { line-height: normal; border: 0;}
2567 2573 button.custom-service::after{
2568 2574 border: 0;
2569 2575 }
2570   -.no_store{color:#d60021; font-size: 26rpx;}
2571 2576 \ No newline at end of file
  2577 +.no_store{color:#d60021; font-size: 26rpx;}
  2578 +.cx_show_view{ width: 580rpx; line-height: 30rpx; margin-bottom: 6rpx; }
  2579 +.cx_show_view .word{ width: 400rpx}
  2580 +.prom_condition {
  2581 + color: #d60021;
  2582 + width: 180rpx;
  2583 + height: 30rpx;
  2584 + font-size: 20rpx;
  2585 + padding-top: 0.01rpx;
  2586 + display: flex;
  2587 + justify-content: center;
  2588 + align-items: center;
  2589 + border: #d60021 solid 1rpx;
  2590 + border-radius: 10rpx;
  2591 + margin-right:10rpx ;
  2592 + margin-left: 10rpx;
  2593 +
  2594 +}
  2595 +.hui_img{ width: 44rpx; height: 44rpx; margin-right: 8rpx}
  2596 +.order_hui{color: #444; width: 420rpx}
  2597 +.order_hui view{ height: 34rpx; line-height: 34rpx;}
  2598 +.dp_img{width: 240rpx; height: 240rpx; margin: 0 40rpx}
  2599 +.dp_cx_view{border-bottom: 0.02rpx solid #eee; padding-bottom: 40rpx}
  2600 +.act_content{ margin-top: 40rpx}
  2601 +.act_content view{ margin-bottom: 12rpx}
  2602 +.color_b{color: #ff9c00}
2572 2603 \ No newline at end of file
... ...
pages/goods/goodsList/goodsList.js
... ... @@ -3,6 +3,7 @@
3 3 default: t
4 4 };
5 5 }(require("../../../utils/LoadMore.js")), e = getApp(), a = new t.default(), oo = e.globalData.setting, ut = require("../../../utils/util.js");
  6 +var regeneratorRuntime = require('../../../utils/runtime.js');
6 7  
7 8 Page({
8 9 data: {
... ... @@ -19,7 +20,9 @@ Page({
19 20 adname:"desc", //升降的字段
20 21 is_new:0,
21 22 is_hot:0,
  23 + prom_goods_list:null,
22 24 },
  25 +
23 26 onLoad: function(t) {
24 27 var th=this;
25 28 a.init(this, "", "requestData");
... ... @@ -47,8 +50,22 @@ Page({
47 50  
48 51 if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; }
49 52 if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; }
  53 +
  54 + //优惠活动的凑单
  55 + if(t.prom_type==3){
  56 + if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
  57 + if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
  58 + //-- 获取 --
  59 + getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
  60 + data:{prom_id:t.prom_id }
  61 + }).then(res=>{
  62 + if(res.data.code==0){
  63 + var arr= res.data.data;
  64 + th.set_prom_list(arr);
  65 + }
  66 + })
  67 + }
50 68 this.requestGoodsList(url);
51   -
52 69 getApp().getConfig2(function(rs){
53 70 //计算等级价相关
54 71 var swithc_list=rs.switch_list;
... ... @@ -80,8 +97,38 @@ Page({
80 97 },500)
81 98 }
82 99 });
83   -
84 100 },
  101 +
  102 + //设置优惠券的
  103 + set_prom_list:async function(arr){
  104 + var th=this;
  105 + for(var i in arr){
  106 + //优惠的实际内容
  107 + var content=JSON.parse(arr[i].preferential_type);
  108 + arr[i].content=content;
  109 +
  110 + //--送礼包--
  111 + if(content.is_libao) {
  112 + //-- 获取 --
  113 + await getApp().request.promiseGet("/api/weshop/libao/libaoForm/page?id="+content.libao+"&store_id="+oo.stoid, {
  114 + }).then(res => {
  115 + if(res.data.code==0)
  116 + arr[i].content.lb_name=res.data.data.pageData[0].lbtitle;
  117 + })
  118 + }
  119 + //--送赠品--
  120 + if(content.is_gift) {
  121 + //-- 获取 --
  122 + await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+content.gift+"&store_id="+oo.stoid, {
  123 + }).then(res => {
  124 + if(res.data.code==0)
  125 + arr[i].content.gift_name=res.data.data.pageData[0].goods_name;
  126 + })
  127 + }
  128 + }
  129 + th.setData({prom_goods_list:arr});
  130 + },
  131 +
85 132 changeTab: function(t) {
86 133 var ord = t.currentTarget.dataset.href;
87 134 var ad = t.currentTarget.dataset.ad;
... ... @@ -171,13 +218,18 @@ Page({
171 218 var plusCard = res.data.data;
172 219 var arr = [1219, 2089, 3031];
173 220 var new_arr = new Array();
174   - var card_name_map=new Map();
175   - for (var i = 0; i < plusCard.length; i++) {
  221 + var card_name_map=new Map();
  222 + var user = getApp().globalData.userInfo;
  223 + for (var i = 0; i < plusCard.length; i++) {
  224 + if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
  225 + continue;
  226 + }
176 227 var name="card"+plusCard[i].CorrPrice.toLowerCase();
177   - card_name_map.set(name,plusCard[i].CardName);
  228 + card_name_map.set(name,plusCard[i].CardName);
  229 + new_arr.push(plusCard[i]);
178 230 }
179 231  
180   - var ob={"card_list":plusCard,"name_map":card_name_map};
  232 + var ob={"card_list":new_arr,"name_map":card_name_map};
181 233 func(ob);
182 234 })
183 235 },
... ...
pages/goods/goodsList/goodsList.wxml
1 1 <wxs module="g_filter" src="g_filter.wxs"></wxs>
2 2 <view class="container">
  3 + <view style="padding: 20rpx 30rpx">
  4 + <block wx:for="{{prom_goods_list}}">
  5 + <view class="fs30 ellipsis-1">
  6 + 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text>
  7 + <text space="{{true}}" wx:if="{{item.content.is_money}}">减{{item.content.money}}元 </text>
  8 + <text space="{{true}}" wx:if="{{item.content.is_sale}}">打{{item.content.sale}}折 </text>
  9 + <text space="{{true}}" wx:if="{{item.content.is_int}}">送{{item.content.int}}积分 </text>
  10 + <text space="{{true}}" wx:if="{{item.content.is_coupon}}">送{{item.content.coupon}}元优惠券 </text>
  11 + <text space="{{true}}" wx:if="{{item.content.is_gift}}">送{{item.content.gift_name}} </text>
  12 + <text space="{{true}}" wx:if="{{item.content.is_libao}}">送{{item.content.lb_name}} </text>
  13 + </view>
  14 + </block>
  15 + </view>
  16 +
3 17 <view class="nav">
4 18 <navigator bindtap="changeTab" class="nav-item" data-href="goods_id" data-ad="{{adname}}">综合
5 19 <view class="ico-dg" wx:if="{{tabname=='goods_id'}}">
... ...
pages/goods/goodsList/goodsList.wxss
... ... @@ -64,7 +64,7 @@
64 64 width: 100%;
65 65 min-height: 200rpx;
66 66 padding: 10rpx 0;
67   - border-bottom: 1px solid #dfefef;
  67 + border-bottom: 1px solid #f5f6f6;
68 68 font-size: 30rpx;
69 69 }
70 70  
... ...
pages/goods/search/search.js
... ... @@ -197,13 +197,20 @@ Page({
197 197 var plusCard = res.data.data;
198 198 var arr = [1219, 2089, 3031];
199 199 var new_arr = new Array();
200   - var card_name_map=new Map();
201   - for (var i = 0; i < plusCard.length; i++) {
202   - var name="card"+plusCard[i].CorrPrice.toLowerCase();
203   - card_name_map.set(name,plusCard[i].CardName);
  200 + var card_name_map=new Map();
  201 + var user = getApp().globalData.userInfo;
  202 +
  203 + for (var i = 0; i < plusCard.length; i++) {
  204 + if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
  205 + continue;
  206 + }
  207 + var name="card"+plusCard[i].CorrPrice.toLowerCase();
  208 + card_name_map.set(name,plusCard[i].CardName);
  209 + new_arr.push(plusCard[i]);
  210 +
204 211 }
205 212  
206   - var ob={"card_list":plusCard,"name_map":card_name_map};
  213 + var ob={"card_list":new_arr,"name_map":card_name_map};
207 214 func(ob);
208 215 })
209 216 },
... ...
pages/index/index/index.js
... ... @@ -77,7 +77,7 @@ Page({
77 77  
78 78 onLoad: function() {
79 79 var th = this;
80   -
  80 +
81 81 //看一下商家是否开通了权益
82 82 //--初始化是否有打勾--
83 83 getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
... ... @@ -102,9 +102,44 @@ Page({
102 102 is_disgraceful: 0
103 103 })
104 104 },
  105 +
105 106 async onShow() {
106 107 var th = this;
107   -
  108 + //获取底部导航
  109 + // await getApp().request.promiseGet("/api/weshop/storeFooter/get/"+o.stoid, {
  110 +
  111 + // }).then(res => {
  112 + // var e = res;
  113 + // console.log(e)
  114 + // if(e.data.code != -1){
  115 + // getApp().globalData.isTabBar = true
  116 + // //console.log(JSON.parse(e))
  117 + // var itemList = e.data.data.data;
  118 +
  119 + // itemList = JSON.parse(itemList)
  120 + // for(var i=0; i<itemList.length; i++){
  121 + // itemList[i]['active'] = false
  122 + // }
  123 + // console.log(itemList)
  124 + // getApp().globalData.tabBar.backgroundColor = e.data.data.bkcolor
  125 + // getApp().globalData.tabBar.selectedColor = e.data.data.fontcolor_sele
  126 + // getApp().globalData.tabBar.color = e.data.data.fontcolor
  127 + // getApp().globalData.tabBar.list = itemList
  128 + // getApp().globalData.tabBar.iscustom = '1'
  129 + // getApp().globalData.tabBar.url = "";
  130 + // wx.hideTabBar({})
  131 + // }else{
  132 + // getApp().globalData.isTabBar = true
  133 + // getApp().globalData.tabBar.iscustom = '2'
  134 + // getApp().globalData.tabBar.url = th.data.url;
  135 + // }
  136 + // th.setData({
  137 + // isTabBar: getApp().globalData.isTabBar,
  138 + // });
  139 + // })
  140 + // console.log("isTabBar:="+getApp().globalData.isTabBar)
  141 + // t.editTabBar(); //显示自定义的底部导航
  142 +
108 143 if (getApp().globalData.user_id) getApp().requestCardNum();
109 144 await this.init_load();
110 145 //显示的时候要开启计时器
... ...
pages/index/index/index.wxml
... ... @@ -246,7 +246,7 @@
246 246 </view>
247 247  
248 248 <!-- 好物推荐 -->
249   - <view class="title">
  249 + <view class="title" style="margin-bottom:{{isTabBar == true ? '50px' : '0'}}">
250 250 <!-- 标题 -->
251 251 <view>
252 252 <!-- 中文名标题 -->
... ... @@ -359,7 +359,9 @@
359 359 </view>
360 360 </view>
361 361 </block>
362   -
363   -
  362 +<!-- <view wx:if="{{isTabBar == true}}"> -->
  363 + <!-- <import src="../../tabbar/tabbar.wxml" />
  364 + <template is="tabBar" data="{{tabBar}}" /> -->
  365 +<!-- </view> -->
364 366  
365 367  
... ...
pages/tabbar/tabbar.js 0 → 100644
  1 +// pages/tabbar.js
  2 +var d = getApp().globalData;
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + isTabBar:d.isTabBar
  10 + },
  11 +
  12 + /**
  13 + * 生命周期函数--监听页面加载
  14 + */
  15 + onLoad: function (options) {
  16 +
  17 + },
  18 +
  19 + /**
  20 + * 生命周期函数--监听页面初次渲染完成
  21 + */
  22 + onReady: function () {
  23 +
  24 + },
  25 +
  26 + /**
  27 + * 生命周期函数--监听页面显示
  28 + */
  29 + onShow: function () {
  30 +
  31 + },
  32 +
  33 + /**
  34 + * 生命周期函数--监听页面隐藏
  35 + */
  36 + onHide: function () {
  37 +
  38 + },
  39 +
  40 + /**
  41 + * 生命周期函数--监听页面卸载
  42 + */
  43 + onUnload: function () {
  44 +
  45 + },
  46 +
  47 + /**
  48 + * 页面相关事件处理函数--监听用户下拉动作
  49 + */
  50 + onPullDownRefresh: function () {
  51 +
  52 + },
  53 +
  54 + /**
  55 + * 页面上拉触底事件的处理函数
  56 + */
  57 + onReachBottom: function () {
  58 +
  59 + },
  60 +
  61 + /**
  62 + * 用户点击右上角分享
  63 + */
  64 + onShareAppMessage: function () {
  65 +
  66 + }
  67 +})
0 68 \ No newline at end of file
... ...
pages/tabbar/tabbar.json 0 → 100644
  1 +{
  2 + "usingComponents": {}
  3 +}
0 4 \ No newline at end of file
... ...
pages/tabbar/tabbar.wxml 0 → 100644
  1 +<!--pages/tabbar.wxml-->
  2 +
  3 + <template name="tabBar">
  4 + <view class="tab-bar" style="position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; {{tabBar.position=='top'? 'top: 0' : 'bottom: 0'}};width:100%;height:50px;z-index:9999999">
  5 + <block wx:for="{{tabBar.list}}" wx:key="weappurl">
  6 + <navigator url="{{item.weappurl}}" bindtap="goto({{item.weappurl}})" class="tabbar_item {{item.clas}}" style="{{item.active? 'color: '+(item.selectedColor? item.selectedColor : tabBar.selectedColor) : ''}};position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  7 + <view style="width:50%;height:50%;margin-left:25%;"><image src="{{tabBar.url}}{{item.src_sele}}" wx:if="{{item.active&&item.src_sele}}" class="img" style="width:100%;height:100%"></image>
  8 + <image src="{{tabBar.url}}{{item.src}}" wx:if="{{!item.active&&item.src}}" class="img" style="width:100%;height:100%"></image></view>
  9 + <view style="width:100%;height:100%;"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.8rem">{{item.nav_name}}</text></view>
  10 + </navigator>
  11 + </block>
  12 + </view>
  13 + </template>
... ...
pages/tabbar/tabbar.wxss 0 → 100644
  1 +/* pages/tabbar.wxss */
0 2 \ No newline at end of file
... ...
pages/user/cardinfo/cardinfo.js
... ... @@ -41,7 +41,7 @@ Page({
41 41 free:null,//分佣的数据
42 42 expiryDate:"",//卡到期时间
43 43 is_guoqi:0, //卡是不是过期
44   -
  44 + IsStopBuy:0, //卡是否停用
45 45 yu_e_show:0,//装入余额的弹窗
46 46 },
47 47  
... ... @@ -166,6 +166,10 @@ Page({
166 166 user_card.CardImg = th.data.url + "/miniapp/images/plus/bg" + index + ".jpg?v=1";
167 167  
168 168 }
  169 + if (user_card.IsStopBuy==true){
  170 + this.setData({IsStopBuy:1})
  171 + }
  172 +
169 173  
170 174 console.log(user_card,"会员的卡类");
171 175 ee.setData({user_card: user_card});
... ... @@ -718,12 +722,20 @@ Page({
718 722 if (res.data.code == 0) {
719 723 end_time=res.data.data.pageData[0].end_time;
720 724 }
721   - })
  725 + })
  726 +
722 727 var now=ut.gettimestamp();
723 728 if(end_time<now){
724 729 getApp().my_warnning("请联系商家升级plus功能", 0, th);
725 730 return false;
726   - }
  731 + }
  732 +
  733 + if (th.data.IsStopBuy==1)
  734 + {
  735 + getApp().my_warnning("该卡已停用,无法续费!", 0, th);
  736 + return false;
  737 + }
  738 +
727 739  
728 740 end_time=ut.format(end_time,'yyyy-MM-dd');
729 741 var errmsg="";
... ...
pages/user/index/index.js
... ... @@ -41,6 +41,7 @@ Page({
41 41 actImg: "",
42 42 is_assistance: 0, //助力活动
43 43 ad_img:"",
  44 + isshow_vip:0,
44 45 },
45 46 goto_nav: function(e) {
46 47 var th = this;
... ... @@ -78,12 +79,19 @@ Page({
78 79 onShow: function() {
79 80  
80 81 this.is_assistance();
  82 + this.getPlusCardType();
  83 +
81 84  
82 85 var stoid = app_d.setting.stoid;
83 86 var s = this,
84 87 th = s,
85 88 need_money = 0,
86 89 cur_g_num = 0;
  90 + th.setData({
  91 + isTabBar: getApp().globalData.isTabBar,
  92 + });
  93 +
  94 + app.editTabBar(); //显示自定义的底部导航
87 95 getApp().get_isbuy(th.setappdata);
88 96 if (getApp().globalData.user_id) getApp().requestCardNum();
89 97 /*------会员登录------*/
... ... @@ -626,9 +634,23 @@ Page({
626 634  
627 635 }
628 636 })
629   - }
630   -
631   -
  637 + },
632 638  
  639 + //--- 获取卡类列表 ---
  640 + getPlusCardType: function () {
  641 + var storid = os.stoid;
  642 + var th = this;
  643 + var isshow_vip=0;
  644 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  645 + if(res.data.code==0){
  646 + for(var i in res.data.data){
  647 + var item=res.data.data[i];
  648 + //IsStopBuy 如果是真的话,代表这个卡没有停用
  649 + if(item.IsStopBuy!=true){ isshow_vip=1;break; }
  650 + }
  651 + th.setData({isshow_vip:isshow_vip})
  652 + }
  653 + })
  654 + }
633 655  
634 656 })
... ...
pages/user/index/index.wxml
1   -<view class="xc-page">
  1 +<view class="xc-page" style="margin-bottom:{{isTabBar == true ? '50px' : '0'}}">
2 2 <view class="xc-user">
3 3 <view class="xc-head rel">
4 4 <image class="xc-background" src="{{iurl}}{{ad_img?ad_img:'/miniapp/images/user_index_powder.jpg'}}">
... ... @@ -63,6 +63,9 @@
63 63 </image>
64 64  
65 65 </view>
  66 +
  67 + <block wx:if="{{isshow_vip}}">
  68 +
66 69 <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==2}}">
67 70 <view class="xc-add-member flex-center-around ">
68 71 <view class="flex jc-center ai-center">
... ... @@ -86,6 +89,7 @@
86 89 </view>
87 90 </view>
88 91 </view>
  92 + </block>
89 93  
90 94 </view>
91 95 <view class="xc-after-sale rel">
... ... @@ -297,3 +301,7 @@
297 301 </view>
298 302  
299 303 <pop_txt id="pop_txt"></pop_txt>
  304 +<!-- <view wx:if="{{isTabBar == true}}">
  305 + <import src="../../tabbar/tabbar.wxml" />
  306 + <template is="tabBar" data="{{tabBar}}" />
  307 +</view> -->
300 308 \ No newline at end of file
... ...
pages/user/order_detail/order_detail.js
... ... @@ -70,6 +70,16 @@ Page({
70 70 success:async function (eb) {
71 71 r.order_goods=eb.data.data.pageData;
72 72  
  73 + var glist = r.order_goods;
  74 + for(var i in glist){
  75 + if(glist[i].is_gift){
  76 + r.is_prom=1;
  77 + }
  78 + }
  79 +
  80 +
  81 +
  82 +
73 83 //------------对比一下有没有退款记录------------
74 84 await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{
75 85 data: { order_id: r.order_id, store_id: os.stoid,
... ... @@ -225,15 +235,13 @@ Page({
225 235 if(!e.confirm) return false;
226 236 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
227 237 //if(is_skill==1 || is_zsorder>=2){
228   -
229   - getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+o,{
  238 + getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{
230 239 data:{},
231 240 success: function(t) {
232 241 if(t.data.code==0)
233 242 th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
234 243 },
235 244 })
236   -
237 245 /*----
238 246 }else{
239 247 getApp().request.put("/api/weshop/order/updatebyId", {
... ... @@ -249,24 +257,19 @@ Page({
249 257  
250 258 //--------确认收货---------
251 259 confirmOrder: function(e) {
  260 + var th=this;
252 261 var t = this, o = this.data.order.order_id,order=this.data.order;
253 262 var is_zsorder=order.is_zsorder;
254 263 wx.showModal({
255 264 title: "是否确认收货?",
256   - success: function(e) {
257   - e.confirm && r.put("/api/weshop/order/updatebyId", {
258   - data: {
259   - order_id: o, order_status: 2
260   - },
261   - success: function(e) {
262   - t.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
263   - //如果是会员团订单
264   - if(is_zsorder==3){
265   - getApp().request.post("/api/weshop/order/vipTuanTebate/"+os.stoid+"/"+o,{
266   - data:{}, success:function () { }})
267   - }
  265 + success: function(t) {
  266 + t.confirm && rq.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{
  267 + success:function (e) {
  268 + if(e.data.code==0){
  269 + th.requestOrderDetail(o)
  270 + }
268 271 }
269   - });
  272 + })
270 273 }
271 274 });
272 275 },
... ... @@ -284,7 +287,7 @@ Page({
284 287 for(var i in order_goods){
285 288 var good=order_goods[i];
286 289 //如果不是小程序有的功能,直接提示要去3.0处理
287   - if(good.prom_type==2 || good.prom_type==3 || good.prom_type==4 || good.prom_type==5){
  290 + if(good.prom_type==2 || good.prom_type==4){
288 291 wx.showModal({
289 292 title: '提示',
290 293 content: '小程序还未有该活动,请到3.0公众号支付'
... ... @@ -325,8 +328,8 @@ Page({
325 328 });
326 329 return false;
327 330 }
328   -
329   - if(good.prom_type==1 || good.prom_type==6){
  331 +
  332 + if((good.prom_type==1 || good.prom_type==6 || good.prom_type==5 ) && !good.is_gift && !good.is_collocation){
330 333 if(gg.prom_type!=good.prom_type) {
331 334 wx.showModal({
332 335 title: '提示',
... ... @@ -334,6 +337,32 @@ Page({
334 337 });
335 338 return false;
336 339 }
  340 + if(good.prom_type==3 || good.prom_type==5){
  341 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {
  342 + }).then(res=>{
  343 + if(res.data.code==0){
  344 + var r_data=res.data.data;
  345 + if(!r_data.collocationPromList && good.prom_type==5){
  346 + wx.showModal({
  347 + title: '提示',
  348 + content: good.goods_name+'未找到活动'
  349 + });
  350 + }
  351 + if(!r_data.promGoodsLists && good.prom_type==3){
  352 + wx.showModal({
  353 + title: '提示',
  354 + content: good.goods_name+'未找到活动'
  355 + });
  356 + }
  357 + }else{
  358 + wx.showModal({
  359 + title: '提示',
  360 + content: good.goods_name+'未找到活动'
  361 + });
  362 + return false;
  363 + }
  364 + })
  365 + }
337 366  
338 367 }else{
339 368  
... ... @@ -369,24 +398,25 @@ Page({
369 398 }
370 399 }
371 400 }
372   -
373   -
374   - var isok=1;
375   - var card_field=th.data.card_field;
376   - //如果会员是等级会员,商品有等级价,且不是活动商品
377   - if(card_field && gg[card_field]>0){
378   - if (good.goods_price != gg[card_field]) isok = 0;
379   - }else{
380   - if (good.goods_price != gg.shop_price) isok = 0;
381   -
382   - }
383   - if(!isok){
384   - wx.showModal({
385   - title: '提示',
386   - content: gg.goods_name+'商品的价格发生了变化'
387   - });
388   - return false;
389   - }
  401 +
  402 + if(!good.is_gift && !good.is_collocation) {
  403 + var isok = 1;
  404 + var card_field = th.data.card_field;
  405 + //如果会员是等级会员,商品有等级价,且不是活动商品
  406 + if (card_field && gg[card_field] > 0) {
  407 + if (good.goods_price != gg[card_field]) isok = 0;
  408 + } else {
  409 + if (good.goods_price != gg.shop_price) isok = 0;
  410 +
  411 + }
  412 + if (!isok) {
  413 + wx.showModal({
  414 + title: '提示',
  415 + content: gg.goods_name + '商品的价格发生了变化'
  416 + });
  417 + return false;
  418 + }
  419 + }
390 420  
391 421 //--如果是线下库存的时候--
392 422 if(th.data.conf.sales_rules==2){
... ...
pages/user/order_detail/order_detail.wxml
... ... @@ -35,7 +35,7 @@
35 35 <view class="goods-num">×{{item.goods_num}}</view>
36 36  
37 37 <!-- 不是整单退的时候 -->
38   - <block wx:if="{{order.is_all_return!=1}}">
  38 + <block wx:if="{{order.is_all_return!=1 && order.discount==0 && order.coupon_price<=0 && order.order_prom_amount<=0 && order.discount_amount<0 && item.prom_type!=5 && !order.is_prom}}">
39 39 <view bindtap="checkReturnGoodsStatus" class="goods-num" data-oid="{{item.order_id}}"
40 40 data-recid="{{item.goods_id}}" wx:if="{{item.return_btn==1 && !order.is_bedistri}}">申请退款</view>
41 41 <view bindtap="gotoreturn" class="return-btn" data-oid="{{item.order_id}}"
... ... @@ -110,6 +110,11 @@
110 110 <view> ¥ {{order.integral_money}}元</view>
111 111 </view>
112 112  
  113 + <view class="item pnew" wx:if="{{order.discount_amount>0}}">
  114 + <view>优惠活动</view>
  115 + <view>¥ {{order.discount_amount}}元</view>
  116 + </view>
  117 +
113 118 <view class="item pnew" wx:if="{{order.order_prom_amount>0}}">
114 119 <view>订单优惠</view>
115 120 <view>¥ {{order.order_prom_amount}}元</view>
... ... @@ -150,7 +155,7 @@
150 155 </block>
151 156 <block wx:else>
152 157 <view class="tips-btn" wx:if="{{order.is_all_return_status==2 && order.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view>
153   - <navigator class="tips-btn" wx:if="{{order.is_all_return_status==3}}" url="/pages/order/refund_order/refund_order?order_id={{order.order_id}}">重新退款</navigator>
  158 + <navigator class="tips-btn" wx:if="{{order.is_all_return_status==3 && order.order_status<2}}" url="/pages/order/refund_order/refund_order?order_id={{order.order_id}}">重新退款</navigator>
154 159 <navigator class="tips-btn" wx:if="{{order.is_all_return_status==0 || order.is_all_return_status==1}}"
155 160 url="/pages/user/return_goods_info/return_goods_info?order_id={{order.order_id}}">退款详情</navigator>
156 161 </block>
... ...
pages/user/order_list/order_list.js
... ... @@ -112,6 +112,14 @@ Page({
112 112 tt = res;
113 113 })
114 114  
  115 + var glist = tt.data.data.pageData;
  116 + for(var i in glist){
  117 + if(glist[i].is_gift){
  118 + data[ind].is_prom=1;
  119 + }
  120 + }
  121 +
  122 +
115 123 //------------对比一下有没有退款记录------------
116 124 await getApp().request.promiseGet("/api/weshop/order/returngoods/page", {
117 125 data: {
... ... @@ -253,7 +261,7 @@ Page({
253 261 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
254 262 if (t.confirm) {
255 263 //if(is_skill==1 || is_zsorder>=2){
256   - getApp().request.delete("/api/weshop/order/cancelTeamOrder/" + os.stoid + "/" + a, {
  264 + getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+a+"/"+getApp().globalData.user_id, {
257 265 data: {},
258 266 success: function(t) {
259 267 if (t.data.code == 0) {
... ... @@ -278,22 +286,14 @@ Page({
278 286 wx.showModal({
279 287 title: "是否确认收货?",
280 288 success: function(t) {
281   - t.confirm && rq.put("/api/weshop/order/updatebyId", {
282   - data: {
283   - order_id: a,
284   - order_status: 2
285   - },
286   - success: function(t) {
287   - e.deleteOrderData2(a);
288   - //如果是会员团订单
289   - if (is_zsorder == 3) {
290   - getApp().request.post("/api/weshop/order/vipTuanTebate/" + os.stoid + "/" + a, {
291   - data: {},
292   - success: function() {}
293   - })
  289 + t.confirm && rq.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+a+"/"+getApp().globalData.user_id,{
  290 + success:function (e) {
  291 + if(e.data.code==0){
  292 + th.deleteOrderData2(a);
  293 + getApp().confirmBox( "确认收货成功!");
  294 + }
294 295 }
295   - }
296   - });
  296 + })
297 297 }
298 298 });
299 299 },
... ... @@ -307,7 +307,7 @@ Page({
307 307 var order=th.data.orderList[index];
308 308 if(order.order_status!=6){
309 309 up_data.order_status=5;
310   - }
  310 + }
311 311 wx.showModal({
312 312 title: "是否删除订单?",
313 313 success: function(tt) {
... ... @@ -380,7 +380,7 @@ Page({
380 380 for(var i in order_goods){
381 381 var good=order_goods[i];
382 382 //如果不是小程序有的功能,直接提示要去3.0处理
383   - if(good.prom_type==2 || good.prom_type==3 || good.prom_type==4 || good.prom_type==5){
  383 + if(good.prom_type==2 || good.prom_type==4 ){
384 384 wx.showModal({
385 385 title: '提示',
386 386 content: '小程序还未有该活动,请到3.0公众号支付'
... ... @@ -422,10 +422,7 @@ Page({
422 422 return false;
423 423 }
424 424  
425   -
426   - console.log("-----------------111-------------------");
427   -
428   - if(good.prom_type==1 || good.prom_type==6){
  425 + if((good.prom_type==1 || good.prom_type==6 || good.prom_type==5 ) && !good.is_gift && !good.is_collocation){
429 426 if(gg.prom_type!=good.prom_type) {
430 427 wx.showModal({
431 428 title: '提示',
... ... @@ -433,9 +430,34 @@ Page({
433 430 });
434 431 return false;
435 432 }
436   -
  433 + if(good.prom_type==3 || good.prom_type==5){
  434 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {
  435 + }).then(res=>{
  436 + if(res.data.code==0){
  437 + var r_data=res.data.data;
  438 + if(!r_data.collocationPromList && good.prom_type==5){
  439 + wx.showModal({
  440 + title: '提示',
  441 + content: good.goods_name+'未找到活动'
  442 + });
  443 + }
  444 + if(!r_data.promGoodsLists && good.prom_type==3){
  445 + wx.showModal({
  446 + title: '提示',
  447 + content: good.goods_name+'未找到活动'
  448 + });
  449 + }
  450 + }else{
  451 + wx.showModal({
  452 + title: '提示',
  453 + content: good.goods_name+'未找到活动'
  454 + });
  455 + return false;
  456 + }
  457 + })
  458 + }
  459 +
437 460 }else{
438   -
439 461 if(gg.prom_type==1 || gg.prom_type==6){
440 462 var prom=null;
441 463 //---如果是活动的时候---
... ... @@ -468,24 +490,25 @@ Page({
468 490 }
469 491 }
470 492 }
471   -
472   -
  493 + //赠品和搭配购不判断商品金额
473 494 var isok=1;
474 495 var card_field=th.data.card_field;
475 496 //如果会员是等级会员,商品有等级价,且不是活动商品
476   - if(card_field && gg[card_field]>0){
477   - if (good.goods_price != gg[card_field]) isok = 0;
478   - }else{
479   - if (good.goods_price != gg.shop_price) isok = 0;
480   -
481   - }
482   - if(!isok){
483   - wx.showModal({
484   - title: '提示',
485   - content: gg.goods_name+'商品的价格发生了变化'
486   - });
487   - return false;
488   - }
  497 + if(!good.is_gift && !good.is_collocation) {
  498 + if (card_field && gg[card_field] > 0) {
  499 + if (good.goods_price != gg[card_field]) isok = 0;
  500 + } else {
  501 + if (good.goods_price != gg.shop_price) isok = 0;
  502 +
  503 + }
  504 + if (!isok) {
  505 + wx.showModal({
  506 + title: '提示',
  507 + content: gg.goods_name + '商品的价格发生了变化'
  508 + });
  509 + return false;
  510 + }
  511 + }
489 512  
490 513 //--如果是线下库存的时候--
491 514 if(th.data.conf.sales_rules==2){
... ... @@ -577,6 +600,7 @@ Page({
577 600  
578 601  
579 602 pay_next(e){
  603 + var th=this;
580 604 if (e.order_amount == 0) {
581 605 var dd = {
582 606 parent_sn: e.order_sn,
... ...
pages/user/order_list/order_list.wxml
... ... @@ -67,7 +67,7 @@
67 67 </view>
68 68 <view class="flex-level-right fs26 refund">
69 69 <!-- 不是整单退的时候 -->
70   - <block wx:if="{{item.is_all_return!=1}}">
  70 + <block wx:if="{{item.is_all_return!=1 && item.discount==0 && item.coupon_price<=0 && item.order_prom_amount<=0 && item.discount_amount<0 && goods.prom_type!=5 && !item.is_prom}}">
71 71 <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==1 && !item.is_bedistri }}">申请退款</view>
72 72 <view catchtap="gotoreturn" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==2}}">退款中</view>
73 73 <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==3}}">重新退款</view>
... ... @@ -115,7 +115,8 @@
115 115 <view class="commodity_money flex baseline" wx:else>
116 116 <view>合计:</view>
117 117 <view class="fs24 xc-wc">¥</view>
118   - <view class="xc-wc">{{filters.toFix(item.order_amount+item.user_money,2)}}
  118 + <view class="xc-wc">{{filters.toFix(item.order_amount+item.user_money,2)}}
  119 + <text wx:if="{{item.coupon_price}}">+{{item.coupon_price}}元优惠券</text>
119 120 </view>
120 121 </view>
121 122 <view wx:if="{{item.pt_tail_money>0}}" class="commodity_money flex baseline">
... ... @@ -124,6 +125,8 @@
124 125 <view class="xc-wc">{{filters.toFix(item.pt_tail_money-item.shipping_price,2)}}
125 126 </view>
126 127 </view>
  128 +
  129 +
127 130 </block>
128 131 </view>
129 132 </view>
... ... @@ -139,7 +142,7 @@
139 142 </block>
140 143 <block wx:else>
141 144 <view class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==2 && item.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{item.order_id}}" data-index="{{index}}">删除订单</view>
142   - <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==3}}" url="/pages/order/refund_order/refund_order?order_id={{item.order_id}}">重新退款</navigator>
  145 + <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==3 && item.order_status<2}}" url="/pages/order/refund_order/refund_order?order_id={{item.order_id}}">重新退款</navigator>
143 146 <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==0 || item.is_all_return_status==1}}" url="/pages/user/return_goods_info/return_goods_info?order_id={{item.order_id}}">退款详情</navigator>
144 147 </block>
145 148 <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator>
... ...
pages/user/plus/plus.js
... ... @@ -173,9 +173,12 @@ Page({
173 173 var new_arr = new Array();
174 174 for (var i = 0; i < plusCard.length; i++) {
175 175 //plusCard[i].free=arr[i];
176   - if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg"+(i + 1)+ ".jpg?v=1";
177   - var item = {"fee": plusCard[i].CardFee, 'index': i}
178   - new_arr.push(item);
  176 +
  177 +
  178 + if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg"+(i + 1)+ ".jpg?v=1";
  179 + var item = {"fee": plusCard[i].CardFee, 'index': i}
  180 + new_arr.push(item);
  181 +
179 182 }
180 183 //根據距離遠近排序,越近在前面,升序
181 184 new_arr.sort(function (a, b) {
... ... @@ -189,11 +192,15 @@ Page({
189 192 });
190 193 //---给数组添加立省多少钱---
191 194 for (i = 0; i < plusCard.length; i++) {
192   - for (var j = 0; j < new_arr.length; j++) {
193   - if (i == new_arr[j].index) {
194   - plusCard[i].free = arr[j];
195   - break;
196   - }
  195 + //判断是否停用
  196 +
  197 + for (var j = 0; j < new_arr.length; j++) {
  198 + if (i == new_arr[j].index) {
  199 + plusCard[i].free = arr[j];
  200 + break;
  201 + }
  202 +
  203 +
197 204 }
198 205 }
199 206 th.setData({
... ...
pages/user/plus/plus.wxml
... ... @@ -14,7 +14,8 @@
14 14 <!-- 未开通会员swiper-item -->
15 15 <swiper current="{{currentId}}" current-item-id="{{currentId}}" next-margin="60rpx" previous-margin="60rpx" bindchange="swiperChange">
16 16 <swiper-item class="flex" item-id="{{index}}" data-item-id="{{index}}" wx:for="{{is_plusCard}}">
17   - <view class="Membership {{currentId==index?'enlarge':''}}" style=" background-image: url({{item.CardImg}});color:{{item.CardColor}}">
  17 +
  18 + <view wx:if="{{item.IsStopBuy!=true}}" class="Membership {{currentId==index?'enlarge':''}}" style=" background-image: url({{item.CardImg}});color:{{item.CardColor}}">
18 19 <view class="flex-space-between Membership_go">
19 20 <view>
20 21 <view class="fs36">{{item.CardName}}</view>
... ... @@ -35,6 +36,8 @@
35 36 </view>
36 37 </view>
37 38 </view>
  39 +
  40 +
38 41 </swiper-item>
39 42 </swiper>
40 43 </view>
... ...
utils/filter.wxs
1 1 var filters = {
2 2 toFix:function(val,count){
  3 + val=parseFloat(val);
3 4 return val.toFixed(count)
4 5 },
5 6 replace_time:function(val){
... ...
utils/pay.js
... ... @@ -34,10 +34,12 @@ module.exports = {
34 34 if(t.data.code==0){
35 35 i.weixinPay(t.data.data, e, a);
36 36 }else{
37   - t.showSuccess(t.data.msg);
38   - wx.redirectTo({
39   - url: "/pages/user/order_list/order_list",
40   - });
  37 + getApp().showWarning(t.data.msg);
  38 + setTimeout(function(){
  39 + wx.redirectTo({
  40 + url: "/pages/user/order_list/order_list",
  41 + });
  42 + },1000)
41 43 }
42 44 return false;
43 45 },
... ...
utils/request.js
... ... @@ -206,6 +206,27 @@ module.exports = {
206 206 })
207 207 })
208 208 },
  209 +
  210 + //---promise的使用delete----
  211 + promiseDelete:function(url,data){
  212 + var th=this;
  213 + if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
  214 + return new Promise((resolve, reject) => {
  215 + data.isShowLoading && th.showLoading();
  216 + wx.request({
  217 + url,
  218 + method: 'DELETE',
  219 + header: {"content-type": "application/x-www-form-urlencoded" },
  220 + data:data.data,
  221 + success(res) {
  222 + data.isShowLoading && th.hideLoading();
  223 + resolve(res);
  224 + },
  225 + fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
  226 + })
  227 + })
  228 + },
  229 +
209 230 //--------具有时间限制的读取接口----------
210 231 time_limit_get(time,url,data){
211 232 var req=this.get(url,data);
... ...