Commit 52dd45bc84e60dee276fca0399718f9430a3a319
1 parent
7e08339a
卡项商品信息
Showing
5 changed files
with
1373 additions
and
646 deletions
packageA/pages/cart2_ser/cart2_ser.js
| 1 | -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), | |
| 2 | - s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); | |
| 3 | -var oo=t.globalData.setting,os=oo; | |
| 1 | +var t = getApp(), | |
| 2 | + app = t, | |
| 3 | + a = t.request, | |
| 4 | + e = require("../../../utils/common.js"), | |
| 5 | + s = require("../../../utils/util.js"), | |
| 6 | + o = require("../../../utils/md5.js"), | |
| 7 | + to = getApp(); | |
| 8 | +var oo = t.globalData.setting, | |
| 9 | + os = oo; | |
| 4 | 10 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
| 5 | 11 | var util_pay = require("../../../utils/pay.js"); |
| 6 | 12 | |
| 7 | 13 | Page({ |
| 8 | - data: { | |
| 9 | - url: t.globalData.setting.url, | |
| 10 | - resourceUrl: t.globalData.setting.resourceUrl, | |
| 11 | - imgUrl: t.globalData.setting.imghost, | |
| 12 | - | |
| 13 | - invoiceToggle: !0, | |
| 14 | - payWithUserMoney: !0, | |
| 15 | - payWithPoints: !0, | |
| 16 | - maxWord: 0, | |
| 17 | - enterAddressPage: !1, | |
| 18 | - | |
| 19 | - //页面获取的参数 | |
| 20 | - param:null, | |
| 21 | - postdata:null, | |
| 22 | - //提交订单的格式 | |
| 23 | - formData: { | |
| 24 | - order_amount:0,//支付金额 | |
| 25 | - total_amount:0,//总价 | |
| 26 | - all_price:0,//商品卖的总价 | |
| 27 | - pay_points: 0,//使用积分 | |
| 28 | - user_money: 0,//使用余额 | |
| 29 | - couponCode: "",//使用优惠券(多单就用逗号隔开) | |
| 30 | - shipping_price:0,//物流费用 | |
| 31 | - }, | |
| 32 | - | |
| 33 | - /*----------------立即购买---------------------*/ | |
| 34 | - is_b_now:0, //0是购物车结算 1立即购买 | |
| 35 | - bn_goods:null, //立即购买时候的调用商品 | |
| 36 | - bn_use_money:0,//是否使用余额 | |
| 37 | - bn_pick:0, //选择的门店 | |
| 38 | - bn_pickname: "", //选择的门店名称 | |
| 39 | - | |
| 40 | - /*------------------------*/ | |
| 41 | - yuer:0, | |
| 42 | - is_cart:0, //是不是购物车进来的购买 | |
| 43 | - }, | |
| 44 | - onLoad: function(t) { | |
| 14 | + data: { | |
| 15 | + url: t.globalData.setting.url, | |
| 16 | + resourceUrl: t.globalData.setting.resourceUrl, | |
| 17 | + imgUrl: t.globalData.setting.imghost, | |
| 18 | + | |
| 19 | + invoiceToggle: !0, | |
| 20 | + payWithUserMoney: !0, | |
| 21 | + payWithPoints: !0, | |
| 22 | + maxWord: 0, | |
| 23 | + enterAddressPage: !1, | |
| 24 | + | |
| 25 | + //页面获取的参数 | |
| 26 | + param: null, | |
| 27 | + postdata: null, | |
| 28 | + //提交订单的格式 | |
| 29 | + formData: { | |
| 30 | + order_amount: 0, //支付金额 | |
| 31 | + total_amount: 0, //总价 | |
| 32 | + all_price: 0, //商品卖的总价 | |
| 33 | + pay_points: 0, //使用积分 | |
| 34 | + user_money: 0, //使用余额 | |
| 35 | + couponCode: "", //使用优惠券(多单就用逗号隔开) | |
| 36 | + shipping_price: 0, //物流费用 | |
| 37 | + }, | |
| 38 | + | |
| 39 | + /*----------------立即购买---------------------*/ | |
| 40 | + is_b_now: 0, //0是购物车结算 1立即购买 | |
| 41 | + bn_goods: null, //立即购买时候的调用商品 | |
| 42 | + bn_use_money: 0, //是否使用余额 | |
| 43 | + bn_pick: 0, //选择的门店 | |
| 44 | + bn_pickname: "", //选择的门店名称 | |
| 45 | + | |
| 46 | + /*------------------------*/ | |
| 47 | + yuer: 0, | |
| 48 | + is_cart: 0, //是不是购物车进来的购买 | |
| 49 | + }, | |
| 50 | + onLoad: function(t) { | |
| 45 | 51 | wx.setNavigationBarTitle({ |
| 46 | - title: "填写订单", | |
| 52 | + title: "填写订单", | |
| 47 | 53 | }); |
| 48 | - | |
| 49 | - var appD=getApp().globalData.service_now; | |
| 50 | - this.data.postdata=appD; | |
| 51 | - this.data.param=t; | |
| 52 | - if(t.is_cart){ | |
| 53 | - this.setData({is_cart:1}); | |
| 54 | - } | |
| 55 | - | |
| 56 | - var th=this; | |
| 57 | - | |
| 54 | + | |
| 55 | + var appD = getApp().globalData.service_now; | |
| 56 | + this.data.postdata = appD; | |
| 57 | + this.data.param = t; | |
| 58 | + if (t.is_cart) { | |
| 59 | + this.setData({ | |
| 60 | + is_cart: 1 | |
| 61 | + }); | |
| 62 | + } | |
| 63 | + | |
| 64 | + var th = this; | |
| 65 | + | |
| 58 | 66 | getApp().promiseGet("/api/wx/weappSendlist/page", { |
| 59 | - data: { | |
| 60 | - store_id: os.stoid, | |
| 61 | - typeid: "1001" | |
| 62 | - }}).then(res=>{ | |
| 63 | - if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 64 | - var template_id = res.data.data.pageData[0].template_id; | |
| 65 | - th.setData({template_id:template_id}); | |
| 66 | - } | |
| 67 | - }) | |
| 68 | - | |
| 69 | - }, | |
| 70 | - onUnload: function () { this.setData({ isclose: 1 })}, | |
| 71 | - | |
| 72 | - //------获取会员信息-----先获取用户信息,在进行下一步--- | |
| 73 | - get_info:function(func){ | |
| 74 | - var user_id = t.globalData.user_id; | |
| 75 | - to.auth.get_u(func); | |
| 76 | - }, | |
| 77 | - | |
| 78 | - //----------------展示页面,是再获取用户信息之后-------------- | |
| 79 | - show_page:function(){ | |
| 80 | - var th=this; | |
| 81 | - //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取 | |
| 82 | - var user=getApp().globalData.userInfo; | |
| 83 | - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
| 84 | - data:{r:Math.random()}, | |
| 85 | - success: function (e) { | |
| 86 | - | |
| 87 | - getApp().globalData.userInfo = e.data.data; | |
| 88 | - th.setData({userinfo:e.data.data}); | |
| 89 | - //获取立即购买的商品信息 | |
| 90 | - if(th.data.is_cart){ | |
| 91 | - //读取门店 | |
| 92 | - to.get_allsto(function (e) { | |
| 93 | - th.setData({ allsto: e }); | |
| 94 | - th.get_cart(); | |
| 95 | - }) | |
| 96 | - }else{ | |
| 97 | - th.get_buy_goods(); | |
| 98 | - } | |
| 99 | - | |
| 100 | - //获取提现金额 | |
| 101 | - getApp().request.get("/api/weshop/withdrawals/summoney", { | |
| 102 | - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, | |
| 103 | - success: function (su) { | |
| 104 | - if (su.data.code == 0) { | |
| 105 | - var yuer = parseFloat(th.data.userinfo.user_money - | |
| 106 | - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); | |
| 107 | - th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
| 67 | + data: { | |
| 68 | + store_id: os.stoid, | |
| 69 | + typeid: "1001" | |
| 70 | + } | |
| 71 | + }).then(res => { | |
| 72 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 73 | + var template_id = res.data.data.pageData[0].template_id; | |
| 74 | + th.setData({ | |
| 75 | + template_id: template_id | |
| 76 | + }); | |
| 77 | + } | |
| 78 | + }) | |
| 79 | + | |
| 80 | + }, | |
| 81 | + onUnload: function() { | |
| 82 | + this.setData({ | |
| 83 | + isclose: 1 | |
| 84 | + }) | |
| 85 | + }, | |
| 86 | + | |
| 87 | + //------获取会员信息-----先获取用户信息,在进行下一步--- | |
| 88 | + get_info: function(func) { | |
| 89 | + var user_id = t.globalData.user_id; | |
| 90 | + to.auth.get_u(func); | |
| 91 | + }, | |
| 92 | + | |
| 93 | + //----------------展示页面,是再获取用户信息之后-------------- | |
| 94 | + show_page: function() { | |
| 95 | + var th = this; | |
| 96 | + //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取 | |
| 97 | + var user = getApp().globalData.userInfo; | |
| 98 | + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
| 99 | + data: { | |
| 100 | + r: Math.random() | |
| 101 | + }, | |
| 102 | + success: function(e) { | |
| 103 | + | |
| 104 | + getApp().globalData.userInfo = e.data.data; | |
| 105 | + th.setData({ | |
| 106 | + userinfo: e.data.data | |
| 107 | + }); | |
| 108 | + //获取立即购买的商品信息 | |
| 109 | + if (th.data.is_cart) { | |
| 110 | + //读取门店 | |
| 111 | + to.get_allsto(function(e) { | |
| 112 | + th.setData({ | |
| 113 | + allsto: e | |
| 114 | + }); | |
| 115 | + th.get_cart(); | |
| 116 | + }) | |
| 117 | + } else { | |
| 118 | + th.get_buy_goods(); | |
| 119 | + } | |
| 120 | + | |
| 121 | + //获取提现金额 | |
| 122 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
| 123 | + data: { | |
| 124 | + user_id: to.globalData.user_id, | |
| 125 | + store_id: oo.stoid, | |
| 126 | + status: 0 | |
| 127 | + }, | |
| 128 | + success: function(su) { | |
| 129 | + if (su.data.code == 0) { | |
| 130 | + var yuer = parseFloat(th.data.userinfo.user_money - | |
| 131 | + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed( | |
| 132 | + 2); | |
| 133 | + th.setData({ | |
| 134 | + txmon: su.data.data.summoney, | |
| 135 | + yuer: yuer | |
| 136 | + }); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + }); | |
| 140 | + } | |
| 141 | + }); | |
| 142 | + }, | |
| 143 | + | |
| 144 | + //-----获取购物车,入口-------- | |
| 145 | + get_cart: function() { | |
| 146 | + var th = this, | |
| 147 | + app = getApp(); | |
| 148 | + a.get("/api/weshop/cartService/page", { | |
| 149 | + data: { | |
| 150 | + user_id: to.globalData.user_id, | |
| 151 | + selected: 1, | |
| 152 | + store_id: oo.stoid, | |
| 153 | + pageSize: 600 | |
| 154 | + }, | |
| 155 | + success: async function(su) { | |
| 156 | + //按门店分类的数组 | |
| 157 | + var arr = new Array(); | |
| 158 | + var carr = su.data.data.pageData; | |
| 159 | + th.data.cartlist_y = carr; //存储原始购物车列表 | |
| 160 | + | |
| 161 | + //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
| 162 | + var is_card_back = getApp().globalData.is_card_back; | |
| 163 | + | |
| 164 | + | |
| 165 | + //在分组的时候,就不要再调用接口,await | |
| 166 | + for (var i = 0; i < carr.length; i++) { | |
| 167 | + var good = null; | |
| 168 | + var item = carr[i]; | |
| 169 | + await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then( | |
| 170 | + res => { | |
| 171 | + good = res.data.data; | |
| 172 | + }) | |
| 173 | + | |
| 174 | + item.img_url = oo.imghost + good.imgUrl; | |
| 175 | + item.erpItemID = good.erpItemID; | |
| 176 | + | |
| 177 | + /*----接口要弄出来的,先顶着-----*/ | |
| 178 | + var pcid = item.pick_id; | |
| 179 | + var find = 0; | |
| 180 | + //----如果有就加进去,没有就新增一个---- | |
| 181 | + //-----------循环查找门店------------- | |
| 182 | + if (arr.length > 0) { | |
| 183 | + for (var j = 0; j < arr.length; j++) { | |
| 184 | + if (arr[j].pickup_id == pcid) { | |
| 185 | + arr[j].goods.push(item); | |
| 186 | + find = 1; | |
| 187 | + break; | |
| 188 | + } | |
| 189 | + } | |
| 190 | + } | |
| 191 | + //------如果没有找到----- | |
| 192 | + if (find == 0) { | |
| 193 | + var pikname = '', | |
| 194 | + sto = null; | |
| 195 | + //----找到门店名称----- | |
| 196 | + for (var k = 0; k < th.data.allsto.length; k++) { | |
| 197 | + if (pcid == th.data.allsto[k].pickup_id) { | |
| 198 | + pikname = th.data.allsto[k].pickup_name; | |
| 199 | + sto = th.data.allsto[k]; | |
| 200 | + break; | |
| 108 | 201 | } |
| 109 | 202 | } |
| 110 | - }); | |
| 203 | + var narr = new Array(); | |
| 204 | + narr.push(item); | |
| 205 | + var ie = { | |
| 206 | + pickup_id: pcid, | |
| 207 | + pname: pikname, | |
| 208 | + goods: narr, | |
| 209 | + keyid: sto.keyid, | |
| 210 | + goods_price: 0, | |
| 211 | + shipping_price: 0, | |
| 212 | + user_money: 0, | |
| 213 | + total_amount: 0, | |
| 214 | + order_amount: 0 | |
| 215 | + }; | |
| 216 | + arr.push(ie); | |
| 217 | + | |
| 218 | + } | |
| 219 | + } | |
| 220 | + | |
| 221 | + //深拷贝 | |
| 222 | + th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); | |
| 223 | + th.setData({ | |
| 224 | + cartlist: arr, | |
| 225 | + }); | |
| 226 | + th.calculatePrice(); | |
| 227 | + } | |
| 228 | + }); | |
| 229 | + }, | |
| 230 | + | |
| 231 | + //-----获取立即购买的商品信息---- | |
| 232 | + get_buy_goods: function() { | |
| 233 | + var th = this, | |
| 234 | + a = getApp().request; | |
| 235 | + var gg = th.data.postdata; | |
| 236 | + var url = "/api/weshop/serviceCard/get/" + oo.stoid + "/" + gg.id | |
| 237 | + //调用商品 | |
| 238 | + a.get(url, { | |
| 239 | + success: function(t) { | |
| 240 | + var gd = t.data.data; | |
| 241 | + t.data.data.original_img = oo.imghost + t.data.data.imgUrl; | |
| 242 | + t.data.data['buynum'] = gg.goods_num; | |
| 243 | + t.data.data.shop_price = gd.money; | |
| 244 | + | |
| 245 | + th.setData({ | |
| 246 | + bn_goods: t.data.data, | |
| 247 | + bn_pickname: gg.pick_name, | |
| 248 | + bn_pick: gg.pick_id | |
| 249 | + }); | |
| 250 | + th.calculatePrice2(); | |
| 251 | + | |
| 252 | + } | |
| 253 | + }); | |
| 254 | + }, | |
| 255 | + | |
| 256 | + //----------子页返回父页触发---------- | |
| 257 | + onShow: function() { | |
| 258 | + var th = this; | |
| 259 | + if (th.data.isclose == 0) { | |
| 260 | + wx.navigateTo({ | |
| 261 | + url: "/pages/index/index/index" | |
| 262 | + }) | |
| 263 | + } | |
| 264 | + //先获取是否有关闭使用优惠券 | |
| 265 | + getApp().getConfig2(function(ee) { | |
| 266 | + //var json_d = JSON.parse(ee.switch_list); | |
| 267 | + //th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | |
| 268 | + //th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); | |
| 269 | + th.show_page(); | |
| 270 | + }) | |
| 271 | + }, | |
| 272 | + | |
| 273 | + | |
| 274 | + showInvoice: function() { | |
| 275 | + this.setData({ | |
| 276 | + invoiceToggle: !this.data.invoiceToggle | |
| 277 | + }); | |
| 278 | + }, | |
| 279 | + | |
| 280 | + | |
| 281 | + //-------------------计算购物车订单价格------------------- | |
| 282 | + calculatePrice: function() { | |
| 283 | + var th = this; | |
| 284 | + to.getConfig2(async function(ee) { | |
| 285 | + wx.showLoading({ | |
| 286 | + title: "处理中." | |
| 287 | + }) | |
| 288 | + var all_price = 0; //所有的商品总价 | |
| 289 | + var all_shipping_m = 0; //所有的物流总价 | |
| 290 | + var all_total_m = 0; //所有的订单应付总价 | |
| 291 | + var all_order_m = 0; //所有的订单应付总价 | |
| 292 | + var all_user_m = 0; //所有的订单用户使用金额 | |
| 293 | + var all_coupon_price_m = 0; //所有的订单用户使用优惠券价格 | |
| 294 | + var all_cutprice = 0; //所有的优惠减件 | |
| 295 | + var all_order_prom = 0; //所有的订单优惠 | |
| 296 | + | |
| 297 | + var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : | |
| 298 | + 0); | |
| 299 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 300 | + var no_ex_id = ee.no_ex_id; | |
| 301 | + var no_ex_good = null; | |
| 302 | + var by_qc = {}; | |
| 303 | + var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); | |
| 304 | + | |
| 305 | + //---循环购物车--- | |
| 306 | + for (var i in c_arr) { | |
| 307 | + | |
| 308 | + var cart_item = c_arr[i]; //就是每一单的意思 | |
| 309 | + var pickid = cart_item.pickup_id; | |
| 310 | + var o_price = 0; | |
| 311 | + var o_shipping_price = 0, | |
| 312 | + goods_weight = -1, | |
| 313 | + goods_piece = -1; | |
| 314 | + var item = c_arr[i].goods; //就是每一单的从表的意思 | |
| 315 | + | |
| 316 | + //---如果有选择优惠券的情况下--- | |
| 317 | + var quan_price = 0; | |
| 318 | + var coupon_price = 0; | |
| 319 | + var quan_no = null; | |
| 320 | + | |
| 321 | + //--------循环计算总价----------- | |
| 322 | + for (var j = 0; j < item.length; j++) { | |
| 323 | + o_price += item[j].money * item[j].goods_num; | |
| 324 | + } | |
| 325 | + var f_o_price = o_price; | |
| 326 | + cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 | |
| 327 | + //计算物流费用 | |
| 328 | + cart_item.shipping_price = 0; | |
| 329 | + | |
| 330 | + //总价计算,总价不包含运费 | |
| 331 | + cart_item.order_amount = (o_price - quan_price).toFixed(2); | |
| 332 | + cart_item.total_amount = f_o_price.toFixed(2); | |
| 333 | + | |
| 334 | + var order_prom_amount = 0; | |
| 335 | + var order_prom_id = 0; | |
| 336 | + var o_condition = cart_item.order_amount; | |
| 337 | + var order_m = 0; | |
| 338 | + cart_item.order_prom_amount = 0; | |
| 339 | + coupon_price = quan_price; | |
| 340 | + | |
| 341 | + | |
| 342 | + cart_item.total_amount = parseFloat(cart_item.total_amount) + parseFloat(cart_item.shipping_price); //总金额 | |
| 343 | + cart_item.order_amount = parseFloat(cart_item.order_amount) + parseFloat(cart_item.shipping_price); //总金额 | |
| 344 | + cart_item.total_amount = cart_item.total_amount.toFixed(2); | |
| 345 | + cart_item.order_amount = cart_item.order_amount.toFixed(2); | |
| 346 | + | |
| 347 | + //搭配购在使用余额 | |
| 348 | + if (th.data.bn_use_money == 1 && th.data.is_b_now == 1) { | |
| 349 | + | |
| 350 | + if (umoney > cart_item.order_amount) { | |
| 351 | + cart_item.user_money = cart_item.order_amount; | |
| 352 | + umoney = umoney - cart_item.order_amount; | |
| 353 | + } else { | |
| 354 | + cart_item.user_money = umoney; | |
| 355 | + umoney = 0; | |
| 356 | + } | |
| 357 | + | |
| 358 | + } else { | |
| 359 | + //--------------如果使用余额,购物车购买--------------------- | |
| 360 | + if (th.data.js_use_money == 1) { | |
| 361 | + if (umoney > cart_item.order_amount) { | |
| 362 | + cart_item.user_money = cart_item.order_amount; | |
| 363 | + umoney = umoney - cart_item.order_amount; | |
| 364 | + } else { | |
| 365 | + cart_item.user_money = umoney; | |
| 366 | + umoney = 0; | |
| 367 | + } | |
| 368 | + } else { | |
| 369 | + cart_item.user_money = 0; | |
| 370 | + } | |
| 371 | + } | |
| 372 | + all_price += parseFloat(f_o_price); | |
| 373 | + all_total_m += parseFloat(cart_item.total_amount); | |
| 374 | + all_shipping_m += parseFloat(cart_item.shipping_price); | |
| 375 | + all_order_m += parseFloat(cart_item.order_amount); | |
| 111 | 376 | } |
| 112 | - }); | |
| 113 | - }, | |
| 114 | - | |
| 115 | - //-----获取购物车,入口-------- | |
| 116 | - get_cart: function () { | |
| 117 | - var th = this,app=getApp(); | |
| 118 | - a.get("/api/weshop/cartService/page", { | |
| 119 | - data: { | |
| 120 | - user_id: to.globalData.user_id, selected:1, | |
| 121 | - store_id: oo.stoid, pageSize: 600 }, | |
| 122 | - success:async function (su) { | |
| 123 | - //按门店分类的数组 | |
| 124 | - var arr = new Array(); | |
| 125 | - var carr = su.data.data.pageData; | |
| 126 | - th.data.cartlist_y = carr; //存储原始购物车列表 | |
| 127 | - | |
| 128 | - //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
| 129 | - var is_card_back=getApp().globalData.is_card_back; | |
| 130 | - | |
| 131 | - | |
| 132 | - //在分组的时候,就不要再调用接口,await | |
| 133 | - for (var i = 0; i < carr.length; i++) { | |
| 134 | - var good=null; | |
| 135 | - var item = carr[i]; | |
| 136 | - await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then(res => { | |
| 137 | - good = res.data.data; | |
| 138 | - }) | |
| 139 | - | |
| 140 | - item.img_url = oo.imghost + good.imgUrl; | |
| 141 | - item.erpItemID=good.erpItemID; | |
| 142 | - | |
| 143 | - /*----接口要弄出来的,先顶着-----*/ | |
| 144 | - var pcid = item.pick_id; | |
| 145 | - var find = 0; | |
| 146 | - //----如果有就加进去,没有就新增一个---- | |
| 147 | - //-----------循环查找门店------------- | |
| 148 | - if (arr.length > 0) { | |
| 149 | - for (var j = 0; j < arr.length; j++) { | |
| 150 | - if (arr[j].pickup_id == pcid) { | |
| 151 | - arr[j].goods.push(item); | |
| 152 | - find = 1;break; | |
| 153 | - } | |
| 154 | - } | |
| 155 | - } | |
| 156 | - //------如果没有找到----- | |
| 157 | - if (find == 0) { | |
| 158 | - var pikname = '',sto=null; | |
| 159 | - //----找到门店名称----- | |
| 160 | - for (var k = 0; k < th.data.allsto.length; k++) { | |
| 161 | - if (pcid == th.data.allsto[k].pickup_id) { | |
| 162 | - pikname = th.data.allsto[k].pickup_name; sto = th.data.allsto[k]; break; | |
| 163 | - } | |
| 164 | - } | |
| 165 | - var narr = new Array(); narr.push(item); | |
| 166 | - var ie = { | |
| 167 | - pickup_id: pcid, pname: pikname, goods: narr,keyid:sto.keyid, | |
| 168 | - goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0}; | |
| 169 | - arr.push(ie); | |
| 170 | - | |
| 171 | - } | |
| 172 | - } | |
| 173 | - | |
| 174 | - //深拷贝 | |
| 175 | - th.data.old_cartlist= JSON.parse(JSON.stringify(arr)); | |
| 176 | - th.setData({ | |
| 177 | - cartlist: arr, | |
| 178 | - }); | |
| 179 | - th.calculatePrice(); | |
| 180 | - } | |
| 181 | - }); | |
| 182 | - }, | |
| 183 | - | |
| 184 | - //-----获取立即购买的商品信息---- | |
| 185 | - get_buy_goods: function (){ | |
| 186 | - var th=this,a=getApp().request; | |
| 187 | - var gg = th.data.postdata; | |
| 188 | - var url="/api/weshop/serviceCard/get/" + oo.stoid + "/" + gg.id | |
| 189 | - //调用商品 | |
| 190 | - a.get(url, { | |
| 191 | - success: function (t) { | |
| 192 | - var gd = t.data.data; | |
| 193 | - t.data.data.original_img = oo.imghost + t.data.data.imgUrl; | |
| 194 | - t.data.data['buynum'] = gg.goods_num; | |
| 195 | - t.data.data.shop_price=gd.money; | |
| 196 | - | |
| 197 | - th.setData({ | |
| 198 | - bn_goods: t.data.data, bn_pickname: gg.pick_name, | |
| 199 | - bn_pick: gg.pick_id | |
| 200 | - }); | |
| 201 | - th.calculatePrice2(); | |
| 202 | - | |
| 203 | - } | |
| 204 | - }); | |
| 205 | - }, | |
| 206 | - | |
| 207 | - //----------子页返回父页触发---------- | |
| 208 | - onShow: function() { | |
| 209 | - var th=this; | |
| 210 | - if (th.data.isclose==0){ | |
| 211 | - wx.navigateTo({ | |
| 212 | - url: "/pages/index/index/index" | |
| 213 | - }) | |
| 214 | - } | |
| 215 | - //先获取是否有关闭使用优惠券 | |
| 216 | - getApp().getConfig2(function (ee) { | |
| 217 | - //var json_d = JSON.parse(ee.switch_list); | |
| 218 | - //th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | |
| 219 | - //th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); | |
| 220 | - th.show_page(); | |
| 221 | - }) | |
| 222 | - }, | |
| 223 | - | |
| 224 | - | |
| 225 | - showInvoice: function() { | |
| 226 | - this.setData({ | |
| 227 | - invoiceToggle: !this.data.invoiceToggle | |
| 228 | - }); | |
| 229 | - }, | |
| 230 | - | |
| 231 | - | |
| 232 | - //-------------------计算购物车订单价格------------------- | |
| 233 | - calculatePrice: function() { | |
| 234 | - var th = this; | |
| 235 | - to.getConfig2(async function(ee){ | |
| 236 | - wx.showLoading({ | |
| 237 | - title:"处理中." | |
| 238 | - }) | |
| 239 | - var all_price=0; //所有的商品总价 | |
| 240 | - var all_shipping_m= 0; //所有的物流总价 | |
| 241 | - var all_total_m = 0; //所有的订单应付总价 | |
| 242 | - var all_order_m = 0; //所有的订单应付总价 | |
| 243 | - var all_user_m=0; //所有的订单用户使用金额 | |
| 244 | - var all_coupon_price_m=0; //所有的订单用户使用优惠券价格 | |
| 245 | - var all_cutprice=0; //所有的优惠减件 | |
| 246 | - var all_order_prom=0; //所有的订单优惠 | |
| 247 | - | |
| 248 | - var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money?th.data.userinfo.frozen_money:0); | |
| 249 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
| 250 | - var no_ex_id=ee.no_ex_id; | |
| 251 | - var no_ex_good=null; | |
| 252 | - var by_qc={}; | |
| 253 | - var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist)); | |
| 254 | - | |
| 255 | - //---循环购物车--- | |
| 256 | - for(var i in c_arr){ | |
| 257 | - | |
| 258 | - var cart_item=c_arr[i]; //就是每一单的意思 | |
| 259 | - var pickid=cart_item.pickup_id; | |
| 260 | - var o_price=0; | |
| 261 | - var o_shipping_price=0,goods_weight=-1, goods_piece=-1; | |
| 262 | - var item=c_arr[i].goods; //就是每一单的从表的意思 | |
| 263 | - | |
| 264 | - //---如果有选择优惠券的情况下--- | |
| 265 | - var quan_price=0; | |
| 266 | - var coupon_price=0; | |
| 267 | - var quan_no= null; | |
| 268 | - | |
| 269 | - //--------循环计算总价----------- | |
| 270 | - for(var j=0;j<item.length;j++){ | |
| 271 | - o_price += item[j].money * item[j].goods_num; | |
| 272 | - } | |
| 273 | - var f_o_price=o_price; | |
| 274 | - cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 | |
| 275 | - //计算物流费用 | |
| 276 | - cart_item.shipping_price = 0; | |
| 277 | - | |
| 278 | - //总价计算,总价不包含运费 | |
| 279 | - cart_item.order_amount= (o_price -quan_price).toFixed(2); | |
| 280 | - cart_item.total_amount= f_o_price.toFixed(2); | |
| 281 | - | |
| 282 | - var order_prom_amount=0; var order_prom_id=0; var o_condition=cart_item.order_amount; | |
| 283 | - var order_m=0; | |
| 284 | - cart_item.order_prom_amount=0; | |
| 285 | - coupon_price=quan_price; | |
| 286 | - | |
| 287 | - | |
| 288 | - cart_item.total_amount= parseFloat(cart_item.total_amount)+parseFloat(cart_item.shipping_price); //总金额 | |
| 289 | - cart_item.order_amount=parseFloat(cart_item.order_amount)+parseFloat(cart_item.shipping_price); //总金额 | |
| 290 | - cart_item.total_amount= cart_item.total_amount.toFixed(2); | |
| 291 | - cart_item.order_amount=cart_item.order_amount.toFixed(2); | |
| 292 | - | |
| 293 | - //搭配购在使用余额 | |
| 294 | - if(th.data.bn_use_money==1 && th.data.is_b_now==1){ | |
| 295 | - | |
| 296 | - if (umoney > cart_item.order_amount) { | |
| 297 | - cart_item.user_money = cart_item.order_amount; | |
| 298 | - umoney = umoney - cart_item.order_amount; | |
| 299 | - }else { | |
| 300 | - cart_item.user_money = umoney; | |
| 301 | - umoney=0; | |
| 302 | - } | |
| 303 | - | |
| 304 | - }else{ | |
| 305 | - //--------------如果使用余额,购物车购买--------------------- | |
| 306 | - if (th.data.js_use_money == 1) { | |
| 307 | - if (umoney > cart_item.order_amount) { | |
| 308 | - cart_item.user_money = cart_item.order_amount; | |
| 309 | - umoney = umoney - cart_item.order_amount; | |
| 310 | - }else { | |
| 311 | - cart_item.user_money = umoney; | |
| 312 | - umoney=0; | |
| 313 | - } | |
| 314 | - }else{ | |
| 315 | - cart_item.user_money=0; | |
| 316 | - } | |
| 317 | - } | |
| 318 | - all_price += parseFloat(f_o_price); | |
| 319 | - all_total_m += parseFloat(cart_item.total_amount); | |
| 320 | - all_shipping_m += parseFloat(cart_item.shipping_price); | |
| 321 | - all_order_m += parseFloat(cart_item.order_amount); | |
| 322 | - } | |
| 323 | - | |
| 324 | - | |
| 325 | - all_total_m = parseFloat(all_total_m).toFixed(2); | |
| 326 | - all_order_m = parseFloat(all_order_m).toFixed(2); | |
| 327 | - all_price = parseFloat(all_price).toFixed(2); | |
| 328 | - all_total_m = parseFloat(all_total_m).toFixed(2); | |
| 329 | - | |
| 330 | - var atxt = "formData.total_amount"; | |
| 331 | - var atxt1 = "formData.order_amount"; | |
| 332 | - var atxt2 = "formData.all_price"; | |
| 333 | - | |
| 334 | - th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, | |
| 335 | - [atxt2]: all_price,show_submit:1 | |
| 336 | - }) | |
| 337 | - th.data.order_prom_list_cart=c_arr; | |
| 338 | - wx.hideLoading(); | |
| 339 | - }); | |
| 340 | - }, | |
| 341 | - | |
| 342 | - //---------计算立即购买---------- | |
| 343 | - calculatePrice2: function () { | |
| 344 | - console.log('calculatePrice2'); | |
| 345 | - var th = this, good = this.data.bn_goods; | |
| 346 | - //-----------计算商品总价-------------- | |
| 347 | - var allpice = good.shop_price * good.buynum; | |
| 348 | - allpice=parseFloat(allpice).toFixed(2); | |
| 349 | - var txt = "formData.all_price"; | |
| 350 | - th.setData({ [txt]: allpice, }); | |
| 351 | - | |
| 352 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
| 353 | - //-----------------总价----------------- | |
| 354 | - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price); | |
| 355 | - total_m = parseFloat(total_m).toFixed(2); | |
| 356 | - | |
| 357 | - var atxt= "formData.total_amount"; | |
| 358 | - th.setData({ [atxt]: total_m, }) | |
| 359 | - var order_m = total_m; | |
| 360 | - var txt = "formData.user_money"; | |
| 361 | - var txt2 = "formData.order_amount"; | |
| 362 | - | |
| 363 | - th.setData({ [txt]: 0, [txt2]: order_m }) | |
| 364 | - | |
| 365 | - }, | |
| 366 | - | |
| 367 | - submitForm:function(){ | |
| 368 | - var th=this; | |
| 369 | - this.sendsm(function(){ | |
| 377 | + | |
| 378 | + | |
| 379 | + all_total_m = parseFloat(all_total_m).toFixed(2); | |
| 380 | + all_order_m = parseFloat(all_order_m).toFixed(2); | |
| 381 | + all_price = parseFloat(all_price).toFixed(2); | |
| 382 | + all_total_m = parseFloat(all_total_m).toFixed(2); | |
| 383 | + | |
| 384 | + var atxt = "formData.total_amount"; | |
| 385 | + var atxt1 = "formData.order_amount"; | |
| 386 | + var atxt2 = "formData.all_price"; | |
| 387 | + | |
| 388 | + th.setData({ | |
| 389 | + [atxt]: all_total_m, | |
| 390 | + [atxt1]: all_order_m, | |
| 391 | + [atxt2]: all_price, | |
| 392 | + show_submit: 1 | |
| 393 | + }) | |
| 394 | + th.data.order_prom_list_cart = c_arr; | |
| 395 | + wx.hideLoading(); | |
| 396 | + }); | |
| 397 | + }, | |
| 398 | + | |
| 399 | + //---------计算立即购买---------- | |
| 400 | + calculatePrice2: function() { | |
| 401 | + console.log('calculatePrice2'); | |
| 402 | + var th = this, | |
| 403 | + good = this.data.bn_goods; | |
| 404 | + //-----------计算商品总价-------------- | |
| 405 | + var allpice = good.shop_price * good.buynum; | |
| 406 | + allpice = parseFloat(allpice).toFixed(2); | |
| 407 | + var txt = "formData.all_price"; | |
| 408 | + th.setData({ | |
| 409 | + [txt]: allpice, | |
| 410 | + }); | |
| 411 | + | |
| 412 | + var o_shipping_price = 0, | |
| 413 | + goods_weight = -1, | |
| 414 | + goods_piece = -1; | |
| 415 | + //-----------------总价----------------- | |
| 416 | + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price); | |
| 417 | + total_m = parseFloat(total_m).toFixed(2); | |
| 418 | + | |
| 419 | + var atxt = "formData.total_amount"; | |
| 420 | + th.setData({ | |
| 421 | + [atxt]: total_m, | |
| 422 | + }) | |
| 423 | + var order_m = total_m; | |
| 424 | + var txt = "formData.user_money"; | |
| 425 | + var txt2 = "formData.order_amount"; | |
| 426 | + | |
| 427 | + th.setData({ | |
| 428 | + [txt]: 0, | |
| 429 | + [txt2]: order_m | |
| 430 | + }) | |
| 431 | + | |
| 432 | + }, | |
| 433 | + | |
| 434 | + submitForm: function() { | |
| 435 | + var th = this; | |
| 436 | + this.sendsm(function() { | |
| 370 | 437 | th.submit_func(); |
| 371 | 438 | }) |
| 372 | 439 | }, |
| 373 | - | |
| 374 | - //--------------------提交订单----------------------- | |
| 375 | - submit_func: async function(){ | |
| 376 | - | |
| 377 | - if(this.data.is_summit_ing==1) return false; //--提交中退出-- | |
| 378 | - this.data.is_summit_ing=1; | |
| 379 | - var th=this,pdata=new Array(); | |
| 380 | - | |
| 381 | - var item={ | |
| 382 | - 'user_id': to.globalData.user_id, | |
| 383 | - 'account': th.data.formData.order_amount, //使用余额 | |
| 384 | - 'store_id':oo.stoid, //商家 | |
| 385 | - 'list':new Array(), | |
| 386 | - }; | |
| 387 | - | |
| 388 | - //判断是不是购物车购买还是立即购买 | |
| 389 | - if(this.data.is_cart){ | |
| 390 | - var list= th.data.cartlist; | |
| 391 | - for(var i in list){ | |
| 392 | - var gglist = list[i].goods; | |
| 393 | - for(var j in gglist){ | |
| 394 | - var gg=gglist[j]; | |
| 395 | - if(!gg.pick_id){ | |
| 396 | - getApp().showWarning("未找到门店"); | |
| 397 | - return false; | |
| 398 | - } | |
| 399 | - | |
| 400 | - var goods={ | |
| 401 | - 'card_id': gg.service_id, | |
| 402 | - 'itemid': gg.erpItemID, | |
| 403 | - 'qty': gg.goods_num, | |
| 404 | - 'price': gg.money, | |
| 405 | - 'pickup_id':gg.pick_id, | |
| 406 | - 'pickup_keyid':list[i].keyid, | |
| 407 | - }; | |
| 408 | - //--导购分享过来的id-- | |
| 409 | - if(gg.guide_id){ | |
| 410 | - goods.guide_id=gg.guide_id; | |
| 411 | - goods.guide_type=gg.guide_type; | |
| 412 | - //调用接口判断是不是会员 | |
| 413 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{ | |
| 414 | - if(res.data.code==0){ | |
| 415 | - goods.guide_name=res.data.data.salesman; | |
| 416 | - goods.guide_sn=res.data.data.salesman_no; | |
| 417 | - } | |
| 418 | - }) | |
| 419 | - } | |
| 420 | - item.list.push(goods); | |
| 421 | - } | |
| 422 | - } | |
| 423 | - }else{ | |
| 424 | - var gg = getApp().globalData.service_now; | |
| 425 | - if(!gg.pick_id){ | |
| 426 | - getApp().showWarning("未找到门店"); | |
| 427 | - return false; | |
| 428 | - } | |
| 429 | - | |
| 430 | - var goods={ | |
| 431 | - 'card_id': th.data.bn_goods.id, | |
| 432 | - 'itemid': th.data.bn_goods.erpItemID, | |
| 433 | - 'qty': gg.goods_num, | |
| 434 | - 'price': th.data.formData.order_amount, | |
| 435 | - 'pickup_id':gg.pick_id, | |
| 436 | - 'pickup_keyid':gg.keyid, | |
| 437 | - }; | |
| 438 | - | |
| 439 | - //--导购分享过来的id-- | |
| 440 | - if(gg.guide_id){ | |
| 441 | - goods.guide_id=gg.guide_id; | |
| 442 | - goods.guide_type=gg.guide_type; | |
| 443 | - //调用接口判断是不是会员 | |
| 444 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{ | |
| 445 | - if(res.data.code==0){ | |
| 446 | - goods.guide_name=res.data.data.salesman; | |
| 447 | - goods.guide_sn=res.data.data.salesman_no; | |
| 448 | - } | |
| 449 | - }) | |
| 450 | - } | |
| 451 | - item.list.push(goods); | |
| 452 | - } | |
| 453 | - | |
| 454 | - | |
| 455 | - pdata=item; | |
| 456 | - var str = JSON.stringify(pdata); | |
| 457 | - console.log("支付数据"); | |
| 458 | - console.log(str); | |
| 459 | - //return false; | |
| 460 | - wx.showLoading({title: "加载中"}); | |
| 461 | - wx.request({ | |
| 462 | - url: oo.url + '/api/weshop/recharge/saveRecharge', | |
| 463 | - data: str, | |
| 464 | - method: 'POST', | |
| 465 | - header: { | |
| 466 | - 'content-type': 'application/json' | |
| 467 | - },// 设置请求的 header | |
| 468 | - success: function (res) { | |
| 469 | - | |
| 470 | - wx.hideLoading(); | |
| 471 | - if (res.statusCode == 200) { | |
| 472 | - var data=res.data; | |
| 473 | - if(data.code==0){ | |
| 474 | - if(th.data.is_cart){ | |
| 475 | - var list = th.data.cartlist_y; | |
| 476 | - for (var i = 0; i < list.length; i++) { | |
| 477 | - //删除购物车 | |
| 478 | - a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {}); | |
| 479 | - } | |
| 480 | - } | |
| 481 | - var order_amount = pdata.account; | |
| 482 | - //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
| 483 | - if (order_amount > 0) { | |
| 484 | - th.setData({ isclose: 0 }); | |
| 485 | - | |
| 486 | - getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { | |
| 487 | - data: { | |
| 488 | - parentSn: data.data.order_sn, | |
| 489 | - store_id: oo.stoid | |
| 490 | - }, | |
| 491 | - success: function (su) { | |
| 492 | - var n=su.data.data; | |
| 493 | - th.weixinPay(n, | |
| 494 | - function () { | |
| 495 | - getApp().showWarning("购买成功"); | |
| 496 | - setTimeout(function () { | |
| 497 | - wx.reLaunch({ | |
| 498 | - url: "/pages/user/my_service/i_service", | |
| 499 | - }) | |
| 500 | - },1000) | |
| 501 | - }, function () { | |
| 502 | - getApp().showWarning("支付失败"); | |
| 503 | - setTimeout(function () { | |
| 504 | - wx.reLaunch({ | |
| 505 | - url: "/packageA/pages/cardList/cardList", | |
| 506 | - }) | |
| 507 | - },1000) | |
| 508 | - }) | |
| 509 | - } | |
| 510 | - }) | |
| 511 | - } | |
| 512 | - } | |
| 513 | - else{ | |
| 514 | - th.data.is_summit_ing=0; //是否提交中 | |
| 515 | - getApp().confirmBox(data.msg); | |
| 516 | - } | |
| 517 | - } else { | |
| 518 | - th.data.is_summit_ing=0; //是否提交中 | |
| 519 | - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
| 520 | - } | |
| 521 | - }, | |
| 522 | - fail: function () { | |
| 523 | - th.data.is_summit_ing=0; //是否提交中 | |
| 524 | - wx.hideLoading(); | |
| 525 | - console.log("index.js wx.request CheckCallUser fail"); | |
| 526 | - }, | |
| 527 | - complete: function () {} | |
| 528 | - }) | |
| 529 | - }, | |
| 530 | - | |
| 531 | - cart_set_err: function (e) { | |
| 440 | + | |
| 441 | + //--------------------提交订单----------------------- | |
| 442 | + submit_func: async function() { | |
| 443 | + | |
| 444 | + if (this.data.is_summit_ing == 1) return false; //--提交中退出-- | |
| 445 | + this.data.is_summit_ing = 1; | |
| 446 | + var th = this, | |
| 447 | + pdata = new Array(); | |
| 448 | + | |
| 449 | + var item = { | |
| 450 | + 'user_id': to.globalData.user_id, | |
| 451 | + 'account': th.data.formData.order_amount, //使用余额 | |
| 452 | + 'store_id': oo.stoid, //商家 | |
| 453 | + 'list': new Array(), | |
| 454 | + }; | |
| 455 | + | |
| 456 | + //判断是不是购物车购买还是立即购买 | |
| 457 | + if (this.data.is_cart) { | |
| 458 | + var list = th.data.cartlist; | |
| 459 | + for (var i in list) { | |
| 460 | + var gglist = list[i].goods; | |
| 461 | + for (var j in gglist) { | |
| 462 | + var gg = gglist[j]; | |
| 463 | + if (!gg.pick_id) { | |
| 464 | + getApp().showWarning("未找到门店"); | |
| 465 | + return false; | |
| 466 | + } | |
| 467 | + | |
| 468 | + var goods = { | |
| 469 | + 'card_id': gg.service_id, | |
| 470 | + 'itemid': gg.erpItemID, | |
| 471 | + 'qty': gg.goods_num, | |
| 472 | + 'price': gg.money, | |
| 473 | + 'pickup_id': gg.pick_id, | |
| 474 | + 'pickup_keyid': list[i].keyid, | |
| 475 | + }; | |
| 476 | + //--导购分享过来的id-- | |
| 477 | + if (gg.guide_id) { | |
| 478 | + goods.guide_id = gg.guide_id; | |
| 479 | + goods.guide_type = gg.guide_type; | |
| 480 | + //调用接口判断是不是会员 | |
| 481 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then( | |
| 482 | + res => { | |
| 483 | + if (res.data.code == 0) { | |
| 484 | + goods.guide_name = res.data.data.salesman; | |
| 485 | + goods.guide_sn = res.data.data.salesman_no; | |
| 486 | + } | |
| 487 | + }) | |
| 488 | + } | |
| 489 | + item.list.push(goods); | |
| 490 | + } | |
| 491 | + } | |
| 492 | + } else { | |
| 493 | + var gg = getApp().globalData.service_now; | |
| 494 | + if (!gg.pick_id) { | |
| 495 | + getApp().showWarning("未找到门店"); | |
| 496 | + return false; | |
| 497 | + } | |
| 498 | + | |
| 499 | + var goods = { | |
| 500 | + 'card_id': th.data.bn_goods.id, | |
| 501 | + 'itemid': th.data.bn_goods.erpItemID, | |
| 502 | + 'qty': gg.goods_num, | |
| 503 | + 'price': th.data.formData.order_amount, | |
| 504 | + 'pickup_id': gg.pick_id, | |
| 505 | + 'pickup_keyid': gg.keyid, | |
| 506 | + }; | |
| 507 | + | |
| 508 | + //--导购分享过来的id-- | |
| 509 | + if (gg.guide_id) { | |
| 510 | + goods.guide_id = gg.guide_id; | |
| 511 | + goods.guide_type = gg.guide_type; | |
| 512 | + //调用接口判断是不是会员 | |
| 513 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then( | |
| 514 | + res => { | |
| 515 | + if (res.data.code == 0) { | |
| 516 | + goods.guide_name = res.data.data.salesman; | |
| 517 | + goods.guide_sn = res.data.data.salesman_no; | |
| 518 | + } | |
| 519 | + }) | |
| 520 | + } | |
| 521 | + item.list.push(goods); | |
| 522 | + } | |
| 523 | + | |
| 524 | + | |
| 525 | + pdata = item; | |
| 526 | + var str = JSON.stringify(pdata); | |
| 527 | + console.log("支付数据"); | |
| 528 | + console.log(str); | |
| 529 | + //return false; | |
| 530 | + wx.showLoading({ | |
| 531 | + title: "加载中" | |
| 532 | + }); | |
| 533 | + wx.request({ | |
| 534 | + url: oo.url + '/api/weshop/recharge/saveRecharge', | |
| 535 | + data: str, | |
| 536 | + method: 'POST', | |
| 537 | + header: { | |
| 538 | + 'content-type': 'application/json' | |
| 539 | + }, // 设置请求的 header | |
| 540 | + success: function(res) { | |
| 541 | + | |
| 542 | + wx.hideLoading(); | |
| 543 | + if (res.statusCode == 200) { | |
| 544 | + var data = res.data; | |
| 545 | + if (data.code == 0) { | |
| 546 | + // console.log('myyyyyyyyyyyyyyyyyy', data.data); | |
| 547 | + if (th.data.is_cart) { | |
| 548 | + var list = th.data.cartlist_y; | |
| 549 | + for (var i = 0; i < list.length; i++) { | |
| 550 | + //删除购物车 | |
| 551 | + a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {}); | |
| 552 | + } | |
| 553 | + } | |
| 554 | + var order_amount = pdata.account; | |
| 555 | + //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
| 556 | + if (order_amount > 0) { | |
| 557 | + th.setData({ | |
| 558 | + isclose: 0 | |
| 559 | + }); | |
| 560 | + | |
| 561 | + getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { | |
| 562 | + data: { | |
| 563 | + parentSn: data.data.order_sn, | |
| 564 | + store_id: oo.stoid | |
| 565 | + }, | |
| 566 | + success: function(su) { | |
| 567 | + var n = su.data.data; | |
| 568 | + let order_id = data.data.order_id; | |
| 569 | + th.weixinPay(n, | |
| 570 | + function() { | |
| 571 | + getApp().showWarning("购买成功"); | |
| 572 | + setTimeout(function() { | |
| 573 | + wx.reLaunch({ | |
| 574 | + url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, | |
| 575 | + }) | |
| 576 | + }, 1000) | |
| 577 | + }, | |
| 578 | + function() { | |
| 579 | + getApp().showWarning("支付失败"); | |
| 580 | + setTimeout(function() { | |
| 581 | + wx.reLaunch({ | |
| 582 | + url: "/pages/user/order_list/order_list?index=2&tabindex=1", | |
| 583 | + }) | |
| 584 | + }, 1000) | |
| 585 | + }) | |
| 586 | + } | |
| 587 | + }) | |
| 588 | + } | |
| 589 | + } else { | |
| 590 | + th.data.is_summit_ing = 0; //是否提交中 | |
| 591 | + getApp().confirmBox(data.msg); | |
| 592 | + } | |
| 593 | + } else { | |
| 594 | + th.data.is_summit_ing = 0; //是否提交中 | |
| 595 | + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
| 596 | + } | |
| 597 | + }, | |
| 598 | + fail: function() { | |
| 599 | + th.data.is_summit_ing = 0; //是否提交中 | |
| 600 | + wx.hideLoading(); | |
| 601 | + console.log("index.js wx.request CheckCallUser fail"); | |
| 602 | + }, | |
| 603 | + complete: function() {} | |
| 604 | + }) | |
| 605 | + }, | |
| 606 | + | |
| 607 | + cart_set_err: function(e) { | |
| 532 | 608 | var txt = e.currentTarget.dataset.err; |
| 533 | 609 | var ob = {}; |
| 534 | 610 | ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; |
| 535 | 611 | this.setData(ob); |
| 536 | 612 | }, |
| 537 | - | |
| 613 | + | |
| 538 | 614 | //------调起支付框-------- |
| 539 | - weixinPay: function (n, success, fail) { | |
| 540 | - if(!n) return false; | |
| 541 | - wx.requestPayment({ | |
| 542 | - timeStamp: String(n.timeStamp), | |
| 543 | - nonceStr: n.nonceStr, | |
| 544 | - package: n.packageValue, | |
| 545 | - signType: n.signType, | |
| 546 | - paySign: n.paySign, | |
| 547 | - success: function (n) { | |
| 548 | - console.log(n), getApp().showSuccess("支付成功!"); | |
| 549 | - "function" == typeof success && success(); | |
| 550 | - wx.redirectTo({ | |
| 551 | - url: "../deposit/deposit" | |
| 552 | - }); | |
| 553 | - }, | |
| 554 | - fail: function (n) { | |
| 555 | - console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), | |
| 556 | - "function" == typeof fail && fail(); | |
| 557 | - } | |
| 558 | - }); | |
| 615 | + weixinPay: function(n, success, fail) { | |
| 616 | + if (!n) return false; | |
| 617 | + wx.requestPayment({ | |
| 618 | + timeStamp: String(n.timeStamp), | |
| 619 | + nonceStr: n.nonceStr, | |
| 620 | + package: n.packageValue, | |
| 621 | + signType: n.signType, | |
| 622 | + paySign: n.paySign, | |
| 623 | + success: function(n) { | |
| 624 | + console.log(n), getApp().showSuccess("支付成功!"); | |
| 625 | + "function" == typeof success && success(); | |
| 626 | + wx.redirectTo({ | |
| 627 | + url: "../deposit/deposit" | |
| 628 | + }); | |
| 629 | + }, | |
| 630 | + fail: function(n) { | |
| 631 | + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : | |
| 632 | + "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n | |
| 633 | + .errMsg.substr("requestPayment:fail ".length)), | |
| 634 | + "function" == typeof fail && fail(); | |
| 635 | + } | |
| 636 | + }); | |
| 559 | 637 | }, |
| 560 | - | |
| 638 | + | |
| 561 | 639 | //订阅消息提醒 |
| 562 | - sendsm:function(func) | |
| 563 | - { | |
| 564 | - var template_id = this.data.template_id; | |
| 565 | - // //授权订阅 | |
| 566 | - wx.requestSubscribeMessage({ | |
| 567 | - tmplIds: [template_id], | |
| 568 | - success(res) { | |
| 569 | - func(); | |
| 570 | - }, | |
| 571 | - fail(res) { | |
| 572 | - func(); | |
| 573 | - } | |
| 574 | - }) | |
| 575 | - | |
| 576 | - }, | |
| 577 | - | |
| 578 | - | |
| 640 | + sendsm: function(func) { | |
| 641 | + var template_id = this.data.template_id; | |
| 642 | + // //授权订阅 | |
| 643 | + wx.requestSubscribeMessage({ | |
| 644 | + tmplIds: [template_id], | |
| 645 | + success(res) { | |
| 646 | + func(); | |
| 647 | + }, | |
| 648 | + fail(res) { | |
| 649 | + func(); | |
| 650 | + } | |
| 651 | + }) | |
| 652 | + | |
| 653 | + }, | |
| 654 | + | |
| 655 | + | |
| 579 | 656 | }); | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
| ... | ... | @@ -8,6 +8,9 @@ var t = require("../../../utils/util.js"), |
| 8 | 8 | oo = s.globalData, |
| 9 | 9 | o = s.globalData.setting, |
| 10 | 10 | os = o; |
| 11 | + | |
| 12 | +let self = null; | |
| 13 | + | |
| 11 | 14 | //评价加载更多 |
| 12 | 15 | var more = function(e) { |
| 13 | 16 | return e && e.__esModule ? e : { |
| ... | ... | @@ -54,11 +57,14 @@ Page({ |
| 54 | 57 | shippingCost: 0, |
| 55 | 58 | enterAddressPage: !1, |
| 56 | 59 | categories: [{ |
| 57 | - name: "商品", | |
| 60 | + name: "卡项", | |
| 58 | 61 | id: 0 |
| 59 | 62 | }, { |
| 60 | 63 | name: "详情", |
| 61 | 64 | id: 1 |
| 65 | + },{ | |
| 66 | + name: "评价", | |
| 67 | + id: 2 | |
| 62 | 68 | }], |
| 63 | 69 | activeCategoryId2: 0, |
| 64 | 70 | categories2: [{ |
| ... | ... | @@ -148,7 +154,16 @@ Page({ |
| 148 | 154 | current: 0, //图片计数 |
| 149 | 155 | swiperCurrent: 0, //轮播的下标 |
| 150 | 156 | hiddenn: 0, //控制轮播计数显示 |
| 151 | - | |
| 157 | + | |
| 158 | + currentTab: 0, // 选择器控制参数 | |
| 159 | + mapurl: "", | |
| 160 | + mapurl_f_img: "", | |
| 161 | + videopicture: 0, //视频图片的控制 | |
| 162 | + | |
| 163 | + video: 0, //视频图片切换器 | |
| 164 | + index: 0, | |
| 165 | + noon: 0, //开始视频的隐藏 | |
| 166 | + | |
| 152 | 167 | screenWidth: 0, |
| 153 | 168 | canvasHidden: 1, |
| 154 | 169 | |
| ... | ... | @@ -195,60 +210,62 @@ Page({ |
| 195 | 210 | |
| 196 | 211 | //------初始化加载---------- |
| 197 | 212 | onLoad: function(t) { |
| 198 | - | |
| 199 | - // console.log("--服务卡项--"); | |
| 200 | - // console.log('fdsfasfasf111111111111111====================',t); | |
| 201 | - | |
| 202 | - | |
| 203 | - | |
| 213 | + | |
| 214 | + self = this; | |
| 215 | + this.data.options = t; // { goods_id: ...} | |
| 216 | + | |
| 217 | + | |
| 204 | 218 | var ee = this, |
| 205 | 219 | that = ee, |
| 206 | 220 | th = ee, |
| 207 | 221 | gid = t.goods_id, |
| 208 | 222 | first_leader=t.first_leader; |
| 209 | 223 | |
| 224 | + | |
| 210 | 225 | //-- 自定义海报 -- |
| 211 | - getApp().request.promiseGet("/api/weshop/goods/poster/page", { | |
| 212 | - data:{store_id:os.stoid, type:1, is_use:1} | |
| 213 | - }).then(res=>{ | |
| 214 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]){ | |
| 215 | - var poster_data=res.data.data.pageData[0]; | |
| 216 | - var json_str=poster_data.jsonStr; | |
| 217 | - if(json_str){ | |
| 218 | - var json_data=JSON.parse(json_str); | |
| 219 | - if(json_data.bg_img){ | |
| 220 | - //-- 把图片那到本地 -- | |
| 221 | - wx.getImageInfo({ | |
| 222 | - src:json_data.bg_img, | |
| 223 | - success: function(res) { | |
| 224 | - var path= res.path; | |
| 225 | - th.setData({share_b_img:path}) | |
| 226 | - }, | |
| 227 | - fail: function(res) {} | |
| 228 | - }); | |
| 229 | - } | |
| 230 | - th.setData({poster:json_data}) | |
| 231 | - } | |
| 232 | - } | |
| 233 | - }) | |
| 226 | + // getApp().request.promiseGet("/api/weshop/goods/poster/page", { | |
| 227 | + // data:{store_id:os.stoid, type:1, is_use:1} | |
| 228 | + // }).then(res=>{ | |
| 229 | + // if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]){ | |
| 230 | + // var poster_data=res.data.data.pageData[0]; | |
| 231 | + // var json_str=poster_data.jsonStr; | |
| 232 | + // if(json_str){ | |
| 233 | + // var json_data=JSON.parse(json_str); | |
| 234 | + // if(json_data.bg_img){ | |
| 235 | + // //-- 把图片那到本地 -- | |
| 236 | + // wx.getImageInfo({ | |
| 237 | + // src:json_data.bg_img, | |
| 238 | + // success: function(res) { | |
| 239 | + // var path= res.path; | |
| 240 | + // th.setData({share_b_img:path}) | |
| 241 | + // }, | |
| 242 | + // fail: function(res) {} | |
| 243 | + // }); | |
| 244 | + // } | |
| 245 | + // th.setData({poster:json_data}) | |
| 246 | + // } | |
| 247 | + // } | |
| 248 | + // }) | |
| 249 | + | |
| 234 | 250 | |
| 235 | 251 | //---获取手机地址坐标-- |
| 236 | 252 | //--如果tg_id是空的话,分享回来-- |
| 237 | 253 | if (gid == undefined || gid == null || gid == "") { |
| 238 | - var gid_str = decodeURIComponent(t.scene); | |
| 254 | + var gid_str = decodeURIComponent(t.scene); | |
| 239 | 255 | gid_str=gid_str.split("_"); |
| 240 | 256 | gid=gid_str[0]; |
| 241 | 257 | if(gid_str.length>1){ |
| 242 | 258 | first_leader=gid_str[1]; |
| 243 | 259 | } |
| 244 | - //-- 如果有room_id的获取 -- | |
| 245 | - if(gid_str.length>2 && gid_str[2]){ | |
| 246 | - room_id=gid_str[2]; | |
| 247 | - room_user_share=1; | |
| 248 | - } | |
| 249 | - | |
| 250 | - } | |
| 260 | + //-- 如果有room_id的获取 -- | |
| 261 | + if(gid_str.length>2 && gid_str[2]){ | |
| 262 | + room_id=gid_str[2]; | |
| 263 | + room_user_share=1; | |
| 264 | + } | |
| 265 | + }; | |
| 266 | + | |
| 251 | 267 | ee.setData({ gid: gid}); |
| 268 | + | |
| 252 | 269 | if(first_leader){ |
| 253 | 270 | getApp().globalData.first_leader=first_leader; |
| 254 | 271 | //调用接口判断是不是会员 |
| ... | ... | @@ -268,21 +285,76 @@ Page({ |
| 268 | 285 | }) |
| 269 | 286 | |
| 270 | 287 | //----获取系统参数----- |
| 271 | - getApp().getConfig2(function(e) { | |
| 272 | - | |
| 288 | + getApp().getConfig2(function (e) { | |
| 289 | + ee.setData({ | |
| 290 | + bconfig: e, | |
| 291 | + sales_rules: e.sales_rules, | |
| 292 | + }); | |
| 293 | + | |
| 294 | + if (e.categoryset.indexOf("," + 1 + ",") != -1) { | |
| 295 | + ee.setData({ | |
| 296 | + is_show_pl: 1 | |
| 297 | + }); | |
| 298 | + } | |
| 299 | + if (e.categoryset.indexOf("," + 3 + ",") != -1) { | |
| 300 | + ee.setData({ | |
| 301 | + is_show_pp: 1 | |
| 302 | + }); | |
| 303 | + } | |
| 304 | + if (e.categoryset.indexOf("," + 2 + ",") != -1) { | |
| 305 | + ee.setData({ | |
| 306 | + is_show_gb: 1 | |
| 307 | + }); | |
| 308 | + } | |
| 309 | + console.log(e); | |
| 273 | 310 | var json_d = JSON.parse(e.switch_list); |
| 274 | 311 | ee.setData({ |
| 275 | 312 | store_config: e, |
| 276 | - sys_switch:json_d, | |
| 313 | + sys_switch: json_d, | |
| 314 | + is_closecoupon: json_d.is_closecoupon, | |
| 315 | + is_newsales_rules: json_d.is_newsales_rules | |
| 277 | 316 | }); |
| 278 | - | |
| 279 | - | |
| 317 | + ee.init(gid); | |
| 318 | + //------几人评价------- | |
| 319 | + //n.init(th, "", "comments"); | |
| 320 | + | |
| 280 | 321 | th.requestCardNum(), wx.pageScrollTo && th.setData({ |
| 281 | 322 | supportPageScroll: !0 |
| 282 | 323 | }); |
| 283 | - | |
| 284 | - | |
| 285 | - },1); | |
| 324 | + | |
| 325 | + //计算等级价相关 | |
| 326 | + // var swithc_list = e.switch_list; | |
| 327 | + // var sw_arr = JSON.parse(swithc_list); | |
| 328 | + // //---如果后台又开等级卡的开关--- | |
| 329 | + // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | |
| 330 | + // th.setData({ rank_switch: true }); | |
| 331 | + // //---回调卡的列表--- | |
| 332 | + // th.getPlusCardType(function (ob) { | |
| 333 | + // th.setData({ card_list: ob.card_list }); | |
| 334 | + // var ti = setInterval(function () { | |
| 335 | + // var user = getApp().globalData.userInfo; | |
| 336 | + // if (!user) return false; | |
| 337 | + // clearInterval(ti); | |
| 338 | + // if (user.card_field && user['card_expiredate']) { | |
| 339 | + // var str = user['card_expiredate'].replace(/-/g, '/'); | |
| 340 | + // var end = new Date(str); | |
| 341 | + // end = Date.parse(end) / 1000; | |
| 342 | + // var now = ut.gettimestamp(); | |
| 343 | + // //--- 判断是等级会员,且在有效期范围内 --- | |
| 344 | + // if (user.card_field && now < end) { | |
| 345 | + // var card_name = ob.name_map.get(user.card_field); | |
| 346 | + // //if(card_name.length>6) card_name=card_name.substring(0,6); | |
| 347 | + | |
| 348 | + // var is_near_date = 0; | |
| 349 | + // if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 | |
| 350 | + // th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); | |
| 351 | + // } | |
| 352 | + // } | |
| 353 | + // }, 500) | |
| 354 | + // }) | |
| 355 | + // } | |
| 356 | + | |
| 357 | + }, 1); | |
| 286 | 358 | |
| 287 | 359 | //获取用户设备信息,屏幕宽度 |
| 288 | 360 | wx.getSystemInfo({ |
| ... | ... | @@ -376,20 +448,175 @@ Page({ |
| 376 | 448 | |
| 377 | 449 | }, |
| 378 | 450 | //------------程序初始化入口------------- |
| 379 | - async init(gid) {}, | |
| 451 | + async init(gid) { | |
| 452 | + var ee = this, | |
| 453 | + th = ee, | |
| 454 | + gallery = null, | |
| 455 | + is_collect = 0, | |
| 456 | + collect_id = 0, | |
| 457 | + categories3 = ee.data.categories3, | |
| 458 | + fir_com = null, | |
| 459 | + fir_quan = null, | |
| 460 | + mapurl = null, | |
| 461 | + mapurl_f_img = null; | |
| 462 | + | |
| 463 | + | |
| 464 | + //------图片滚动---------- | |
| 465 | + // await getApp().request.promiseGet("/api/weshop/goodsimages/page", { | |
| 466 | + // data: { | |
| 467 | + // store_id: os.stoid, | |
| 468 | + // goods_id: gid, | |
| 469 | + // }, | |
| 470 | + // }).then(res => { | |
| 471 | + | |
| 472 | + // var t = res; | |
| 473 | + // var g = t.data.data.pageData; | |
| 474 | + // if (g.length == 0) { | |
| 475 | + // var ie = { | |
| 476 | + // "image_url": o.imghost + "/public/images/default_goods_image_240.gif" | |
| 477 | + // }; | |
| 478 | + // g.push(ie); | |
| 479 | + // gallery = g; | |
| 480 | + // return; | |
| 481 | + // } | |
| 482 | + // for (var i = 0; i < g.length; i++) { | |
| 483 | + // if (g[i].image_url.indexOf(o.imghost) == -1) | |
| 484 | + // g[i].image_url = o.imghost + g[i].image_url; | |
| 485 | + // } | |
| 486 | + // gallery = g; | |
| 487 | + // }) | |
| 488 | + | |
| 489 | + | |
| 490 | + //------是否收藏---------- | |
| 491 | + await getApp().request.promiseGet("/api/weshop/goodscollect/page", { | |
| 492 | + data: { | |
| 493 | + store_id: os.stoid, | |
| 494 | + goods_id: gid, | |
| 495 | + user_id: oo.user_id, | |
| 496 | + } | |
| 497 | + }).then(res => { | |
| 498 | + var t = res; | |
| 499 | + var data = t.data.data.pageData; | |
| 500 | + if (data && data.length > 0) { | |
| 501 | + //ee.setData({ is_collect: 1, collect_id: data[0].collect_id, }); | |
| 502 | + is_collect = 1; | |
| 503 | + collect_id = data[0].collect_id; | |
| 504 | + } | |
| 505 | + }) | |
| 506 | + | |
| 507 | + //------获取评价的统计数量---- | |
| 508 | + await getApp().request.promiseGet("/api/weshop/serviceComment/countlist/", { | |
| 509 | + data: { | |
| 510 | + store_id: os.stoid, | |
| 511 | + service_id: gid | |
| 512 | + }, | |
| 513 | + //failRollback: !0, | |
| 514 | + | |
| 515 | + }).then(res => { | |
| 516 | + console.log('get评价统计数量', res.data.data); | |
| 517 | + var t = res; | |
| 518 | + var g = t.data.data[0]; | |
| 519 | + if (g != null && g != undefined) { | |
| 520 | + var allnum = g.c0 + g.c1 + g.c2 + g.c3 + g.c4 + g.c5; | |
| 521 | + var num2 = g.c4 + g.c5; | |
| 522 | + var num3 = g.c3; | |
| 523 | + var num4 = g.c0 + g.c1 + g.c2; | |
| 524 | + | |
| 525 | + var dd = ee.data.categories3; | |
| 526 | + dd[0].num = allnum; | |
| 527 | + dd[1].num = g.cimg; | |
| 528 | + dd[2].num = num2; | |
| 529 | + dd[3].num = num3; | |
| 530 | + dd[4].num = num4; | |
| 531 | + | |
| 532 | + categories3 = dd; | |
| 533 | + } | |
| 534 | + }) | |
| 535 | + | |
| 536 | + //----获取详情页的评价---- | |
| 537 | + await getApp().request.promiseGet("/api/weshop/serviceComment/pageComment", { | |
| 538 | + data: { | |
| 539 | + store_id: os.stoid, | |
| 540 | + service_id: gid, | |
| 541 | + pageSize: 3, | |
| 542 | + parent_id: 0, | |
| 543 | + page: 1, | |
| 544 | + is_show: 1, | |
| 545 | + }, | |
| 546 | + }).then(res => { | |
| 547 | + console.log('get详情页评价', res.data.data); | |
| 548 | + fir_com = res.data.data.pageData; | |
| 549 | + }) | |
| 550 | + | |
| 551 | + if (fir_com) { | |
| 552 | + for (var ind in fir_com) { | |
| 553 | + if (fir_com[ind].head_pic == "") fir_com[ind].head_pic = ee.data.iurl + "/miniapp/images/hui_hear_pic.png"; | |
| 554 | + if (fir_com[ind].img) fir_com[ind].img = ut.unserialize(fir_com[ind].img); | |
| 555 | + if (fir_com[ind].weapp_img) fir_com[ind].weapp_img = JSON.parse(fir_com[ind].weapp_img); | |
| 556 | + } | |
| 557 | + } | |
| 558 | + | |
| 559 | + // if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length<=0)) { | |
| 560 | + // //----获取详情页的券的数量---- | |
| 561 | + // await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
| 562 | + // data: { | |
| 563 | + // store_id: os.stoid, | |
| 564 | + // type: 1, | |
| 565 | + // pageSize: 3, | |
| 566 | + // page: 1, | |
| 567 | + // is_share: 0, | |
| 568 | + // }, | |
| 569 | + // }).then(res1 => { | |
| 570 | + // fir_quan = res1.data.data.pageData; | |
| 571 | + // }) | |
| 572 | + // } | |
| 573 | + | |
| 574 | + | |
| 575 | + //this.getHistoryBuy(); //获取历史购买 | |
| 576 | + ee.setData({ | |
| 577 | + is_collect: is_collect, | |
| 578 | + collect_id: collect_id, | |
| 579 | + categories3: categories3, | |
| 580 | + fir_quan: fir_quan, | |
| 581 | + fir_comments: fir_com, | |
| 582 | + // cardComments: fir_com, | |
| 583 | + }); | |
| 584 | + | |
| 585 | + }, | |
| 380 | 586 | |
| 381 | 587 | //---展示--- |
| 588 | + // gid 在onload阶段已经保存在this.data中 | |
| 382 | 589 | onShow: function() { |
| 383 | 590 | var that=this; |
| 384 | - this.data.is_timer = 1; | |
| 385 | 591 | var ee = this,gid = this.data.gid, i = getApp().request; |
| 386 | - this.wait_for_store_config(); | |
| 592 | + this.data.is_timer = 1; | |
| 593 | + this.wait_for_store_config(); | |
| 387 | 594 | |
| 388 | 595 | i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { |
| 389 | 596 | failRollback: !0, |
| 390 | 597 | success: function(t) { |
| 391 | 598 | if (t.data.code == 0) { |
| 392 | - | |
| 599 | + // console.log('GET pic and video'); | |
| 600 | + if(t.data.data.listServiceVideos && t.data.data.listServiceVideos[0] && t.data.data.listServiceVideos[0].video_url) { | |
| 601 | + that.setData({ | |
| 602 | + mapurl: t.data.data.listServiceVideos[0].video_url, | |
| 603 | + }); | |
| 604 | + }; | |
| 605 | + if(t.data.data.listServiceVideos && t.data.data.listServiceVideos[0] && t.data.data.listServiceVideos[0].video_img) { | |
| 606 | + that.setData({ | |
| 607 | + mapurl_f_img: t.data.data.listServiceVideos[0].video_img, | |
| 608 | + }); | |
| 609 | + }; | |
| 610 | + if(t.data.data.listServiceImages) { | |
| 611 | + that.setData({ | |
| 612 | + gallery: t.data.data.listServiceImages, | |
| 613 | + }); | |
| 614 | + }; | |
| 615 | + if(t.data.data.listServiceItem) { | |
| 616 | + that.setData({ | |
| 617 | + listServiceItem: t.data.data.listServiceItem, | |
| 618 | + }); | |
| 619 | + }; | |
| 393 | 620 | that.setData({ |
| 394 | 621 | 'data.goods_name': t.data.data.serviceName, |
| 395 | 622 | 'data.shop_price': t.data.data.money, |
| ... | ... | @@ -401,9 +628,14 @@ Page({ |
| 401 | 628 | 'data.sales_sum': t.data.data.sales_sum, |
| 402 | 629 | 'data.storageId':t.data.data.storageId, |
| 403 | 630 | 'data.service_sn':t.data.data.serviceSn, |
| 631 | + 'data.listServiceVideos': t.data.data.listServiceVideos, | |
| 632 | + // gallery: t.data.data.listServiceImages, | |
| 633 | + // mapurl: t.data.data.listServiceVideos[0].video_url, | |
| 634 | + // mapurl_f_img: t.data.data.listServiceVideos[0].video_img, | |
| 635 | + //listServiceItem: t.data.data.listServiceItem, | |
| 404 | 636 | }); |
| 405 | 637 | |
| 406 | - | |
| 638 | + console.log('0xxxxx999999', t.data.data); | |
| 407 | 639 | //-----商品详情--- |
| 408 | 640 | if(!t.data.data.serviceContent) t.data.data.serviceContent=" "; |
| 409 | 641 | a.wxParse("content", "html", t.data.data.serviceContent, ee, 6); |
| ... | ... | @@ -433,9 +665,10 @@ Page({ |
| 433 | 665 | } |
| 434 | 666 | }); |
| 435 | 667 | this.data.enterAddressPage && (this.data.enterAddressPage = !1); |
| 436 | - this.get_sto(); | |
| 668 | + this.get_sto(); | |
| 437 | 669 | |
| 438 | 670 | }, |
| 671 | + | |
| 439 | 672 | enterAddress: function() { |
| 440 | 673 | this.data.enterAddressPage = !0, wx.navigateTo({ |
| 441 | 674 | url: "/pages/user/address_list/address_list?operate=selectAddress" |
| ... | ... | @@ -1642,7 +1875,7 @@ Page({ |
| 1642 | 1875 | |
| 1643 | 1876 | // ----视频图片---- |
| 1644 | 1877 | // 图片计数器 |
| 1645 | - swiperChange: function(e) { | |
| 1878 | + swiperChange: function (e) { | |
| 1646 | 1879 | var that = this; |
| 1647 | 1880 | if (e.detail.current > 0) { |
| 1648 | 1881 | that.setData({ |
| ... | ... | @@ -1661,6 +1894,31 @@ Page({ |
| 1661 | 1894 | }) |
| 1662 | 1895 | } |
| 1663 | 1896 | }, |
| 1897 | + | |
| 1898 | + /*---视频相关--*/ | |
| 1899 | + videopicture: function (e) { | |
| 1900 | + var vipi = e.currentTarget.dataset.vipi; | |
| 1901 | + this.setData({ | |
| 1902 | + videopicture: vipi, | |
| 1903 | + swiperCurrent: vipi, | |
| 1904 | + noon: 0, | |
| 1905 | + current: 1 | |
| 1906 | + }); | |
| 1907 | + }, | |
| 1908 | + | |
| 1909 | + videoPlay: function (e) { | |
| 1910 | + var _index = e.currentTarget.id | |
| 1911 | + this.setData({ | |
| 1912 | + _index: _index, | |
| 1913 | + noon: 1 | |
| 1914 | + }) | |
| 1915 | + | |
| 1916 | + setTimeout(function () { | |
| 1917 | + //将点击视频进行播放 | |
| 1918 | + var videoContext = wx.createVideoContext(_index) | |
| 1919 | + videoContext.play(); | |
| 1920 | + }, 500) | |
| 1921 | + }, | |
| 1664 | 1922 | |
| 1665 | 1923 | //--获取头像的本地缓存,回调写法-- |
| 1666 | 1924 | get_head_temp: function(tt, func) { |
| ... | ... | @@ -2244,7 +2502,150 @@ Page({ |
| 2244 | 2502 | corpId: id, |
| 2245 | 2503 | success(res) {} |
| 2246 | 2504 | }) |
| 2247 | - } | |
| 2505 | + }, | |
| 2506 | + | |
| 2507 | + //评论的调用 | |
| 2508 | + requestComments_new: async function () { | |
| 2509 | + var e = this, th = e, ee = e; var tp = e.data.activeCategoryId3; | |
| 2510 | + var t = '/api/weshop/serviceComment/pageComment?page=' + e.data.c_curr_p; | |
| 2511 | + | |
| 2512 | + wx.showLoading(); | |
| 2513 | + var req_where = { | |
| 2514 | + store_id: o.stoid, pageSize: 5, is_show: 1, | |
| 2515 | + parent_id: 0, goods_id: th.data.gid, commenttype: tp, | |
| 2516 | + } | |
| 2517 | + if (getApp().globalData.userInfo) { | |
| 2518 | + req_where.userId = getApp().globalData.user_id; | |
| 2519 | + } | |
| 2520 | + | |
| 2521 | + var rs_data = null; | |
| 2522 | + await getApp().request.promiseGet(t, { data: req_where }).then(res => { | |
| 2523 | + var tot = res.data.data.total; | |
| 2524 | + e.data.c_curr_p++; | |
| 2525 | + e.setData({ | |
| 2526 | + com_num: tot, //已经有加载 | |
| 2527 | + }); | |
| 2528 | + if (res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { | |
| 2529 | + rs_data = res.data.data.pageData; | |
| 2530 | + } else { | |
| 2531 | + th.setData({ comments_no_more: 1, auto: 1 }); | |
| 2532 | + } | |
| 2533 | + }) | |
| 2534 | + | |
| 2535 | + if (rs_data) { | |
| 2536 | + //var cda = th.data.comments; | |
| 2537 | + var cda = rs_data, com_data = th.data.comments; | |
| 2538 | + for (var ind in cda) { | |
| 2539 | + var ep = cda[ind]; | |
| 2540 | + if (cda[ind].head_pic == '') { | |
| 2541 | + cda[ind].head_pic = th.data.iurl + "/miniapp/images/hui_hear_pic.png"; | |
| 2542 | + } | |
| 2543 | + if (ep.weapp_img != "" && ut.isString(ep.weapp_img)) { | |
| 2544 | + cda[ind].weapp_img = JSON.parse(ep.weapp_img); | |
| 2545 | + } | |
| 2546 | + if (ep.img != "" && ut.isString(ep.img)) { | |
| 2547 | + cda[ind].img = ut.unserialize(ep.img); | |
| 2548 | + } | |
| 2549 | + | |
| 2550 | + //--测量多有字的宽带,计算有多少行-- | |
| 2551 | + var widh = ut.measureText(ep.content, 30); | |
| 2552 | + var lines = widh / 712; | |
| 2553 | + cda[ind].seeMore = false; | |
| 2554 | + if (lines > 3) cda[ind].seeMore = true; | |
| 2555 | + | |
| 2556 | + await getApp().request.promiseGet("/api/weshop/serviceComment/pageComment", { | |
| 2557 | + data: { store_id: o.stoid, parent_id: ep.comment_id } | |
| 2558 | + }).then(res => { | |
| 2559 | + if (res.data.data.pageData && res.data.data.pageData.length > 0) { | |
| 2560 | + cda[ind].replay_list = res.data.data.pageData; | |
| 2561 | + } | |
| 2562 | + }) | |
| 2563 | + } | |
| 2564 | + | |
| 2565 | + if (!com_data) com_data = cda; | |
| 2566 | + else com_data = com_data.concat(cda); | |
| 2567 | + | |
| 2568 | + th.setData({ comments: com_data }); | |
| 2569 | + } | |
| 2570 | + th.setData({ get_c: 1 }); | |
| 2571 | + wx.hideLoading(); | |
| 2572 | + }, | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + //--点赞功能-- | |
| 2577 | + click_zan: function (e) { | |
| 2578 | + var com_id = e.currentTarget.dataset.com_id; | |
| 2579 | + var item_id = e.currentTarget.dataset.item_id; | |
| 2580 | + var app = getApp(), | |
| 2581 | + th = this; | |
| 2582 | + | |
| 2583 | + if (app.globalData.userInfo == null || app.globalData.userInfo == undefined) { | |
| 2584 | + app.confirmBox("您还未登录"); | |
| 2585 | + return false; | |
| 2586 | + } | |
| 2587 | + | |
| 2588 | + var iszan = th.data.comments[item_id].userZanNum; | |
| 2589 | + if (this.data.iszaning) return false; | |
| 2590 | + this.data.iszaning = 1; | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + app.request.post("/api/weshop/serviceCommentZan/save", { | |
| 2594 | + data: { | |
| 2595 | + store_id: o.stoid, | |
| 2596 | + user_id: app.globalData.user_id, | |
| 2597 | + goods_id: th.data.gid, | |
| 2598 | + service_id: th.data.gid, | |
| 2599 | + comment_id: com_id | |
| 2600 | + }, | |
| 2601 | + success: function (ee) { | |
| 2602 | + | |
| 2603 | + if (ee.data.code == "-1") { | |
| 2604 | + app.my_warnning("不能给自己点赞", 0, th); | |
| 2605 | + th.data.iszaning = 0; | |
| 2606 | + return; | |
| 2607 | + } | |
| 2608 | + | |
| 2609 | + if (ee.data.code == 0 && iszan != 1) { | |
| 2610 | + var num = th.data.comments[item_id].zan_num; | |
| 2611 | + num++; | |
| 2612 | + var text = "comments[" + item_id + "].zan_num"; | |
| 2613 | + var text1 = "comments[" + item_id + "].userZanNum"; | |
| 2614 | + var _errObj = {}; | |
| 2615 | + _errObj[text] = num; | |
| 2616 | + _errObj[text1] = 1; | |
| 2617 | + th.setData(_errObj); | |
| 2618 | + | |
| 2619 | + } else { | |
| 2620 | + var num = th.data.comments[item_id].zan_num; | |
| 2621 | + num--; | |
| 2622 | + var text = "comments[" + item_id + "].zan_num"; | |
| 2623 | + var text1 = "comments[" + item_id + "].userZanNum"; | |
| 2624 | + var _errObj = {}; | |
| 2625 | + _errObj[text] = num; | |
| 2626 | + _errObj[text1] = 0; | |
| 2627 | + th.setData(_errObj); | |
| 2628 | + } | |
| 2629 | + | |
| 2630 | + setTimeout(function () { | |
| 2631 | + th.data.iszaning = 0; | |
| 2632 | + }, 500) | |
| 2633 | + | |
| 2634 | + } | |
| 2635 | + }) | |
| 2636 | + }, | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + //--外侧评价的点击效果--- | |
| 2640 | + clik_evaluate: function (e) { | |
| 2641 | + var val = e.currentTarget.dataset.val; | |
| 2642 | + this.setData({ | |
| 2643 | + activeCategoryId: 2, | |
| 2644 | + activeCategoryId3: val, | |
| 2645 | + comments: null | |
| 2646 | + }); | |
| 2647 | + this.requestComments_new(); | |
| 2648 | + }, | |
| 2248 | 2649 | |
| 2249 | 2650 | |
| 2250 | 2651 | ... | ... |
packageA/pages/goodsInfo/goodsInfo.json
| ... | ... | @@ -4,6 +4,6 @@ |
| 4 | 4 | "usingComponents": { |
| 5 | 5 | "nav_box": "/components/nav_box/nav_box", |
| 6 | 6 | "warn": "/components/long_warn/long_warn", |
| 7 | - "goods_recommend": "/components/goods_list/goods_list" | |
| 7 | + "serviceCard_recommend": "/components/serviceCard_list/serviceCard_list" | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -15,7 +15,44 @@ |
| 15 | 15 | </view> |
| 16 | 16 | <view class="goods-detail"> |
| 17 | 17 | <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}"> |
| 18 | - <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove"> | |
| 18 | + | |
| 19 | + <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:if="{{mapurl}}"> | |
| 20 | + <view class="xc-videos-picture rel"> | |
| 21 | + <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange"> | |
| 22 | + <swiper-item wx:if="{{mapurl}}"> | |
| 23 | + <view wx:if="{{noon == 0}}"> | |
| 24 | + <image class="xc-picturess" src="{{iurl+mapurl_f_img}}" mode="aspectFit"> | |
| 25 | + <image id="{{index}}" class="xc-play" src="{{iurl}}/miniapp/images/pofang.png" bindtap="videoPlay"></image> | |
| 26 | + </image> | |
| 27 | + </view> | |
| 28 | + <view wx:else> | |
| 29 | + <video class="xc-videos" src="{{iurl+mapurl}}" id="{{index}}" wx:if="{{_index == index}}"></video> | |
| 30 | + </view> | |
| 31 | + </swiper-item> | |
| 32 | + <swiper-item wx:for="{{gallery}}" wx:key="gallery"> | |
| 33 | + <view class="wh100 g_img_box" style="background-image:url({{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}});"></view> | |
| 34 | + </swiper-item> | |
| 35 | + </swiper> | |
| 36 | + <block wx:if="{{mapurl}}"> | |
| 37 | + <view wx:if="{{hiddenn==1}}"> | |
| 38 | + <view class="xc-imageCount">{{current}}/{{gallery.length}}</view> | |
| 39 | + </view> | |
| 40 | + <view class="xc-video-picture abs"> | |
| 41 | + <view class="xc-video" data-vipi="0" bindtap="videopicture"> | |
| 42 | + <view class="{{videopicture==0 ? 'xc-video-button':'xc-video-buttons'}} {{videopicture==0 ? 'xc-sn':''}}"> | |
| 43 | + 视频 | |
| 44 | + </view> | |
| 45 | + </view> | |
| 46 | + <view class="xc-picture {{videopicture==1 ? 'xc-sn':''}}" data-vipi="1" bindtap="videopicture"> | |
| 47 | + <view>图片</view> | |
| 48 | + </view> | |
| 49 | + </view> | |
| 50 | + </block> | |
| 51 | + </view> | |
| 52 | + </view> | |
| 53 | + | |
| 54 | + | |
| 55 | + <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:else> | |
| 19 | 56 | <view class="xc-videos-picture rel"> |
| 20 | 57 | <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" |
| 21 | 58 | indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange"> |
| ... | ... | @@ -27,7 +64,8 @@ |
| 27 | 64 | </view> |
| 28 | 65 | </view> |
| 29 | 66 | |
| 30 | - <block> | |
| 67 | + | |
| 68 | + <!-- <block> --> | |
| 31 | 69 | |
| 32 | 70 | <view class="goods-price rel"> |
| 33 | 71 | <view class="co-red" style="overflow: hidden"> |
| ... | ... | @@ -35,7 +73,7 @@ |
| 35 | 73 | </view> |
| 36 | 74 | |
| 37 | 75 | <view> |
| 38 | - <view class="co-red"><text class="rel yuan">¥</text>{{filters.toFix(data.shop_price,2)}}</view> | |
| 76 | + <view class="co-red"><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> | |
| 39 | 77 | <view class="goods-title"> |
| 40 | 78 | <view class="goods-name elli">{{data.goods_name}}</view> |
| 41 | 79 | </view> |
| ... | ... | @@ -47,7 +85,7 @@ |
| 47 | 85 | </view> |
| 48 | 86 | |
| 49 | 87 | </view> |
| 50 | - </block> | |
| 88 | + <!-- </block> --> | |
| 51 | 89 | |
| 52 | 90 | |
| 53 | 91 | |
| ... | ... | @@ -101,7 +139,60 @@ |
| 101 | 139 | |
| 102 | 140 | |
| 103 | 141 | |
| 104 | - | |
| 142 | + <!-- - 宝贝评价 -- --> | |
| 143 | + <view class="bdt16"> | |
| 144 | + <view class="bb_view"> | |
| 145 | + <view class="bold">宝贝评价({{categories3[0].num}})</view> | |
| 146 | + <view class="red_bb fs26" bindtap="look_pj"> | |
| 147 | + 查看全部 | |
| 148 | + <text class="bg_jj"></text> | |
| 149 | + </view> | |
| 150 | + </view> | |
| 151 | + <view class="xc_comment"> | |
| 152 | + <view class="xc_comment-have-pictures" data-val="5" bindtap="clik_evaluate"> | |
| 153 | + 有图({{categories3[1].num}}) | |
| 154 | + </view> | |
| 155 | + <view class="xc_comment-discuss" data-val="2" bindtap="clik_evaluate"> | |
| 156 | + 好评({{categories3[2].num}}) | |
| 157 | + </view> | |
| 158 | + <view class="xc_comment-discuss" data-val="3" bindtap="clik_evaluate"> | |
| 159 | + 中评({{categories3[3].num}}) | |
| 160 | + </view> | |
| 161 | + <view class="xc_comment-discuss" data-val="4" bindtap="clik_evaluate"> | |
| 162 | + 差评({{categories3[4].num}}) | |
| 163 | + </view> | |
| 164 | + </view> | |
| 165 | + <scroll-view scroll-x="true" class="pj_scroll"> | |
| 166 | + <view class="flex"> | |
| 167 | + <view class="xc_comment-detail" style="" wx:for="{{fir_comments}}" wx:key="{{item}}"> | |
| 168 | + <view class="xc_comment-left"> | |
| 169 | + <view class="xc_comment-user"> | |
| 170 | + <view class="xc_user-img"> | |
| 171 | + <image class="xc_imgs" src='{{item.is_anonymous!=1?item.head_pic:iurl+"/miniapp/images/hui_hear_pic.png"}}' binderror="bind_bnerr2" data-errorimg="fir_comments[{{index}}].head_pic"></image> | |
| 172 | + </view> | |
| 173 | + <view class="xc_user"> | |
| 174 | + <view class="xc_user-name five-level-word"> | |
| 175 | + {{item.is_anonymous!=1?item.username:'匿名'}} | |
| 176 | + </view> | |
| 177 | + <image class="xc_comment-img" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="{{index}}"></image> | |
| 178 | + </view> | |
| 179 | + </view> | |
| 180 | + <view class="xc_comment-font pj_word_size ellipsis-1 pdt12"> | |
| 181 | + <text class="ellipsis-1">{{item.content?item.content:'此用户没有填写评价。'}}</text> | |
| 182 | + </view> | |
| 183 | + <view class="xc_comment-val"> | |
| 184 | + <view class="xc_comment-time">{{item.add_time}}</view> | |
| 185 | + </view> | |
| 186 | + </view> | |
| 187 | + <view class="xc_goods-img-frame"> | |
| 188 | + <image wx:if="{{item.img[0]!=undefined && item.img[0]!=null}}" class="xc_goods-img" src='{{iurl+item.img[0]}}'></image> | |
| 189 | + <image wx:elif="{{item.weapp_img[0]!=undefined && item.weapp_img[0]!=null}}" class="xc_goods-img" src='{{item.weapp_img[0]}}'></image> | |
| 190 | + <image wx:else class="xc_goods-img" src='{{gallery[0].image_url}}'></image> | |
| 191 | + </view> | |
| 192 | + </view> | |
| 193 | + </view> | |
| 194 | + </scroll-view> | |
| 195 | + </view> | |
| 105 | 196 | |
| 106 | 197 | |
| 107 | 198 | |
| ... | ... | @@ -110,7 +201,25 @@ |
| 110 | 201 | <view class="red_shu"></view> |
| 111 | 202 | <view class="fs30 bold">商品详情</view> |
| 112 | 203 | </view> |
| 113 | - <view class="pd20"> | |
| 204 | + <view class="pdh20"> | |
| 205 | + | |
| 206 | + <view wx:if="{{listServiceItem && listServiceItem.length > 0}}"> | |
| 207 | + <view class="card fs28" wx:for="{{listServiceItem}}"> | |
| 208 | + <view class="flex ai_c jc_sb"> | |
| 209 | + <view class="ellipsis-1">{{item.projectName}}({{item.frequency}}次)</view> | |
| 210 | + <view class="pdl30"> | |
| 211 | + <text class="rmb fs36 bold c-red pdr10">{{item.money}}</text> | |
| 212 | + <text class="line-del fs22 c-9">{{item.showPrice}}</text> | |
| 213 | + </view> | |
| 214 | + </view> | |
| 215 | + <view class="flex ai_c jc_sb fs24 c-6"> | |
| 216 | + <view class="ellipsis-1">备注:{{filters.show_default(item.remark, '无')}}</view> | |
| 217 | + <!-- <view class="pdl30 shrink0">有效期:50天/2022-02-02</view> --> | |
| 218 | + </view> | |
| 219 | + </view> | |
| 220 | + | |
| 221 | + </view> | |
| 222 | + | |
| 114 | 223 | <view class="table_s" wx:if="{{service_list}}"> |
| 115 | 224 | <view class="tb_item tb-l"> |
| 116 | 225 | <view class="item_left f1"> |
| ... | ... | @@ -141,8 +250,20 @@ |
| 141 | 250 | </view> |
| 142 | 251 | |
| 143 | 252 | </view> |
| 253 | + | |
| 254 | + <!-- 推荐商品 --> | |
| 255 | + <view class="flex-center rel xc-linellae-frame"> | |
| 256 | + <view class="xc-linellae"></view> | |
| 257 | + <view class="abs flex-center xc-recommend-frame "> | |
| 258 | + <image class=" xc-recommend" src="{{iurl}}/miniapp/images/diamond.png"></image> | |
| 259 | + <view class="xc-recommend-word">推荐</view> | |
| 260 | + </view> | |
| 261 | + </view> | |
| 262 | + <serviceCard_recommend id="goods_list"></serviceCard_recommend> | |
| 263 | + | |
| 144 | 264 | </view> |
| 145 | 265 | |
| 266 | + | |
| 146 | 267 | <view class="goods-norms" hidden="{{activeCategoryId==1?false:true}}"> |
| 147 | 268 | <view class="pd20"> |
| 148 | 269 | <view class="table_s" wx:if="{{service_list}}"> |
| ... | ... | @@ -176,36 +297,122 @@ |
| 176 | 297 | |
| 177 | 298 | </view> |
| 178 | 299 | </view> |
| 179 | - | |
| 300 | + | |
| 301 | + <view class="goods-comment" hidden="{{activeCategoryId==2?false:true}}"> | |
| 302 | + <view class="topframe"> | |
| 303 | + <view class="topframe-top"> | |
| 304 | + <view class="topframe-top-content"> | |
| 305 | + <view>宝贝评价</view> | |
| 306 | + <view class="topframe-top-val">({{categories3[0].num}})</view> | |
| 307 | + </view> | |
| 308 | + <view class="topframe-praise" wx:if="{{categories3[0].num}}"> | |
| 309 | + 好评{{ filters.toFix(categories3[2].num/categories3[0].num*100,2) }}% | |
| 310 | + </view> | |
| 311 | + <view wx:else>好评 0%</view> | |
| 312 | + </view> | |
| 313 | + <view class="buttem-list"> | |
| 314 | + <view bindtap="tabClick3" id="{{item.id}}" wx:for="{{categories3}}" wx:key="categories3" class="item {{activeCategoryId3==item.id?'red':''}}"> | |
| 315 | + {{item.name}}({{item.num}}) | |
| 316 | + </view> | |
| 317 | + </view> | |
| 318 | + </view> | |
| 319 | + <block wx:for="{{comments}}" wx:for-index="cIdx" wx:key="{{cIdx}}"> | |
| 320 | + <view style='border-bottom:4rpx solid #eee;'> | |
| 321 | + <view class="middle"> | |
| 322 | + <view class="middle-img-frame"> | |
| 323 | + <image class="middle-img" src="{{item.is_anonymous!=1?item.head_pic:iurl+'/miniapp/images/hui_hear_pic.png'}}" binderror="bind_bnerr2" data-errorimg="comments[{{cIdx}}].head_pic"></image> | |
| 324 | + <view class="middle-user-frame"> | |
| 325 | + <view class="middle-user"> | |
| 326 | + {{item.username==''||item.is_anonymous==1 ?'匿名用户':item.username}} | |
| 327 | + </view> | |
| 328 | + <image class="star" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="{{index}}"></image> | |
| 329 | + </view> | |
| 330 | + </view> | |
| 331 | + <view class="xc-pirces"> | |
| 332 | + <view class="middle-font {{item.seeMore==true?'ellipsis-3':''}}"> | |
| 333 | + {{item.content?item.content:'此用户没有填写评价。'}} | |
| 334 | + </view> | |
| 335 | + </view> | |
| 336 | + <view wx:if='{{item.seeMore}}' data-index='{{cIdx}}' class="s_btn fs30 red-co" catchtap='toggleHandler'> | |
| 337 | + 全部显示 | |
| 338 | + </view> | |
| 339 | + <view wx:if='{{!item.seeMore && item.auto}}' data-index='{{cIdx}}' class="s_btn fs30 red-co" catchtap='toggleContent'> | |
| 340 | + 收起 | |
| 341 | + </view> | |
| 342 | + <view class="img-ul"> | |
| 343 | + <block wx:if="{{item.source_type==0}}"> | |
| 344 | + <view class="img-li" wx:for="{{item.img}}" wx:key="{{index}}"> | |
| 345 | + <image bindtap="previewCommentImgs" class="wh100" data-cidx="{{cIdx}}" data-img="{{iurl}}{{item}}" data-id="{{index}}" src="{{iurl}}{{item}}"></image> | |
| 346 | + </view> | |
| 347 | + </block> | |
| 348 | + <block wx:if="{{item.source_type==1}}"> | |
| 349 | + <view class="img-li" wx:for="{{item.weapp_img}}" wx:if="{{aitem.length>10}}" wx:key="{{index}}" wx:for-item="aitem"> | |
| 350 | + <image bindtap="previewCommentImgs_w" class="wh100" data-cidx="{{cIdx}}" data-img="{{aitem}}" data-id="{{index}}" src="{{aitem}}"></image> | |
| 351 | + </view> | |
| 352 | + </block> | |
| 353 | + </view> | |
| 354 | + <view class="z_parameter"> | |
| 355 | + <view class="parameter-font">{{item.add_time}}</view> | |
| 356 | + <view class="parameter-dian" bindtap="click_zan" data-com_id="{{item.comment_id}}" data-item_id="{{cIdx}}"> | |
| 357 | + <image wx:if="{{item.userZanNum==1}}" class="parameter-img" src="{{iurl}}/miniapp/images/zan_red.png"></image> | |
| 358 | + <image wx:else class="parameter-img" src="{{iurl}}/miniapp/images/dianzan.png"></image> | |
| 359 | + <view class="parameter-val" style='color:{{item.userZanNum==1? "#d60022":"#999" }}'> | |
| 360 | + {{item.zan_num}} | |
| 361 | + </view> | |
| 362 | + </view> | |
| 363 | + </view> | |
| 364 | + </view> | |
| 365 | + <view class="reply rel" wx:if="{{item.replay_list}}"> | |
| 366 | + <view class="line_bulge"></view> | |
| 367 | + <view class="shop-reply">店家回复:</view> | |
| 368 | + <view class="shop-font" wx:for="{{item.replay_list}}" wx:for-item="r_item" wx:key="{{index}}"> | |
| 369 | + {{r_item.content}} | |
| 370 | + </view> | |
| 371 | + </view> | |
| 372 | + </view> | |
| 373 | + </block> | |
| 374 | + <block wx:if="{{(!comments || comments.length==0) && get_c }}"> | |
| 375 | + <text class="no_pj_list">暂无评价</text> | |
| 376 | + </block> | |
| 377 | + <block wx:if="{{comments.length>10 && comments_no_more}}"> | |
| 378 | + <text class="no_pj_list">已经加载到底部</text> | |
| 379 | + </block> | |
| 380 | + </view> | |
| 180 | 381 | </view> |
| 181 | 382 | </view> |
| 182 | 383 | <!---滚动到顶部----> |
| 183 | - <view bindtap="doScrollTop" class="toTop" wx:if="{{supportPageScroll}}"> | |
| 384 | + <!-- <view bindtap="doScrollTop" class="toTop" wx:if="{{supportPageScroll}}"> | |
| 184 | 385 | <image class="wh100" src="{{iurl}}/miniapp/images/topup.png"></image> |
| 185 | - </view> | |
| 386 | + </view> --> | |
| 186 | 387 | |
| 187 | 388 | <!-- 底部按钮 --> |
| 188 | - <view class="join-cart jc_sb"> | |
| 389 | + <view class="join-cart jc_sb ai_c"> | |
| 189 | 390 | |
| 190 | 391 | <view class="flex"> |
| 191 | - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split f1" open-type="contact" | |
| 192 | - session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}" style="text-align: center"> | |
| 392 | + <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact" | |
| 393 | + session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | |
| 193 | 394 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
| 194 | 395 | <view>客服</view> |
| 195 | 396 | </button> |
| 196 | 397 | |
| 197 | - <view wx:elif="{{sys_switch.weapp_customertype==2}}" class="custom-service cart-ico new_split f1" bindtap="con_weixin" | |
| 398 | + <view wx:elif="{{sys_switch.weapp_customertype==2}}" class="custom-service cart-ico new_split pdh20" bindtap="con_weixin" | |
| 198 | 399 | style="text-align: center"> |
| 199 | 400 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
| 200 | 401 | <view>客服</view> |
| 201 | 402 | </view> |
| 202 | 403 | |
| 203 | - <view wx:else class="custom-service cart-ico new_split f1" bindtap="contactService" style="text-align: center"> | |
| 404 | + <view wx:else class="custom-service cart-ico new_split pdh20" bindtap="contactService" style="text-align: center"> | |
| 204 | 405 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
| 205 | 406 | <view>客服</view> |
| 206 | 407 | </view> |
| 408 | + | |
| 409 | + <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20"> | |
| 410 | + <image hidden="{{is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart.png"></image> | |
| 411 | + <image hidden="{{!is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart-h.png"></image> | |
| 412 | + <view>收藏</view> | |
| 413 | + </view> | |
| 207 | 414 | |
| 208 | - <view class="shopping-cart cart-ico new_split f1"> | |
| 415 | + <view class="shopping-cart cart-ico new_split pdh20"> | |
| 209 | 416 | <navigator open-type="switchTab" url="/pages/cart/cart/cart" style="text-align: center"> |
| 210 | 417 | <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image> |
| 211 | 418 | <view class="cart-num ellipsis-1"> {{cartGoodsNum}} </view> |
| ... | ... | @@ -215,8 +422,7 @@ |
| 215 | 422 | </view> |
| 216 | 423 | |
| 217 | 424 | |
| 218 | - <view class="flex f1 pdh20"> | |
| 219 | - | |
| 425 | + <view class="flex f1 btn-group"> | |
| 220 | 426 | <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view> |
| 221 | 427 | <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即购买</view> |
| 222 | 428 | </view> | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxss
| ... | ... | @@ -361,15 +361,18 @@ image { |
| 361 | 361 | |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | -.join-cart>view { | |
| 365 | - width: 29%; | |
| 364 | +.join-cart > view { | |
| 365 | + /* width: 29%; */ | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | -.join-cart>.new_split { | |
| 369 | - width: 13%; | |
| 370 | - text-align: center; | |
| 371 | - padding: 0; | |
| 372 | - margin: 0; | |
| 368 | +.join-cart .new_split { | |
| 369 | + /* width: 13%; */ | |
| 370 | + /* text-align: center; */ | |
| 371 | + /* padding: 20rpx; */ | |
| 372 | + /* box-sizing: border-box; */ | |
| 373 | + /* flex-shrink: 0; */ | |
| 374 | + /* padding: 0; | |
| 375 | + margin: 0; */ | |
| 373 | 376 | } |
| 374 | 377 | |
| 375 | 378 | .cart-ico { |
| ... | ... | @@ -384,13 +387,13 @@ image { |
| 384 | 387 | .cs-img { |
| 385 | 388 | width: 45rpx; |
| 386 | 389 | height: 40rpx; |
| 387 | - margin-top: 15rpx; | |
| 390 | + /* margin-top: 15rpx; */ | |
| 388 | 391 | } |
| 389 | 392 | |
| 390 | 393 | .sc-img { |
| 391 | 394 | width: 42rpx; |
| 392 | 395 | height: 40rpx; |
| 393 | - margin-top: 15rpx; | |
| 396 | + /* margin-top: 15rpx; */ | |
| 394 | 397 | } |
| 395 | 398 | |
| 396 | 399 | .cart-num { |
| ... | ... | @@ -410,7 +413,7 @@ image { |
| 410 | 413 | font-size: 28rpx; |
| 411 | 414 | color: #fff; |
| 412 | 415 | line-height: 70rpx; |
| 413 | - margin-top: 16rpx; | |
| 416 | + /* margin-top: 16rpx; */ | |
| 414 | 417 | text-align: center; |
| 415 | 418 | |
| 416 | 419 | |
| ... | ... | @@ -419,8 +422,8 @@ image { |
| 419 | 422 | .join-btn { |
| 420 | 423 | background-color: #ffb03f; |
| 421 | 424 | height: 70rpx; |
| 422 | -border-radius: 55rpx 0rpx 0rpx 55rpx; | |
| 423 | -margin-top: 16rpx; | |
| 425 | +/* border-radius: 55rpx 0rpx 0rpx 55rpx; | |
| 426 | +margin-top: 16rpx; */ | |
| 424 | 427 | |
| 425 | 428 | |
| 426 | 429 | } |
| ... | ... | @@ -432,7 +435,7 @@ view.cart-btn-lg { |
| 432 | 435 | .buy-btn { |
| 433 | 436 | background-color: #f23030; |
| 434 | 437 | height: 70rpx; |
| 435 | -border-radius: 0 56rpx 55rpx 0; | |
| 438 | +/* border-radius: 0 56rpx 55rpx 0; */ | |
| 436 | 439 | |
| 437 | 440 | } |
| 438 | 441 | |
| ... | ... | @@ -1206,7 +1209,7 @@ left:31rpx;} |
| 1206 | 1209 | /* 回复 */ |
| 1207 | 1210 | .reply{ |
| 1208 | 1211 | width: 95%; |
| 1209 | - height: 120rpx; | |
| 1212 | + /* height: 120rpx; */ | |
| 1210 | 1213 | padding-top: 14rpx; |
| 1211 | 1214 | border-top:3rpx solid #eeeeee; |
| 1212 | 1215 | margin:0 auto; |
| ... | ... | @@ -1331,7 +1334,8 @@ left:31rpx;} |
| 1331 | 1334 | } |
| 1332 | 1335 | |
| 1333 | 1336 | .xc_goods-img{ |
| 1334 | - width: 180rpx;height: 180rpx; | |
| 1337 | + width: 190rpx; | |
| 1338 | + height: 190rpx; | |
| 1335 | 1339 | } |
| 1336 | 1340 | .xc_comment-left{ |
| 1337 | 1341 | display:inline-block; |
| ... | ... | @@ -2848,4 +2852,43 @@ button.custom-service::after{ |
| 2848 | 2852 | flex: 1; |
| 2849 | 2853 | } |
| 2850 | 2854 | |
| 2851 | -.gray{ background-color: #dcdcdc !important;} | |
| 2852 | 2855 | \ No newline at end of file |
| 2856 | +.gray{ background-color: #dcdcdc !important;} | |
| 2857 | + | |
| 2858 | + | |
| 2859 | +.card { | |
| 2860 | + position: relative; | |
| 2861 | + padding: 20rpx; | |
| 2862 | + margin-bottom: 20rpx; | |
| 2863 | + border-radius: 8rpx; | |
| 2864 | + background: #ffdcdc; | |
| 2865 | + overflow: hidden; | |
| 2866 | + /* background: #ffdcdc url(https://mshopimg.yolipai.net/miniapp/images/fwk/crown_bg.png) no-repeat left top; | |
| 2867 | + background-position: 10rpx 10rpx; | |
| 2868 | + background-size: 206rpx 136rpx; */ | |
| 2869 | +} | |
| 2870 | + | |
| 2871 | +.card::before { | |
| 2872 | + position: absolute; | |
| 2873 | + font-family: iconfont; | |
| 2874 | + content: '\e630'; | |
| 2875 | + color: rgba(255,0,0,.1); | |
| 2876 | + font-size: 260rpx; | |
| 2877 | + /* transform: rotateZ(45deg); */ | |
| 2878 | + top: -110rpx; | |
| 2879 | + left: -70rpx; | |
| 2880 | +} | |
| 2881 | + | |
| 2882 | +.rmb::before { | |
| 2883 | + content: '¥'; | |
| 2884 | + font-size: 24rpx; | |
| 2885 | +} | |
| 2886 | + | |
| 2887 | +.c-red { | |
| 2888 | + color: #f23030; | |
| 2889 | +} | |
| 2890 | + | |
| 2891 | +.btn-group { | |
| 2892 | + border-radius: 70rpx; | |
| 2893 | + overflow: hidden; | |
| 2894 | + margin-right: 10rpx; | |
| 2895 | +} | ... | ... |