diff --git a/app.json b/app.json index 9adcee3..7ba0a7f 100644 --- a/app.json +++ b/app.json @@ -91,44 +91,45 @@ "pages/quan_pro/quan_pro", "pages/liveStream/liveStream", "pages/liveStreamDetails/liveStreamDetails", - "pages/addCustomer/addCustomer", - "pages/goods_share/goods_share", - "pages/activity_share/activity_share", - "pages/live_share/live_share", - "pages/quan/quan", - "pages/chongzhi/chongzhi", - "pages/chongzhiDetails/chongzhiDetails", - "pages/jfbuy/jfbuy", - "pages/hongBao/hongBao", - "pages/hongBaoDetails/hongBaoDetails", - "pages/service_record/service_record", - "pages/checkin/checkin", - "pages/distribution/myteam/myteam", - "pages/distribution/order/order", - "pages/distribution/commision/commision", - "pages/distribution/rank/rank", - "pages/distribution/card/card", - "pages/distribution/goods/goods", - "pages/distribution/shop/shop", - "pages/distribution/rookie/rookie", - "pages/service_share/service_share", - "pages/cardList/cardList", - "pages/goodsInfo/goodsInfo", - "pages/my_service/appment_main", - "pages/my_service/i_service", - "pages/my_service/cosmetology_list", - "pages/my_service/hist_service", - "pages/my_service/tment_details", - "pages/my_service/tment_eval", - "pages/my_service/tment_order_list", - "pages/my_service/beauty_deta", - "pages/my_service2/appment_main", - "pages/profile/profile", - "pages/parseHtml/parseHtml", - "pages/myGift/myGift", - "pages/myGiftDetails/myGiftDetails", - "pages/cart2_ser/cart2_ser", - "pages/libao_payment/payment" + "pages/addCustomer/addCustomer", + "pages/goods_share/goods_share", + "pages/activity_share/activity_share", + "pages/live_share/live_share", + "pages/quan/quan", + "pages/chongzhi/chongzhi", + "pages/chongzhiDetails/chongzhiDetails", + "pages/jfbuy/jfbuy", + "pages/hongBao/hongBao", + "pages/hongBaoDetails/hongBaoDetails", + "pages/service_record/service_record", + "pages/checkin/checkin", + "pages/distribution/myteam/myteam", + "pages/distribution/order/order", + "pages/distribution/commision/commision", + "pages/distribution/rank/rank", + "pages/distribution/card/card", + "pages/distribution/goods/goods", + "pages/distribution/shop/shop", + "pages/distribution/rookie/rookie", + "pages/service_share/service_share", + "pages/cardList/cardList", + "pages/goodsInfo/goodsInfo", + "pages/my_service/appment_main", + "pages/my_service/i_service", + "pages/my_service/cosmetology_list", + "pages/my_service/hist_service", + "pages/my_service/tment_details", + "pages/my_service/tment_eval", + "pages/my_service/tment_order_list", + "pages/my_service/beauty_deta", + "pages/my_service2/appment_main", + "pages/profile/profile", + "pages/parseHtml/parseHtml", + "pages/myGift/myGift", + "pages/myGiftDetails/myGiftDetails", + "pages/cart2_ser/cart2_ser", + "pages/libao_payment/payment", + "pages/details_serviceCard/details_serviceCard" ] }, @@ -151,7 +152,9 @@ "pages/zuhegou/list/list", "pages/user/binding_info/binding_info", "pages/user/choice_guide/choice_guide", - "pages/video/index" + "pages/video/index", + "pages/boxes-list/boxes-list", + "pages/boxes-details/boxes-details" ] }, { diff --git a/app.wxss b/app.wxss index 0807496..b593c38 100644 --- a/app.wxss +++ b/app.wxss @@ -135,6 +135,7 @@ box-sizing: border-box; } + .c-green { color: #7CFC00; } @@ -159,6 +160,14 @@ color: #c7c7c7; } +.c-6 { + color: #666; +} + +.c-9 { + color: #999; +} + .c-d { @@ -232,6 +241,11 @@ margin-top: 30rpx; } +.mgt40 { + margin-top: 40rpx; +} + + .h68 { height: 68rpx; } @@ -729,9 +743,9 @@ background: #ffe3e2; /* 图标字体(ty) */ @font-face { font-family: 'iconfont'; /* Project id 2054717 */ - src: url('//at.alicdn.com/t/font_2054717_kwrwze5y6c.woff2?t=1635844276600') format('woff2'), - url('//at.alicdn.com/t/font_2054717_kwrwze5y6c.woff?t=1635844276600') format('woff'), - url('//at.alicdn.com/t/font_2054717_kwrwze5y6c.ttf?t=1635844276600') format('truetype'); + src: url('//at.alicdn.com/t/font_2054717_y42sikta7lc.woff2?t=1642407649188') format('woff2'), + url('//at.alicdn.com/t/font_2054717_y42sikta7lc.woff?t=1642407649188') format('woff'), + url('//at.alicdn.com/t/font_2054717_y42sikta7lc.ttf?t=1642407649188') format('truetype'); } .iconfont { @@ -742,6 +756,18 @@ background: #ffe3e2; -moz-osx-font-smoothing: grayscale; } +.icon-shangpin:before { + content: "\e661"; +} + +.icon-bankcard:before { + content: "\e693"; +} + +.icon-tongbu:before { + content: "\e6ca"; +} + .icon-luck:before { content: "\e621"; } diff --git a/components/diy_serviceCard/diy_serviceCard.js b/components/diy_serviceCard/diy_serviceCard.js index cf3ce1b..5d74dd5 100644 --- a/components/diy_serviceCard/diy_serviceCard.js +++ b/components/diy_serviceCard/diy_serviceCard.js @@ -1,582 +1,646 @@ var t = getApp(), - a = t.request, - o = t.globalData.setting, - os = o, - i = require("../../utils/util.js"), - ut = i, - s = require("../../utils/common.js"); + a = t.request, + o = t.globalData.setting, + os = o, + i = require("../../utils/util.js"), + ut = i, + s = require("../../utils/common.js"); var regeneratorRuntime = require('../../utils/runtime.js'); Component({ options: { addGlobalClass: true, }, - properties: { - // 这里定义了innerText属性,属性值可以在组件使用时指定 - object: { - type: Object, - value: null, - }, - - }, - data: { - // 这里是一些组件内部数据 - group: false, - imghost: o.imghost, - is_recommend: 0, - is_hot: 0, - is_new: 0, - baseUrl: "/api/weshop/goods/page", - resourceUrl: t.globalData.setting.resourceUrl, - url: t.globalData.setting.imghost, - currentPage: 1, - requestData: null, - requestUrl: "", - goods_array: null, - total: null, - prom_id: 0, - classstyle_id: null, - g_id: null, - wgroup: null, - goods_btn: null, - loadText: '加载更多', - someData: {}, - goodscount: null, - firist_type_data: null, - firist_type_curr: 0, - is_nav:0, - nav_list:null, - title_index:0, - swiper_hei:0, - title_class:"", - }, - - ready: function () {}, - - lifetimes: { - attached: function() { - - - //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 - var nav_item=this.data.object; - var nav_list= this.data.object.nav_list; - - if(parseInt(nav_item.is_automore)){ - if(!getApp().globalData.func_list) getApp().globalData.func_list=[]; - getApp().globalData.func_list.push(this); - } - - - //最新的版本才有nav_list - if(nav_list){ - nav_item=nav_list[0]; - //要算一下商品goodsid - for(var ij in nav_list){ - var item=nav_list[ij]; - var idlist=""; - //如果商品有手动选择的时候 - if(item.data && item.data.length>0){ - for(var im in item.data){ - idlist+= item.data[im]+","; - } - } - if(idlist) idlist=ut.sub_last(idlist); - nav_list[ij].idlist=idlist; - } - this.setData({nav_list:nav_list,is_nav:parseInt(this.data.object.is_nav)}); - } - - // 在组件实例进入页面节点树时执行 - if(nav_item) { - this.data.classstyle_id = nav_item.classstyle; - this.data.wgroup =nav_item.wgroup; - } - - this.data.goodscount = this.data.object.goodscount; - - - var hei=280; - if(this.data.object.goodstit) hei+=80; - if(this.data.object.goodsprice) hei+=80; - if(this.data.object.goodsnum) hei+=80; - - if(this.data.object.title_color){ - this.data.title_class=`color:${this.data.object.title_color};` - } + properties: { + // 这里定义了innerText属性,属性值可以在组件使用时指定 + object: { + type: Object, + value: null, + }, - if(this.data.object.title_font_size){ - this.data.title_class=this.data.title_class.concat(`font-size:${this.data.object.title_font_size}px;`) - } - this.setData({ - swiper_hei:hei, - title_class:this.data.title_class, - }); - - if (nav_item && nav_item.goodsclass == 1) { - this.data.is_recommend = 1 - } - if (nav_item && nav_item.goodsclass == 2) { - this.data.is_hot = 1 - } - if (nav_item && nav_item.goodsclass == 3) { - this.data.is_new = 1 - } - - this.data.requestData = new Array(); - this.data.g_id = nav_item.data; - var arr = []; - - for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { - arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); - } - this.data.firist_type_data = arr; - this.init(this.data.classstyle_id, this.data.wgroup); - }, - detached: function() { - // 在组件实例被从页面节点树移除时执行 - }, - }, - - pageLifetimes: { - //游客登录后,只要更新卡的情况 - show: function () { - //--初始化卡类-- - this.card_init(); - }, - }, - - methods: { - // 这里是一个自定义方法 - init:async function (classstyle_id, wgroup) { - - this.setData({classstyle_id:classstyle_id}) - - var th = this; - var g_id = this.data.g_id; - var len=this.data.firist_type_data.length; - if (classstyle_id == 1) { - //---手动选择的时候--- - g_id = this.data.firist_type_data[th.data.firist_type_curr]; - th.data.firist_type_curr++; - } - - var th = this, - app = getApp(), - index = 0, - gdata = []; - - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; - - //--初始化卡类-- - th.card_init(); - var os=getApp().globalData.setting; - classstyle_id = classstyle_id + ""; - switch (classstyle_id) { - //---手动选择商品--- - case "1": - var str=""; - for (var i = 0; i < g_id.length; i++) { - str += g_id[i].goodsid + ","; - } - str=str.substring(0, str.length - 1); - - await app.request.get("/api/weshop/goods/getgoodslistOrdby?store_id=" + os.stoid + "&goodsidlist=" + str, { - data:{user_id:user_id}, - isShowLoading:false, - success: function(res) { - th.data.loading=0; - - if(res.data.code==0 && res.data.data){ - - var goods = res.data.data; - /*-- - var rData = th.data.requestData; - if (rData == null) rData=[]; - var now=ut.gettimestamp(); - - var new_arr=[]; - for (var ii in res.data.data){ - var item=res.data.data[ii]; - item.goods_img=th.data.imghost + item.original_img; - if(item.e_timenow) {item.prom_type=0; item.prom_price=0;} - new_arr.push(item); - } - rData = rData.concat(new_arr); - - th.data.requestData = rData; - - if(th.data.object.column==5){ - var arr = new Array(); - //--三个三个一组--- - for(var i=0;i< rData.length;i+=3){ - arr.push(rData.slice(i,i+3)); - } - th.setData({ goods_array: arr }); - }else{ - th.setData({ goods_array: rData }); - }--*/ - - th.set_good(goods); - - //---控制有没有加载更多的按钮--- - if (th.data.firist_type_curr >= len) {th.setData({ goods_btn: [] }); } - else th.setData({ goods_btn: [1,2]}); + }, + data: { + // 这里是一些组件内部数据 + group: false, + imghost: o.imghost, + is_recommend: 0, + is_hot: 0, + is_new: 0, + baseUrl: "/api/weshop/goods/page", + resourceUrl: t.globalData.setting.resourceUrl, + url: t.globalData.setting.imghost, + currentPage: 1, + requestData: null, + requestUrl: "", + goods_array: null, + total: null, + prom_id: 0, + classstyle_id: null, + g_id: null, + wgroup: null, + goods_btn: null, + loadText: '加载更多', + someData: {}, + goodscount: null, + firist_type_data: null, + firist_type_curr: 0, + is_nav: 0, + nav_list: null, + title_index: 0, + swiper_hei: 0, + title_class: "", + }, + + ready: function() {}, + + lifetimes: { + attached: function() { + let myStyle = ''; + //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 + var nav_item = this.data.object; + var nav_list = this.data.object.nav_list; + + if (parseInt(nav_item.is_automore)) { + if (!getApp().globalData.func_list) getApp().globalData.func_list = []; + getApp().globalData.func_list.push(this); + } + + + //最新的版本才有nav_list + if (nav_list) { + nav_item = nav_list[0]; + //要算一下商品goodsid + for (var ij in nav_list) { + var item = nav_list[ij]; + var idlist = ""; + //如果商品有手动选择的时候 + if (item.data && item.data.length > 0) { + for (var im in item.data) { + idlist += item.data[im] + ","; + } } + if (idlist) idlist = ut.sub_last(idlist); + nav_list[ij].idlist = idlist; } - - }) - - break; - case "2": - var item = {}; - var r_data={ - store_id: os.stoid , - pageSize: th.data.goodscount, - page: th.data.currentPage, - isonsale: 1, - orderField: "sort", - orderType: 'asc', - }; - if(th.data.is_recommend) r_data.is_recommend=th.data.is_recommend; - if(th.data.is_hot) r_data.is_hot=th.data.is_hot; - if(th.data.is_new) r_data.is_new=th.data.is_new; - - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; - r_data.user_id=user_id; - - await app.request.promiseGet("/api/weshop/goods/page", { - data:r_data - }).then(res => { - th.data.loading=0; - //商品地址 - var goods = res.data.data.pageData; - th.setData({ - goods_btn: res.data.data.pageData, - total: res.data.data.total - }) - th.data.currentPage++; - //设置商品熏染 - th.set_good(goods); - - }) - break; - case "3": - var item = {}; - await app.request.promiseGet("/api/weshop/goodsGroup/pageGoodsList", { - data: { - store_id:os.stoid , - gpid: wgroup, - pageSize: th.data.goodscount, - page: th.data.currentPage, - isonsale: 1, - orderField: "sort", - orderType: 'asc', - user_id:user_id - } - }).then(res => { - th.data.loading=0; - //商品地址 - var goods = res.data.data.pageData; - th.setData({ - goods_btn: res.data.data.pageData, total: res.data.data.total - }) - - th.data.currentPage++; - //设置商品熏染 - th.set_good(goods); - - }) - break; - } - }, - - setLoading: function () { - var that = this; - if(this.data.loading) return false; - this.data.loading=1; - that.init(that.data.classstyle_id, that.data.wgroup); - }, - - //图片失败,默认图片 - bind_bnerr3: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = this.data.imghost + "/public/images/default_goods_image_240.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - }, - - //---卡的初始化---- - card_init: function() { - var th = this,os=getApp().globalData.setting; - if(!getApp().globalData.user_id) return false; - getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { - isShowLoading:false, - success: function(e) { - getApp().globalData.userInfo = e.data.data; - getApp().getConfig2(function(e) { - var swithc_list = e.switch_list; - var sw_arr = JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - th.setData({ - rank_switch: true - }); - //---回调卡的列表--- - th.getPlusCardType(function(ob) { - th.setData({ - card_list: ob.card_list - }); - var ti = setInterval(function() { - var user = getApp().globalData.userInfo; - if (!user) return false; - clearInterval(ti); - - if (user.card_field && user['card_expiredate']) { - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - - //--- 判断是等级会员,且在有效期范围内 --- - if (user.card_field && now < end) { - var card_name = ob.name_map.get(user.card_field); - if (card_name.length > 4) card_name = card_name.substring(0, 4); - th.setData({ - card_field: user.card_field, - card_name: card_name, - card_list: ob.card_list - }); - } - - } - - }, 500) - }) - - } - }) - } - }) - - }, - - //--- 获取卡类列表 --- - getPlusCardType: function(func) { - var storid = o.stoid; - var th = this; - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - var plusCard = res.data.data; - var arr = [1219, 2089, 3031]; - var new_arr = new Array(); - var card_name_map = new Map(); - - var user = getApp().globalData.userInfo; - - if(plusCard) { - - for (var i = 0; i < plusCard.length; i++) { - if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { - continue; - } - - var name = "card" + plusCard[i].CorrPrice.toLowerCase(); - card_name_map.set(name, plusCard[i].CardName); - new_arr.push(plusCard[i]); + this.setData({ + nav_list: nav_list, + is_nav: parseInt(this.data.object.is_nav) + }); + } + + // 在组件实例进入页面节点树时执行 + if (nav_item) { + this.data.classstyle_id = nav_item.classstyle; + this.data.wgroup = nav_item.wgroup; + } + + this.data.goodscount = this.data.object.goodscount; + + + var hei = 280; + if (this.data.object.goodstit) hei += 80; + if (this.data.object.goodsprice) hei += 80; + if (this.data.object.goodsnum) hei += 80; + + if (this.data.object.title_color) { + // this.data.title_class = `color:${this.data.object.title_color};` + } + + if (this.data.object.font_size) { + this.data.title_class = this.data.title_class.concat(`font-size:${this.data.object.font_size}px;`); + } + + if (this.data.object.font_color) { + this.data.title_class = this.data.title_class.concat(`color:${this.data.object.font_color};`); + } + + if (this.data.object.acitve_font_color) { + this.setData({ + myStyle: ` + --border-color:${this.data.object.acitve_font_color}; + --font-color:${this.data.object.acitve_font_color}; + `, + }); + } + + if (this.data.object.list_border_type == 0) { + this.data.title_class = this.data.title_class.concat('border-radius: 80rpx;'); + } + + if (this.data.object.list_border_type == 1) { + this.data.title_class = this.data.title_class.concat('border-radius: 0;'); + } + + if (this.data.object.list_border_type == 2) { + this.data.title_class = this.data.title_class.concat('border-width: 0;'); + } + + + + this.setData({ + swiper_hei: hei, + title_class: this.data.title_class, + }); + + if (nav_item && nav_item.goodsclass == 1) { + this.data.is_recommend = 1 + } + if (nav_item && nav_item.goodsclass == 2) { + this.data.is_hot = 1 + } + if (nav_item && nav_item.goodsclass == 3) { + this.data.is_new = 1 } - } - - var ob = { - "card_list": new_arr, - "name_map": card_name_map - }; - func(ob); - }) + + this.data.requestData = new Array(); + this.data.g_id = nav_item.data; + var arr = []; + + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { + arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); + } + this.data.firist_type_data = arr; + this.init(this.data.classstyle_id, this.data.wgroup); + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + }, }, - - //--- 点击tab的事件 --- - gr_set_nav:function(e){ - - var title_idx=e.currentTarget.dataset.index; - if(title_idx==this.data.title_index) return false; - wx.showLoading(); - - var nav_item=this.data.object.nav_list[title_idx]; - this.data.g_id =[]; - if(this.data.object.nav_list && this.data.object.nav_list[title_idx] && this.data.object.nav_list[title_idx].data) - this.data.g_id=this.data.object.nav_list[title_idx].data; - var arr = []; - for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { - arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); - } - this.data.firist_type_data = arr; - this.data.firist_type_curr=0; - this.data.requestData=[]; - - // 在组件实例进入页面节点树时执行 - if(nav_item){ - this.data.classstyle_id = nav_item.classstyle; - this.data.wgroup =nav_item.wgroup; - } - - - this.data.is_recommend = this.data.is_hot=this.data.is_new=0; - //推荐,热卖,新品 - if (nav_item && nav_item.goodsclass == 1) { - this.data.is_recommend = 1 - } - if (nav_item && nav_item.goodsclass == 2) { - this.data.is_hot = 1 - } - if (nav_item && nav_item.goodsclass == 3) { - this.data.is_new = 1 - } - - - this.data.currentPage=1; - this.setData({goods_array:null,total:null,title_index:title_idx}); - //初始化 - this.init(this.data.classstyle_id, this.data.wgroup); - setTimeout(function(){ wx.hideLoading();},1000) + + pageLifetimes: { + //游客登录后,只要更新卡的情况 + show: function() { + //--初始化卡类-- + // this.card_init(); + }, }, - //--- 设置 --- - set_good:async function(goods){ - var now=ut.gettimestamp(); - var th=this; - if(!goods || goods.length==0) return false; - var user_id=getApp().globalData.userInfo.user_id; - if(!user_id) user_id=0; - for(var i in goods){ - var val=goods[i]; - var item = {}; - var prom_id = null; - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { - - var url="/api/weshop/activitylist/getGoodActInfo"; - var req_data={ - store_id:os.stoid,goodsidlist:val.goods_id,is_detail:1,user_id:user_id - }; - - //获取商品的实际活动 - await getApp().request.promiseGet(url, {data:req_data}).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.length==1){ - item.prom_type=res.data.data[0].prom_type; - item.prom_id=res.data.data[0].act_id; - } - }) - - item.goods_name = val.goods_name; - item.goods_img = th.data.imghost + val.original_img; - item.market_price = val.market_price; - item.shop_price = val.shop_price; - item.sales_sum = val.sales_sum; - item.goods_id = val.goods_id; - - item.cardprice1 = val.cardprice1; - item.cardprice2 = val.cardprice2; - item.cardprice3 = val.cardprice3; - item.prom_type = val.prom_type; - item.prom_id = val.prom_id; - - if(val.prom_price) item.prom_price = val.prom_price; - if(val.prom_integral) item.prom_integral = val.prom_integral; - - prom_id = val.prom_id; - - var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 - - var url = ""; - - switch (prom_type){ - case 1: - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; - url = "/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id; - break; - case 2: - url ="/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +val.goods_id+"/"+ prom_id - break; - case 4: - url ="/api/weshop/integralbuy/get/"+os.stoid +"/"+prom_id; - break; - case 6: - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - break; - case 8: - var presell_id = prom_id; - var url1 = "/api/weshop/marketing/marketingPresellList/list"; - var rd= { - store_id: os.stoid, - presell_id: presell_id, - goods_id: val.goods_id - } - //------获取预售从表---------- - await getApp().request.promiseGet(url1, { - data: rd - }).then(res => { - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { - var arr = res.data.data[0]; - item.prom_price = arr.luck_goods_price; - item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); - } - }) - break; - default: - break - } - - if(url!=null && url!=''){ - await getApp().request.promiseGet(url, {}).then(res => { - var prom =null; - if(res && res.data) prom=res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time { + th.data.loading = 0; + //商品地址 + var goods = res.data.data.pageData; + th.setData({ + goods_btn: res.data.data.pageData, + total: res.data.data.total + }) + th.data.currentPage++; + //设置商品熏染 + th.set_good(goods); + + }) + break; + case "3": + var item = {}; + await app.request.promiseGet("/api/weshop/goodsGroup/pageGoodsList", { + data: { + store_id: os.stoid, + gpid: wgroup, + pageSize: th.data.goodscount, + page: th.data.currentPage, + isonsale: 1, + orderField: "sort", + orderType: 'asc', + user_id: user_id + } + }).then(res => { + th.data.loading = 0; + //商品地址 + var goods = res.data.data.pageData; + th.setData({ + goods_btn: res.data.data.pageData, + total: res.data.data.total + }) + + th.data.currentPage++; + //设置商品熏染 + th.set_good(goods); + + }) + break; } - } - - if(th.data.object.column==5){ - var arr = new Array(); - var rData=th.data.requestData; - //--三个三个一组--- - for(var i=0;i< rData.length;i+=3){ - arr.push(rData.slice(i,i+3)); - } - th.setData({ goods_array: arr,page: th.data.currentPage - 1, }); - }else{ - th.setData({ - goods_array: th.data.requestData, - page: th.data.currentPage - 1, + + }, + + setLoading: function() { + var that = this; + if (this.data.loading) return false; + this.data.loading = 1; + that.init(that.data.classstyle_id, that.data.wgroup); + }, + + //图片失败,默认图片 + bind_bnerr3: function(e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.imghost + "/public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + //---卡的初始化---- + card_init: function() { + // var th = this, + // os = getApp().globalData.setting; + // if (!getApp().globalData.user_id) return false; + // getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + // isShowLoading: false, + // success: function(e) { + // getApp().globalData.userInfo = e.data.data; + // getApp().getConfig2(function(e) { + // var swithc_list = e.switch_list; + // var sw_arr = JSON.parse(swithc_list); + // //---如果后台又开等级卡的开关--- + // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + // th.setData({ + // rank_switch: true + // }); + // //---回调卡的列表--- + // th.getPlusCardType(function(ob) { + // th.setData({ + // card_list: ob.card_list + // }); + // var ti = setInterval(function() { + // var user = getApp().globalData.userInfo; + // if (!user) return false; + // clearInterval(ti); + + // if (user.card_field && user['card_expiredate']) { + // var str = user['card_expiredate'].replace(/-/g, '/'); + // var end = new Date(str); + // end = Date.parse(end) / 1000; + // var now = ut.gettimestamp(); + + // //--- 判断是等级会员,且在有效期范围内 --- + // if (user.card_field && now < end) { + // var card_name = ob.name_map.get(user.card_field); + // if (card_name.length > 4) card_name = card_name.substring(0, 4); + // th.setData({ + // card_field: user.card_field, + // card_name: card_name, + // card_list: ob.card_list + // }); + // } + + // } + + // }, 500) + // }) + + // } + // }) + // } + // }) + + }, + + //--- 获取卡类列表 --- + getPlusCardType: function(func) { + // var storid = o.stoid; + // var th = this; + // getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { + // var plusCard = res.data.data; + // var arr = [1219, 2089, 3031]; + // var new_arr = new Array(); + // var card_name_map = new Map(); + + // var user = getApp().globalData.userInfo; + + // if (plusCard) { + + // for (var i = 0; i < plusCard.length; i++) { + // if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { + // continue; + // } + + // var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + // card_name_map.set(name, plusCard[i].CardName); + // new_arr.push(plusCard[i]); + // } + // } + + // var ob = { + // "card_list": new_arr, + // "name_map": card_name_map + // }; + // func(ob); + // }) + }, + + + //--- 点击tab的事件 --- + gr_set_nav: function(e) { + + var title_idx = e.currentTarget.dataset.index; + if (title_idx == this.data.title_index) return false; + wx.showLoading(); + + var nav_item = this.data.object.nav_list[title_idx]; + this.data.g_id = []; + if (this.data.object.nav_list && this.data.object.nav_list[title_idx] && this.data.object.nav_list[title_idx].data) + this.data.g_id = this.data.object.nav_list[title_idx].data; + var arr = []; + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { + // for (var i = 0; i < this.data.g_id.length; i ++) { + arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); + } + this.data.firist_type_data = arr; + this.data.firist_type_curr = 0; + this.data.requestData = []; + + // 在组件实例进入页面节点树时执行 + if (nav_item) { + this.data.classstyle_id = nav_item.classstyle; + this.data.wgroup = nav_item.wgroup; + } + + + this.data.is_recommend = this.data.is_hot = this.data.is_new = 0; + //推荐,热卖,新品 + if (nav_item && nav_item.goodsclass == 1) { + this.data.is_recommend = 1 + } + if (nav_item && nav_item.goodsclass == 2) { + this.data.is_hot = 1 + } + if (nav_item && nav_item.goodsclass == 3) { + this.data.is_new = 1 + } + + + this.data.currentPage = 1; + this.setData({ + goods_array: null, + total: null, + title_index: title_idx }); + //初始化 + this.init(this.data.classstyle_id, this.data.wgroup); + setTimeout(function() { + wx.hideLoading(); + }, 1000) + }, + + //--- 设置 --- + set_good: async function(goods) { + var now = ut.gettimestamp(); + var th = this; + if (!goods || goods.length == 0) return false; + var user_id = getApp().globalData.userInfo.user_id; + if (!user_id) user_id = 0; + for (var i in goods) { + var val = goods[i]; + var item = {}; + var prom_id = null; + //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { + + // var url = "/api/weshop/activitylist/getGoodActInfo"; + // var req_data = { + // store_id: os.stoid, + // goodsidlist: val.goods_id, + // is_detail: 1, + // user_id: user_id + // }; + + //获取商品的实际活动 + // await getApp().request.promiseGet(url, { + // data: req_data + // }).then(res => { + // if (res.data.code == 0 && res.data.data && res.data.data.length == 1) { + // item.prom_type = res.data.data[0].prom_type; + // item.prom_id = res.data.data[0].act_id; + // } + // }) + // console.log('val++++++<<<<<', val); + item.goods_name = val.serviceName; + item.goods_img = th.data.imghost + val.imgUrl; + item.market_price = val.show_price; + item.shop_price = val.money; + item.sales_sum = val.sales_sum; + item.goods_id = val.id; + + // item.cardprice1 = val.cardprice1; + // item.cardprice2 = val.cardprice2; + // item.cardprice3 = val.cardprice3; + // item.prom_type = val.prom_type; + // item.prom_id = val.prom_id; + + if (val.prom_price) item.prom_price = val.prom_price; + if (val.prom_integral) item.prom_integral = val.prom_integral; + + prom_id = val.prom_id; + + var prom_type = val.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 + + var url = ""; + + // switch (prom_type) { + // case 1: + // var user_id = getApp().globalData.user_id; + // if (!user_id) user_id = 0; + // url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id; + // break; + // case 2: + // url = "/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + val.goods_id + "/" + prom_id + // break; + // case 4: + // url = "/api/weshop/integralbuy/get/" + os.stoid + "/" + prom_id; + // break; + // case 6: + // url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; + // break; + // case 8: + // var presell_id = prom_id; + // var url1 = "/api/weshop/marketing/marketingPresellList/list"; + // var rd = { + // store_id: os.stoid, + // presell_id: presell_id, + // goods_id: val.goods_id + // } + // //------获取预售从表---------- + // await getApp().request.promiseGet(url1, { + // data: rd + // }).then(res => { + // if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { + // var arr = res.data.data[0]; + // item.prom_price = arr.luck_goods_price; + // item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0); + // } + // }) + // break; + // default: + // break + // } + + if (url != null && url != '') { + await getApp().request.promiseGet(url, {}).then(res => { + var prom = null; + if (res && res.data) prom = res.data.data; + if (prom != null && prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom.show_time && + prom.show_time < now))) { + item.prom_price = res.data.data.price; + if (res.data.data.user_price) item.prom_price = res.data.data.user_price; + var vNum = res.data.data.virtual_num ? res.data.data.virtual_num : 0; + var vNum1 = res.data.data.virtualNum ? res.data.data.virtualNum : 0; + var vNum2 = res.data.data.virtual ? res.data.data.virtual : 0; + item.sales_sum = res.data.data.buy_num + (vNum + vNum1 + vNum2); + } else { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; + } + + th.data.requestData.push(item); + }) + } else { + th.data.requestData.push(item); + } + } + + if (th.data.object.column == 5) { + var arr = new Array(); + var rData = th.data.requestData; + //--三个三个一组--- + for (var i = 0; i < rData.length; i += 3) { + arr.push(rData.slice(i, i + 3)); + } + th.setData({ + goods_array: arr, + page: th.data.currentPage - 1, + }); + } else { + th.setData({ + goods_array: th.data.requestData, + page: th.data.currentPage - 1, + }); + } + + + // console.log('goods_array0000000000====>>>', th.data.goods_array); + + }, + + re_show: function() { + if (this.data.object.goodscount * this.data.page < this.data.total) { + this.setLoading() + } } - - }, - re_show:function () { - if(this.data.object.goodscount *this.data.page --> - - - 标题1 - 标题标题2 - 标题3 - 标题标题标题4 - 标题5 - 标题6 - 标题题7 - 标题8 - 标题题9 - 标题10 - 标题11 - 标题12222 + + + + {{item.title}} - + - - + + - + @@ -68,7 +65,8 @@ - {{item.goods_name}} + + {{item.goods_name}} @@ -190,7 +188,7 @@ - + @@ -352,7 +350,7 @@ - + @@ -511,7 +509,7 @@ - + @@ -694,7 +692,7 @@ - + diff --git a/components/diy_serviceCard/diy_serviceCard.wxss b/components/diy_serviceCard/diy_serviceCard.wxss index 3b53fcb..3efe07d 100644 --- a/components/diy_serviceCard/diy_serviceCard.wxss +++ b/components/diy_serviceCard/diy_serviceCard.wxss @@ -1,4 +1,7 @@ /* pages/diy_zs/diy_zs.wxss */ +:root { + +} .zwp_3 { margin-top: 10rpx; @@ -104,7 +107,7 @@ width: 56rpx; height: 56rpx; position: absolute; - left: 0rpx; + left: 10rpx; top: 10rpx; } @@ -112,7 +115,7 @@ width: 56rpx; height: 56rpx; position: absolute; - right: 0rpx; + right: 10rpx; top: 10rpx; } @@ -120,7 +123,7 @@ width: 56rpx; height: 56rpx; position: absolute; - left: 0rpx; + left: 10rpx; bottom: 10rpx; } @@ -128,7 +131,7 @@ width: 56rpx; height: 56rpx; position: absolute; - right: 20rpx; + right: 10rpx; bottom: 10rpx; } @@ -237,11 +240,12 @@ } .zs_t1_x { + position: absolute; width: 56rpx; height: 56rpx; - position: relative; - right: 62rpx; - top: 6rpx; + /* position: relative; */ + right: 10rpx; + top: 10rpx; } .zs_t1_x1 { @@ -254,19 +258,21 @@ } .zs_t1_x2 { + position: absolute; width: 56rpx; height: 56rpx; - position: relative; - right: 56rpx; - top: 0rpx; + /* position: relative; */ + right: 10rpx; + top: 10rpx; } .zs_t1_x3 { + position: absolute; width: 56rpx; height: 56rpx; - position: relative; - right: 288rpx; - top: 234rpx; + /* position: relative; */ + left: 10rpx; + bottom: 10rpx; } /*1列2个*/ @@ -906,17 +912,22 @@ top: 10rpx; .scroll-view-item { flex-shrink: 0; - border: 2rpx solid #ddd; + border-width: 2rpx; + border-style: solid; + border-color: #ddd; border-radius: 80rpx; - padding: 10rpx 20rpx; + padding: 10rpx 30rpx; margin: 20rpx 10rpx; /* font-size: 28rpx; */ box-sizing: border-box; + text-align: center; + /* flex: 1; */ + flex-grow: 1; } .scroll-view-item.active { - color: red; - border-color: red; + color: var(--font-color) !important; + border-color: var(--border-color) !important; } @@ -925,7 +936,7 @@ top: 10rpx; padding-top: 20rpx; padding-left: 10rpx; padding-right: 10rpx; - flex: 1; + /* flex: 1; */ flex-basis: 50%; } diff --git a/components/serviceCard_list/g_filter.wxs b/components/serviceCard_list/g_filter.wxs new file mode 100644 index 0000000..3155059 --- /dev/null +++ b/components/serviceCard_list/g_filter.wxs @@ -0,0 +1,85 @@ +var g_filters = { + //-- 判断是不是有等级价 -- + is_has_rank:function(rank_switch,item){ + if(!rank_switch) return false; + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} + return false; + }, + + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price:function(goods,all_card,type){ + var price1=parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if(!all_card){ + if(type==0) return 0; + return ""; + } + + var min_price=null; + var min_name=null; + //---设置对应的价格名字---- + for(var i=0;i<3;i++) { + var vl=all_card[i]; + if(!vl) continue; + + if(vl['CorrPrice']=="Price1" && price1>0) + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 8); + return min_name; + }, + + get_url_by_type: function(item) { + var url = ''; + if(item.prom_type == 9) { + url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + item.goods_id + '&group_id=' + item.prom_id; + } + else if(item.prom_type==8){ + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id + } + else { + url = '/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id + '&prom_id=' + item.prom_id + '&prom_type=' + item.prom_type; + }; + return url; + }, + +} +module.exports = { + is_has_rank:g_filters.is_has_rank, + get_card_price:g_filters.get_card_price, + get_url_by_type:g_filters.get_url_by_type, +} \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.js b/components/serviceCard_list/serviceCard_list.js new file mode 100644 index 0000000..d642be6 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.js @@ -0,0 +1,226 @@ +var t = getApp(), + a = t.request, + o = t.globalData.setting, + os = o, + i = require("../../utils/util.js"), + ut = i, + s = require("../../utils/common.js"); +Component({ + data: { + url: o.imghost, + object: null, + curPage: 1, + is_no_more: 1, //加载完所有数据的控制器 + load_complete: 0, //加载完成, + rank_switch: false, + card_field: "", + card_name: "", + max_card_field: "", + card_list: null + }, + properties: { + // 这⾥定义了innerText属性,属性值可以在组件使⽤时指定 + }, + ready: function () {}, + pageLifetimes: { + //要处理一下,游客登录后的界面的变化,主要还该是改变会员 + show: function () { + console.log('page-show'); + this.init(); + if(getApp().globalData.login_back==1){ + getApp().globalData.login_back==0; + this.data.curPage=1; + this.setData({ recommend: [] }); + this.get_list(); + } + } + }, + + methods: { + init: function () { + var th = this; + if (!getApp().globalData.user_id) return false; + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + isShowLoading: false, + success: function (e) { + if (e.data.code == 0 && e.data && e.data.data) { + getApp().globalData.userInfo = e.data.data; + getApp().getConfig2(function (e) { + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台有开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ + rank_switch: true + }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ + card_list: ob.card_list + }); + var ti = setInterval(function () { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + if (card_name.length > 4) card_name = card_name.substring(0, 8); + th.setData({ + card_field: user.card_field, + card_name: card_name, + card_list: ob.card_list + }); + } + } + }, 500) + }) + } + }) + + } + + + + } + }) + }, + // get_list: function () { + // var th = this; + // var url = "http://172.20.0.233:8022/api/weshop/display"; + // wx.request({ + // url: url, + // success: function (res) { + // th.setData({ + // recommend: res.data.data.pageData + // }) + // } + // }) + // }, + get_list: function () { + var that = this; + if (that.data.is_no_more == 0) return false; + var user_id=getApp().globalData.user_id; + if(!user_id) user_id=0; + + var curPage = that.data.curPage; + + // page: curPage, + // pageSize: 6, + // orderField: "sort", + // orderType: 'asc', + // // user_id: user_id, + // // is_mainshow: 1, + // // isonsale: 1, + // // is_on_sale: 1, + // is_recommend: 1, + // store_id: o.stoid, + + getApp().request.get('/api/weshop/serviceCard/page', { + isShowLoading: false, + data: { + is_recommend: 1, + store_id: o.stoid, + }, + success: function (res) { + console.log('获取卡项推荐', res.data.data); + var data = res.data; + var total = data.data.total; + if (total <= curPage * 6) { + that.setData({ + is_no_more: 0 + }); + } else { + that.data.curPage++; + } + //加载完成 + if (data.data.pageData) { + + for(let i in data.data.pageData){ + let item=data.data.pageData[i]; + if(item.user_price) + item.prom_price=item.user_price; + } + + that.setData({ + load_complete: 1 + }); + } + if (that.data.recommend != null) { + var ra = that.data.recommend.concat(data.data.pageData); + that.setData({ + recommend: ra + }); + } else { + that.setData({ + recommend: data.data.pageData + }); + } + + console.log('卡项推荐按~~~~~~', that.data.recommend) + } + }) + }, + bind_bnerr_xc: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errurl = e.target.dataset.url; + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这⾥的赋值⽅式,只是将数据列表中的此项图⽚路径值替换掉 ; + }, + reset: function () { + curPage = 1; + }, + //--- 获取卡类列表 --- + getPlusCardType: function (func) { + var storid = o.stoid; + var th = this; + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { + + if (res.data.code != 0 || !res.data.data) { + var ob = { + "card_list": [], + "name_map": "" + }; + func(ob); + return false; + } + + var plusCard = res.data.data; + var arr = [1219, 2089, 3031]; + var new_arr = new Array(); + var card_name_map = new Map(); + + var user = getApp().globalData.userInfo; + if (plusCard) { + for (var i = 0; i < plusCard.length; i++) { + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { + continue; + } + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + new_arr.push(plusCard[i]); + + } + } + var ob = { + "card_list": new_arr, + "name_map": card_name_map + }; + func(ob); + }) + }, + + go_url:function (e) { + var url=e.currentTarget.dataset.url; + console.log('url===>>>>', url); + getApp().goto(url); + } + + }, +}) \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.json b/components/serviceCard_list/serviceCard_list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.wxml b/components/serviceCard_list/serviceCard_list.wxml new file mode 100644 index 0000000..86919ed --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.wxml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + {{item.serviceName}} + + + + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.money,2)}} + + + + + + + {{item.show_price}} + + + + + + + + + + + 没有更多内容了 + + + \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.wxss b/components/serviceCard_list/serviceCard_list.wxss new file mode 100644 index 0000000..7982238 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.wxss @@ -0,0 +1,236 @@ +.collects { + /* margin-top: 40rpx; */ + /* margin-bottom: 40rpx; */ +} + +.pdt10 { + padding-top: 10rpx; +} + +.ai-center{ + align-items: center; +} + +.ib { + display: inline-block; +} + +.fs20 { + font-size: 20rpx; +} + +.fs22 { + font-size: 22rpx; +} + +.fs24 { + font-size: 24rpx; +} + +.fs26 { + font-size: 26rpx; +} + +.fs28 { + font-size: 28rpx; +} + +.fs35 { + font-size: 35rpx; +} + +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} + +.ellipsis-1 { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +/* .ellipsis-1x { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; +} */ + +.xc-wc { + color: #d60021; +} + +.xc-ash { + color: #b9b9b9; +} + +.choice_box .choice_list .choice_footer .price { + color: #f23030; + height: 10px; +} + +.flex { + display: flex; +} + +.ellipsis-2 { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods_name { + height: 62rpx; + /* margin-top: 6rpx; */ + line-height: 1.2; + margin-bottom: 10rpx; +} + +.hang { + /* width: 100%; */ + /* margin: auto; + padding-left: 21rpx; */ + display: flex; + flex-wrap: wrap; + /* margin: 0 auto; */ + padding: 0 20rpx; + box-sizing: border-box; + /* justify-content: space-evenly; */ +} + +.hang .collect { + width: calc((100% - 20rpx) / 2); + /* height: 520rpx; */ + border-radius: 25rpx; + border: 2rpx solid #ebedf0; + overflow: hidden; + box-sizing: border-box; + margin-top: 20rpx; + /* margin-right: 14rpx; + margin-bottom: 5rpx; */ +} + +.hang .collect:nth-child(2n+1) { + margin-right: 20rpx; +} + +.collect .bottom { + padding: 20rpx; +} + +.collect .sp { + width: 100%; + height: 340rpx; + display: block; +} + +.collect .money { + /* margin-top: 28rpx; + margin-bottom: 8rpx; + line-height: 28rpx; + align-items: baseline; */ +} + +.collect .money view { + line-height: 28rpx; +} + +.collect .money .flex { + font-weight: bold; +} + +.collect .money .flex .fs24 { + padding-top: 5rpx; +} + +.collect .Discount { + width: 156rpx; + height: 28rpx; + border-radius: 20rpx; + background-color: rgb(56, 56, 56); + font-size: 18rpx; + color: rgb(255, 255, 255); +} + +.collect .Discount image { + height: 18rpx; + width: 18rpx; + line-height: 28rpx; + margin-right: 3rpx; +} + +.collect.ml20 { + margin-left: 13rpx; +} + +.fs24.dollar { + padding: 0rpx; +} + +.money .price { + margin-left: 12rpx; + text-decoration: line-through; + line-height: 23rpx; +} + +.province { + line-height: 26rpx; +} + +.nothing { + height: 75rpx; + width: 100%; +} + +.nothing .no_content { + margin: 0rpx 11rpx; + color: rgb(138, 138, 138); +} + +.nothing .Foil { + width: 80rpx; + height: 2rpx; + background-color: #ebedf0; +} + +.line_th { + text-decoration: line-through; +} + +.card_bg { + box-sizing: border-box; + padding: 2rpx 10rpx; + height: 28rpx; + border-radius: 26rpx; + font-size: 18rpx; + line-height: 28rpx; + max-width: 210rpx; + background: #333; + color: #fff; + margin-left: 8rpx; +} + +.card_bg image { + width: 19rpx; + height: 19rpx; + margin-right: 8rpx; +} + +/* .card_bg .card_name { + max-width: 76rpx; + width: auto; + overflow: hidden; + white-space: nowrap; +} */ + +.card_name { + position: relative; + top: -4rpx; +} + + diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index e229a34..ad7d3e8 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -5,13 +5,14 @@ Component({ fontcolor:'#6e6d6b', fontcolor_sele:'#f23030', backgroundColor:'#ffffff', - active:-1, list:app.def_list, cartGoodsNum:0, + active: 0, }, lifetimes: { attached: function() { + var th=this; getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ var dis=rs.data.data; @@ -51,7 +52,8 @@ Component({ var th=this; var is_read=getApp().globalData.is_read; - var custum_data=getApp().globalData.custum_data; + var custum_data=getApp().globalData.custum_data; + if(is_read){ if(custum_data){ this.set_list(custum_data); @@ -105,16 +107,33 @@ Component({ fontcolor:data.fontcolor, is_custum:1 }) - + // console.log('abc=======<<<<<', this.data.list); }, nav_goto:function(e){ + // const data = e.currentTarget.dataset + // this.setData({ + // active: data.index + // }) + // console.log('active***********<<<<<', this.data.active); var url=e.currentTarget.dataset.url; if(!url) return false; if(url[0]!='/') url='/'+url; //wx.switchTab({url:url,}) getApp().goto(url); - } + }, + + + // switchTab(e) { + // const data = e.currentTarget.dataset + // const url = data.path + // wx.switchTab({url}) + // this.setData({ + // selected: data.index + // }) + // } + + } diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index cfe266f..0c417bb 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,32 +1,40 @@ - - - - - - - {{cartGoodsNum}} - - - {{item.nav_name}} - - - + + + + + + + + {{cartGoodsNum}} + + + {{item.nav_name}} + + + + + + + - - - - {{item.nav_name}} - + + + + + {{item.nav_name}} + + + - + diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index 71558c6..eb2618d 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -7,6 +7,7 @@ z-index: 10000; display: flex; justify-content: space-around; + align-items: center; height: 100rpx; } .main_bar.custom { @@ -19,14 +20,14 @@ /* float: left; */ text-align: center; padding: 0; - display: flex; + /* display: flex; */ flex: 1; - flex-direction: column; - justify-content: center; + /* flex-direction: column; */ + /* justify-content: center; */ } .tab_img { - display: flex; + /* display: flex; */ justify-content: center; position: relative; } @@ -39,6 +40,7 @@ /* background-position: center; background-repeat: no-repeat; */ background-size: 100%; + margin: 0 auto; } .cart_num { @@ -55,3 +57,17 @@ right: 34rpx; /* margin-right: -70rpx; */ } + +.tabbar_item_wrapper { + background-color: white; + position: relative; + width: 120rpx; + height: 120rpx; + border-radius: 50%; + bottom: 14rpx; + display: flex; + flex-direction: column; + justify-content: center; + margin: 0 auto; +} + diff --git a/packageA/pages/cardList/cardList.js b/packageA/pages/cardList/cardList.js index 60c419c..377fcf6 100644 --- a/packageA/pages/cardList/cardList.js +++ b/packageA/pages/cardList/cardList.js @@ -24,6 +24,7 @@ Page({ */ onLoad: function (options) { self = this;//保存全局指针 + this.data.options = options; app.isLogin().then(function(data) {//进入页面前已经授权登录成功 self.setData({ userInfo: data, @@ -60,7 +61,9 @@ Page({ imghost: app.globalData.setting.imghost, isLogin: true, }); - + if(this.data.options.cat_id) { + currentQuery.cat_id = this.data.options.cat_id; + }; currentQuery.page=1; this.getData(true, url, currentQuery); // app.request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + app.globalData.setting.stoid, { diff --git a/packageA/pages/cardList/cardList.wxml b/packageA/pages/cardList/cardList.wxml index efb3a19..9a3eaf5 100644 --- a/packageA/pages/cardList/cardList.wxml +++ b/packageA/pages/cardList/cardList.wxml @@ -52,7 +52,7 @@ - - 已经到底了 - + @@ -85,7 +85,7 @@ - - 已经到底了 - + diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 4c6f9f9..157b074 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -1,579 +1,655 @@ -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), - s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); -var oo=t.globalData.setting,os=oo; +var t = getApp(), + app = t, + a = t.request, + e = require("../../../utils/common.js"), + s = require("../../../utils/util.js"), + o = require("../../../utils/md5.js"), + to = getApp(); +var oo = t.globalData.setting, + os = oo; var regeneratorRuntime = require('../../../utils/runtime.js'); var util_pay = require("../../../utils/pay.js"); Page({ - data: { - url: t.globalData.setting.url, - resourceUrl: t.globalData.setting.resourceUrl, - imgUrl: t.globalData.setting.imghost, - - invoiceToggle: !0, - payWithUserMoney: !0, - payWithPoints: !0, - maxWord: 0, - enterAddressPage: !1, - - //页面获取的参数 - param:null, - postdata:null, - //提交订单的格式 - formData: { - order_amount:0,//支付金额 - total_amount:0,//总价 - all_price:0,//商品卖的总价 - pay_points: 0,//使用积分 - user_money: 0,//使用余额 - couponCode: "",//使用优惠券(多单就用逗号隔开) - shipping_price:0,//物流费用 - }, - - /*----------------立即购买---------------------*/ - is_b_now:0, //0是购物车结算 1立即购买 - bn_goods:null, //立即购买时候的调用商品 - bn_use_money:0,//是否使用余额 - bn_pick:0, //选择的门店 - bn_pickname: "", //选择的门店名称 - - /*------------------------*/ - yuer:0, - is_cart:0, //是不是购物车进来的购买 - }, - onLoad: function(t) { + data: { + url: t.globalData.setting.url, + resourceUrl: t.globalData.setting.resourceUrl, + imgUrl: t.globalData.setting.imghost, + + invoiceToggle: !0, + payWithUserMoney: !0, + payWithPoints: !0, + maxWord: 0, + enterAddressPage: !1, + + //页面获取的参数 + param: null, + postdata: null, + //提交订单的格式 + formData: { + order_amount: 0, //支付金额 + total_amount: 0, //总价 + all_price: 0, //商品卖的总价 + pay_points: 0, //使用积分 + user_money: 0, //使用余额 + couponCode: "", //使用优惠券(多单就用逗号隔开) + shipping_price: 0, //物流费用 + }, + + /*----------------立即购买---------------------*/ + is_b_now: 0, //0是购物车结算 1立即购买 + bn_goods: null, //立即购买时候的调用商品 + bn_use_money: 0, //是否使用余额 + bn_pick: 0, //选择的门店 + bn_pickname: "", //选择的门店名称 + + /*------------------------*/ + yuer: 0, + is_cart: 0, //是不是购物车进来的购买 + }, + onLoad: function(t) { wx.setNavigationBarTitle({ - title: "填写订单", + title: "填写订单", }); - - var appD=getApp().globalData.service_now; - this.data.postdata=appD; - this.data.param=t; - if(t.is_cart){ - this.setData({is_cart:1}); - } - - var th=this; - + + var appD = getApp().globalData.service_now; + this.data.postdata = appD; + this.data.param = t; + if (t.is_cart) { + this.setData({ + is_cart: 1 + }); + } + + var th = this; + getApp().promiseGet("/api/wx/weappSendlist/page", { - data: { - store_id: os.stoid, - typeid: "1001" - }}).then(res=>{ - if (res.data.code == 0 && res.data.data.pageData.length > 0) { - var template_id = res.data.data.pageData[0].template_id; - th.setData({template_id:template_id}); - } - }) - - }, - onUnload: function () { this.setData({ isclose: 1 })}, - - //------获取会员信息-----先获取用户信息,在进行下一步--- - get_info:function(func){ - var user_id = t.globalData.user_id; - to.auth.get_u(func); - }, - - //----------------展示页面,是再获取用户信息之后-------------- - show_page:function(){ - var th=this; - //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取 - var user=getApp().globalData.userInfo; - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { - data:{r:Math.random()}, - success: function (e) { - - getApp().globalData.userInfo = e.data.data; - th.setData({userinfo:e.data.data}); - //获取立即购买的商品信息 - if(th.data.is_cart){ - //读取门店 - to.get_allsto(function (e) { - th.setData({ allsto: e }); - th.get_cart(); - }) - }else{ - th.get_buy_goods(); - } - - //获取提现金额 - getApp().request.get("/api/weshop/withdrawals/summoney", { - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, - success: function (su) { - if (su.data.code == 0) { - var yuer = parseFloat(th.data.userinfo.user_money - - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); - th.setData({ txmon: su.data.data.summoney, yuer: yuer }); + data: { + store_id: os.stoid, + typeid: "1001" + } + }).then(res => { + if (res.data.code == 0 && res.data.data.pageData.length > 0) { + var template_id = res.data.data.pageData[0].template_id; + th.setData({ + template_id: template_id + }); + } + }) + + }, + onUnload: function() { + this.setData({ + isclose: 1 + }) + }, + + //------获取会员信息-----先获取用户信息,在进行下一步--- + get_info: function(func) { + var user_id = t.globalData.user_id; + to.auth.get_u(func); + }, + + //----------------展示页面,是再获取用户信息之后-------------- + show_page: function() { + var th = this; + //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取 + var user = getApp().globalData.userInfo; + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { + data: { + r: Math.random() + }, + success: function(e) { + + getApp().globalData.userInfo = e.data.data; + th.setData({ + userinfo: e.data.data + }); + //获取立即购买的商品信息 + if (th.data.is_cart) { + //读取门店 + to.get_allsto(function(e) { + th.setData({ + allsto: e + }); + th.get_cart(); + }) + } else { + th.get_buy_goods(); + } + + //获取提现金额 + getApp().request.get("/api/weshop/withdrawals/summoney", { + data: { + user_id: to.globalData.user_id, + store_id: oo.stoid, + status: 0 + }, + success: function(su) { + if (su.data.code == 0) { + var yuer = parseFloat(th.data.userinfo.user_money - + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed( + 2); + th.setData({ + txmon: su.data.data.summoney, + yuer: yuer + }); + } + } + }); + } + }); + }, + + //-----获取购物车,入口-------- + get_cart: function() { + var th = this, + app = getApp(); + a.get("/api/weshop/cartService/page", { + data: { + user_id: to.globalData.user_id, + selected: 1, + store_id: oo.stoid, + pageSize: 600 + }, + success: async function(su) { + //按门店分类的数组 + var arr = new Array(); + var carr = su.data.data.pageData; + th.data.cartlist_y = carr; //存储原始购物车列表 + + //---是不是购买等级卡成功的返回---等级卡显示的判断--- + var is_card_back = getApp().globalData.is_card_back; + + + //在分组的时候,就不要再调用接口,await + for (var i = 0; i < carr.length; i++) { + var good = null; + var item = carr[i]; + await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then( + res => { + good = res.data.data; + }) + + item.img_url = oo.imghost + good.imgUrl; + item.erpItemID = good.erpItemID; + + /*----接口要弄出来的,先顶着-----*/ + var pcid = item.pick_id; + var find = 0; + //----如果有就加进去,没有就新增一个---- + //-----------循环查找门店------------- + if (arr.length > 0) { + for (var j = 0; j < arr.length; j++) { + if (arr[j].pickup_id == pcid) { + arr[j].goods.push(item); + find = 1; + break; + } + } + } + //------如果没有找到----- + if (find == 0) { + var pikname = '', + sto = null; + //----找到门店名称----- + for (var k = 0; k < th.data.allsto.length; k++) { + if (pcid == th.data.allsto[k].pickup_id) { + pikname = th.data.allsto[k].pickup_name; + sto = th.data.allsto[k]; + break; } } - }); + var narr = new Array(); + narr.push(item); + var ie = { + pickup_id: pcid, + pname: pikname, + goods: narr, + keyid: sto.keyid, + goods_price: 0, + shipping_price: 0, + user_money: 0, + total_amount: 0, + order_amount: 0 + }; + arr.push(ie); + + } + } + + //深拷贝 + th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); + th.setData({ + cartlist: arr, + }); + th.calculatePrice(); + } + }); + }, + + //-----获取立即购买的商品信息---- + get_buy_goods: function() { + var th = this, + a = getApp().request; + var gg = th.data.postdata; + var url = "/api/weshop/serviceCard/get/" + oo.stoid + "/" + gg.id + //调用商品 + a.get(url, { + success: function(t) { + var gd = t.data.data; + t.data.data.original_img = oo.imghost + t.data.data.imgUrl; + t.data.data['buynum'] = gg.goods_num; + t.data.data.shop_price = gd.money; + + th.setData({ + bn_goods: t.data.data, + bn_pickname: gg.pick_name, + bn_pick: gg.pick_id + }); + th.calculatePrice2(); + + } + }); + }, + + //----------子页返回父页触发---------- + onShow: function() { + var th = this; + if (th.data.isclose == 0) { + wx.navigateTo({ + url: "/pages/index/index/index" + }) + } + //先获取是否有关闭使用优惠券 + getApp().getConfig2(function(ee) { + //var json_d = JSON.parse(ee.switch_list); + //th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 + //th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); + th.show_page(); + }) + }, + + + showInvoice: function() { + this.setData({ + invoiceToggle: !this.data.invoiceToggle + }); + }, + + + //-------------------计算购物车订单价格------------------- + calculatePrice: function() { + var th = this; + to.getConfig2(async function(ee) { + wx.showLoading({ + title: "处理中." + }) + var all_price = 0; //所有的商品总价 + var all_shipping_m = 0; //所有的物流总价 + var all_total_m = 0; //所有的订单应付总价 + var all_order_m = 0; //所有的订单应付总价 + var all_user_m = 0; //所有的订单用户使用金额 + var all_coupon_price_m = 0; //所有的订单用户使用优惠券价格 + var all_cutprice = 0; //所有的优惠减件 + var all_order_prom = 0; //所有的订单优惠 + + var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : + 0); + var freight_free = ee.freight_free; //全场满多少包邮 + var no_ex_id = ee.no_ex_id; + var no_ex_good = null; + var by_qc = {}; + var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); + + //---循环购物车--- + for (var i in c_arr) { + + var cart_item = c_arr[i]; //就是每一单的意思 + var pickid = cart_item.pickup_id; + var o_price = 0; + var o_shipping_price = 0, + goods_weight = -1, + goods_piece = -1; + var item = c_arr[i].goods; //就是每一单的从表的意思 + + //---如果有选择优惠券的情况下--- + var quan_price = 0; + var coupon_price = 0; + var quan_no = null; + + //--------循环计算总价----------- + for (var j = 0; j < item.length; j++) { + o_price += item[j].money * item[j].goods_num; + } + var f_o_price = o_price; + cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 + //计算物流费用 + cart_item.shipping_price = 0; + + //总价计算,总价不包含运费 + cart_item.order_amount = (o_price - quan_price).toFixed(2); + cart_item.total_amount = f_o_price.toFixed(2); + + var order_prom_amount = 0; + var order_prom_id = 0; + var o_condition = cart_item.order_amount; + var order_m = 0; + cart_item.order_prom_amount = 0; + coupon_price = quan_price; + + + cart_item.total_amount = parseFloat(cart_item.total_amount) + parseFloat(cart_item.shipping_price); //总金额 + cart_item.order_amount = parseFloat(cart_item.order_amount) + parseFloat(cart_item.shipping_price); //总金额 + cart_item.total_amount = cart_item.total_amount.toFixed(2); + cart_item.order_amount = cart_item.order_amount.toFixed(2); + + //搭配购在使用余额 + if (th.data.bn_use_money == 1 && th.data.is_b_now == 1) { + + if (umoney > cart_item.order_amount) { + cart_item.user_money = cart_item.order_amount; + umoney = umoney - cart_item.order_amount; + } else { + cart_item.user_money = umoney; + umoney = 0; + } + + } else { + //--------------如果使用余额,购物车购买--------------------- + if (th.data.js_use_money == 1) { + if (umoney > cart_item.order_amount) { + cart_item.user_money = cart_item.order_amount; + umoney = umoney - cart_item.order_amount; + } else { + cart_item.user_money = umoney; + umoney = 0; + } + } else { + cart_item.user_money = 0; + } + } + all_price += parseFloat(f_o_price); + all_total_m += parseFloat(cart_item.total_amount); + all_shipping_m += parseFloat(cart_item.shipping_price); + all_order_m += parseFloat(cart_item.order_amount); } - }); - }, - - //-----获取购物车,入口-------- - get_cart: function () { - var th = this,app=getApp(); - a.get("/api/weshop/cartService/page", { - data: { - user_id: to.globalData.user_id, selected:1, - store_id: oo.stoid, pageSize: 600 }, - success:async function (su) { - //按门店分类的数组 - var arr = new Array(); - var carr = su.data.data.pageData; - th.data.cartlist_y = carr; //存储原始购物车列表 - - //---是不是购买等级卡成功的返回---等级卡显示的判断--- - var is_card_back=getApp().globalData.is_card_back; - - - //在分组的时候,就不要再调用接口,await - for (var i = 0; i < carr.length; i++) { - var good=null; - var item = carr[i]; - await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then(res => { - good = res.data.data; - }) - - item.img_url = oo.imghost + good.imgUrl; - item.erpItemID=good.erpItemID; - - /*----接口要弄出来的,先顶着-----*/ - var pcid = item.pick_id; - var find = 0; - //----如果有就加进去,没有就新增一个---- - //-----------循环查找门店------------- - if (arr.length > 0) { - for (var j = 0; j < arr.length; j++) { - if (arr[j].pickup_id == pcid) { - arr[j].goods.push(item); - find = 1;break; - } - } - } - //------如果没有找到----- - if (find == 0) { - var pikname = '',sto=null; - //----找到门店名称----- - for (var k = 0; k < th.data.allsto.length; k++) { - if (pcid == th.data.allsto[k].pickup_id) { - pikname = th.data.allsto[k].pickup_name; sto = th.data.allsto[k]; break; - } - } - var narr = new Array(); narr.push(item); - var ie = { - pickup_id: pcid, pname: pikname, goods: narr,keyid:sto.keyid, - goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0}; - arr.push(ie); - - } - } - - //深拷贝 - th.data.old_cartlist= JSON.parse(JSON.stringify(arr)); - th.setData({ - cartlist: arr, - }); - th.calculatePrice(); - } - }); - }, - - //-----获取立即购买的商品信息---- - get_buy_goods: function (){ - var th=this,a=getApp().request; - var gg = th.data.postdata; - var url="/api/weshop/serviceCard/get/" + oo.stoid + "/" + gg.id - //调用商品 - a.get(url, { - success: function (t) { - var gd = t.data.data; - t.data.data.original_img = oo.imghost + t.data.data.imgUrl; - t.data.data['buynum'] = gg.goods_num; - t.data.data.shop_price=gd.money; - - th.setData({ - bn_goods: t.data.data, bn_pickname: gg.pick_name, - bn_pick: gg.pick_id - }); - th.calculatePrice2(); - - } - }); - }, - - //----------子页返回父页触发---------- - onShow: function() { - var th=this; - if (th.data.isclose==0){ - wx.navigateTo({ - url: "/pages/index/index/index" - }) - } - //先获取是否有关闭使用优惠券 - getApp().getConfig2(function (ee) { - //var json_d = JSON.parse(ee.switch_list); - //th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 - //th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); - th.show_page(); - }) - }, - - - showInvoice: function() { - this.setData({ - invoiceToggle: !this.data.invoiceToggle - }); - }, - - - //-------------------计算购物车订单价格------------------- - calculatePrice: function() { - var th = this; - to.getConfig2(async function(ee){ - wx.showLoading({ - title:"处理中." - }) - var all_price=0; //所有的商品总价 - var all_shipping_m= 0; //所有的物流总价 - var all_total_m = 0; //所有的订单应付总价 - var all_order_m = 0; //所有的订单应付总价 - var all_user_m=0; //所有的订单用户使用金额 - var all_coupon_price_m=0; //所有的订单用户使用优惠券价格 - var all_cutprice=0; //所有的优惠减件 - var all_order_prom=0; //所有的订单优惠 - - var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money?th.data.userinfo.frozen_money:0); - var freight_free = ee.freight_free; //全场满多少包邮 - var no_ex_id=ee.no_ex_id; - var no_ex_good=null; - var by_qc={}; - var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist)); - - //---循环购物车--- - for(var i in c_arr){ - - var cart_item=c_arr[i]; //就是每一单的意思 - var pickid=cart_item.pickup_id; - var o_price=0; - var o_shipping_price=0,goods_weight=-1, goods_piece=-1; - var item=c_arr[i].goods; //就是每一单的从表的意思 - - //---如果有选择优惠券的情况下--- - var quan_price=0; - var coupon_price=0; - var quan_no= null; - - //--------循环计算总价----------- - for(var j=0;j cart_item.order_amount) { - cart_item.user_money = cart_item.order_amount; - umoney = umoney - cart_item.order_amount; - }else { - cart_item.user_money = umoney; - umoney=0; - } - - }else{ - //--------------如果使用余额,购物车购买--------------------- - if (th.data.js_use_money == 1) { - if (umoney > cart_item.order_amount) { - cart_item.user_money = cart_item.order_amount; - umoney = umoney - cart_item.order_amount; - }else { - cart_item.user_money = umoney; - umoney=0; - } - }else{ - cart_item.user_money=0; - } - } - all_price += parseFloat(f_o_price); - all_total_m += parseFloat(cart_item.total_amount); - all_shipping_m += parseFloat(cart_item.shipping_price); - all_order_m += parseFloat(cart_item.order_amount); - } - - - all_total_m = parseFloat(all_total_m).toFixed(2); - all_order_m = parseFloat(all_order_m).toFixed(2); - all_price = parseFloat(all_price).toFixed(2); - all_total_m = parseFloat(all_total_m).toFixed(2); - - var atxt = "formData.total_amount"; - var atxt1 = "formData.order_amount"; - var atxt2 = "formData.all_price"; - - th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, - [atxt2]: all_price,show_submit:1 - }) - th.data.order_prom_list_cart=c_arr; - wx.hideLoading(); - }); - }, - - //---------计算立即购买---------- - calculatePrice2: function () { - console.log('calculatePrice2'); - var th = this, good = this.data.bn_goods; - //-----------计算商品总价-------------- - var allpice = good.shop_price * good.buynum; - allpice=parseFloat(allpice).toFixed(2); - var txt = "formData.all_price"; - th.setData({ [txt]: allpice, }); - - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; - //-----------------总价----------------- - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price); - total_m = parseFloat(total_m).toFixed(2); - - var atxt= "formData.total_amount"; - th.setData({ [atxt]: total_m, }) - var order_m = total_m; - var txt = "formData.user_money"; - var txt2 = "formData.order_amount"; - - th.setData({ [txt]: 0, [txt2]: order_m }) - - }, - - submitForm:function(){ - var th=this; - this.sendsm(function(){ + + + all_total_m = parseFloat(all_total_m).toFixed(2); + all_order_m = parseFloat(all_order_m).toFixed(2); + all_price = parseFloat(all_price).toFixed(2); + all_total_m = parseFloat(all_total_m).toFixed(2); + + var atxt = "formData.total_amount"; + var atxt1 = "formData.order_amount"; + var atxt2 = "formData.all_price"; + + th.setData({ + [atxt]: all_total_m, + [atxt1]: all_order_m, + [atxt2]: all_price, + show_submit: 1 + }) + th.data.order_prom_list_cart = c_arr; + wx.hideLoading(); + }); + }, + + //---------计算立即购买---------- + calculatePrice2: function() { + console.log('calculatePrice2'); + var th = this, + good = this.data.bn_goods; + //-----------计算商品总价-------------- + var allpice = good.shop_price * good.buynum; + allpice = parseFloat(allpice).toFixed(2); + var txt = "formData.all_price"; + th.setData({ + [txt]: allpice, + }); + + var o_shipping_price = 0, + goods_weight = -1, + goods_piece = -1; + //-----------------总价----------------- + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price); + total_m = parseFloat(total_m).toFixed(2); + + var atxt = "formData.total_amount"; + th.setData({ + [atxt]: total_m, + }) + var order_m = total_m; + var txt = "formData.user_money"; + var txt2 = "formData.order_amount"; + + th.setData({ + [txt]: 0, + [txt2]: order_m + }) + + }, + + submitForm: function() { + var th = this; + this.sendsm(function() { th.submit_func(); }) }, - - //--------------------提交订单----------------------- - submit_func: async function(){ - - if(this.data.is_summit_ing==1) return false; //--提交中退出-- - this.data.is_summit_ing=1; - var th=this,pdata=new Array(); - - var item={ - 'user_id': to.globalData.user_id, - 'account': th.data.formData.order_amount, //使用余额 - 'store_id':oo.stoid, //商家 - 'list':new Array(), - }; - - //判断是不是购物车购买还是立即购买 - if(this.data.is_cart){ - var list= th.data.cartlist; - for(var i in list){ - var gglist = list[i].goods; - for(var j in gglist){ - var gg=gglist[j]; - if(!gg.pick_id){ - getApp().showWarning("未找到门店"); - return false; - } - - var goods={ - 'card_id': gg.service_id, - 'itemid': gg.erpItemID, - 'qty': gg.goods_num, - 'price': gg.money, - 'pickup_id':gg.pick_id, - 'pickup_keyid':list[i].keyid, - }; - //--导购分享过来的id-- - if(gg.guide_id){ - goods.guide_id=gg.guide_id; - goods.guide_type=gg.guide_type; - //调用接口判断是不是会员 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{ - if(res.data.code==0){ - goods.guide_name=res.data.data.salesman; - goods.guide_sn=res.data.data.salesman_no; - } - }) - } - item.list.push(goods); - } - } - }else{ - var gg = getApp().globalData.service_now; - if(!gg.pick_id){ - getApp().showWarning("未找到门店"); - return false; - } - - var goods={ - 'card_id': th.data.bn_goods.id, - 'itemid': th.data.bn_goods.erpItemID, - 'qty': gg.goods_num, - 'price': th.data.formData.order_amount, - 'pickup_id':gg.pick_id, - 'pickup_keyid':gg.keyid, - }; - - //--导购分享过来的id-- - if(gg.guide_id){ - goods.guide_id=gg.guide_id; - goods.guide_type=gg.guide_type; - //调用接口判断是不是会员 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{ - if(res.data.code==0){ - goods.guide_name=res.data.data.salesman; - goods.guide_sn=res.data.data.salesman_no; - } - }) - } - item.list.push(goods); - } - - - pdata=item; - var str = JSON.stringify(pdata); - console.log("支付数据"); - console.log(str); - //return false; - wx.showLoading({title: "加载中"}); - wx.request({ - url: oo.url + '/api/weshop/recharge/saveRecharge', - data: str, - method: 'POST', - header: { - 'content-type': 'application/json' - },// 设置请求的 header - success: function (res) { - - wx.hideLoading(); - if (res.statusCode == 200) { - var data=res.data; - if(data.code==0){ - if(th.data.is_cart){ - var list = th.data.cartlist_y; - for (var i = 0; i < list.length; i++) { - //删除购物车 - a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {}); - } - } - var order_amount = pdata.account; - //要进行判断,如果是用微信支付,就要跳转到支付界面 - if (order_amount > 0) { - th.setData({ isclose: 0 }); - - getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { - data: { - parentSn: data.data.order_sn, - store_id: oo.stoid - }, - success: function (su) { - var n=su.data.data; - th.weixinPay(n, - function () { - getApp().showWarning("购买成功"); - setTimeout(function () { - wx.reLaunch({ - url: "/pages/user/my_service/i_service", - }) - },1000) - }, function () { - getApp().showWarning("支付失败"); - setTimeout(function () { - wx.reLaunch({ - url: "/packageA/pages/cardList/cardList", - }) - },1000) - }) - } - }) - } - } - else{ - th.data.is_summit_ing=0; //是否提交中 - getApp().confirmBox(data.msg); - } - } else { - th.data.is_summit_ing=0; //是否提交中 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); - } - }, - fail: function () { - th.data.is_summit_ing=0; //是否提交中 - wx.hideLoading(); - console.log("index.js wx.request CheckCallUser fail"); - }, - complete: function () {} - }) - }, - - cart_set_err: function (e) { + + //--------------------提交订单----------------------- + submit_func: async function() { + + if (this.data.is_summit_ing == 1) return false; //--提交中退出-- + this.data.is_summit_ing = 1; + var th = this, + pdata = new Array(); + + var item = { + 'user_id': to.globalData.user_id, + 'account': th.data.formData.order_amount, //使用余额 + 'store_id': oo.stoid, //商家 + 'list': new Array(), + }; + + //判断是不是购物车购买还是立即购买 + if (this.data.is_cart) { + var list = th.data.cartlist; + for (var i in list) { + var gglist = list[i].goods; + for (var j in gglist) { + var gg = gglist[j]; + if (!gg.pick_id) { + getApp().showWarning("未找到门店"); + return false; + } + var goods = { + 'card_id': gg.service_id, + 'itemid': gg.erpItemID, + 'qty': gg.goods_num, + 'price': gg.money, + 'pickup_id': gg.pick_id, + 'pickup_keyid': list[i].keyid, + }; + //--导购分享过来的id-- + if (gg.guide_id) { + goods.guide_id = gg.guide_id; + goods.guide_type = gg.guide_type; + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then( + res => { + if (res.data.code == 0) { + goods.guide_name = res.data.data.salesman; + goods.guide_sn = res.data.data.salesman_no; + } + }) + } + item.list.push(goods); + } + } + } else { + var gg = getApp().globalData.service_now; + if (!gg.pick_id) { + getApp().showWarning("未找到门店"); + return false; + } + var goods = { + 'card_id': th.data.bn_goods.id, + 'itemid': th.data.bn_goods.erpItemID, + 'qty': gg.goods_num, + 'price': th.data.bn_goods.money, + // 'price': th.data.formData.order_amount, + 'pickup_id': gg.pick_id, + 'pickup_keyid': gg.keyid, + }; + + //--导购分享过来的id-- + if (gg.guide_id) { + goods.guide_id = gg.guide_id; + goods.guide_type = gg.guide_type; + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then( + res => { + if (res.data.code == 0) { + goods.guide_name = res.data.data.salesman; + goods.guide_sn = res.data.data.salesman_no; + } + }) + } + item.list.push(goods); + } + + + pdata = item; + var str = JSON.stringify(pdata); + console.log("支付数据"); + console.log(str); + //return false; + wx.showLoading({ + title: "加载中" + }); + wx.request({ + url: oo.url + '/api/weshop/recharge/saveRecharge', + data: str, + method: 'POST', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { + + wx.hideLoading(); + if (res.statusCode == 200) { + var data = res.data; + if (data.code == 0) { + // console.log('myyyyyyyyyyyyyyyyyy', data.data); + if (th.data.is_cart) { + var list = th.data.cartlist_y; + for (var i = 0; i < list.length; i++) { + //删除购物车 + a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {}); + } + } + var order_amount = pdata.account; + //要进行判断,如果是用微信支付,就要跳转到支付界面 + if (order_amount > 0) { + th.setData({ + isclose: 0 + }); + + getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { + data: { + parentSn: data.data.order_sn, + store_id: oo.stoid + }, + success: function(su) { + var n = su.data.data; + let order_id = data.data.order_id; + th.weixinPay(n, + function() { + getApp().showWarning("购买成功"); + setTimeout(function() { + wx.reLaunch({ + url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, + }) + }, 1000) + }, + function() { + getApp().showWarning("支付失败"); + setTimeout(function() { + wx.reLaunch({ + url: "/pages/user/order_list/order_list?index=2&tabindex=1", + }) + }, 1000) + }) + } + }) + } + } else { + th.data.is_summit_ing = 0; //是否提交中 + getApp().confirmBox(data.msg); + } + } else { + th.data.is_summit_ing = 0; //是否提交中 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); + } + }, + fail: function() { + th.data.is_summit_ing = 0; //是否提交中 + wx.hideLoading(); + console.log("index.js wx.request CheckCallUser fail"); + }, + complete: function() {} + }) + }, + + cart_set_err: function(e) { var txt = e.currentTarget.dataset.err; var ob = {}; ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; this.setData(ob); }, - + //------调起支付框-------- - weixinPay: function (n, success, fail) { - if(!n) return false; - wx.requestPayment({ - timeStamp: String(n.timeStamp), - nonceStr: n.nonceStr, - package: n.packageValue, - signType: n.signType, - paySign: n.paySign, - success: function (n) { - console.log(n), getApp().showSuccess("支付成功!"); - "function" == typeof success && success(); - wx.redirectTo({ - url: "../deposit/deposit" - }); - }, - fail: function (n) { - console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), - "function" == typeof fail && fail(); - } - }); + weixinPay: function(n, success, fail) { + if (!n) return false; + wx.requestPayment({ + timeStamp: String(n.timeStamp), + nonceStr: n.nonceStr, + package: n.packageValue, + signType: n.signType, + paySign: n.paySign, + success: function(n) { + console.log(n), getApp().showSuccess("支付成功!"); + "function" == typeof success && success(); + wx.redirectTo({ + url: "../deposit/deposit" + }); + }, + fail: function(n) { + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : + "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n + .errMsg.substr("requestPayment:fail ".length)), + "function" == typeof fail && fail(); + } + }); }, - + //订阅消息提醒 - sendsm:function(func) - { - var template_id = this.data.template_id; - // //授权订阅 - wx.requestSubscribeMessage({ - tmplIds: [template_id], - success(res) { - func(); - }, - fail(res) { - func(); - } - }) - - }, - - + sendsm: function(func) { + var template_id = this.data.template_id; + // //授权订阅 + wx.requestSubscribeMessage({ + tmplIds: [template_id], + success(res) { + func(); + }, + fail(res) { + func(); + } + }) + + }, + + }); diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index 4cd640e..94e7fd0 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -1,66 +1,487 @@ // packageA/pages/details_serviceCard/details_serviceCard.js +const app = getApp(); +const os = app.globalData.setting; +let self = null; + Page({ - /** - * 页面的初始数据 - */ - data: { + /** + * 页面的初始数据 + */ + data: { + is_summit_ing: 0, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + self = this; + this.data.options = options; + + wx.setNavigationBarTitle({ + title: '订单详情', + }); + + app.isLogin().then(function(data) { + self.setData({ + userInfo: data, + }); + self.getConfig(); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + if (app.globalData.userInfo) { + if (!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + + let url = '/api/weshop/recharge/user/page' + let data = { + store_id: app.globalData.setting.stoid, + user_id: this.data.userInfo.user_id, + order_id: this.data.options.order_id, + }; + + // 请求数据 + app.promiseGet(url, { + data: data, + }).then(res => { + if (res.data.code == 0) { + // console.log('请求成功', res); + this.setData({ + details: res.data.data.pageData[0], + }); + } else { + throw (res); + }; + }).catch(err => { + wx.showToast({ + title: err.data.data, + icon: 'error', + }); + }); + + }; + }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + }, + + + // 内容复制到剪贴板 + copy() { + // console.log('点击了复制按钮'); + wx.setClipboardData({ + data: this.data.details.order_sn, + success(res) { + wx.getClipboardData({ + success(res) { + console.log(res.data); + } + }) + } + }) + }, + + + // 图片异常时加载默认图片 + bind_bnerr(e) { + var errImg = e.currentTarget.dataset.errorimg; + var errObj = {}; + errObj[errImg] = 'public/images/default_goods_image_240.gif'; + this.setData(errObj); // this.setData({ details.list[0].img_url}); + }, + + + // 查看商品详情 + viewDetails(e) { + let goods_id = e.currentTarget.dataset.gid; + let url = '/packageA/pages/goodsInfo/goodsInfo?goods_id=' + goods_id; + app.goto(url); + }, + + // 获取系统参数 + getConfig() { + app.getConfig2(function(e) { + // console.log('101',e); + let json_d = JSON.parse(e.switch_list); + self.setData({ + sys_switch: json_d, + // weapp_customertype: json_d.weapp_customertype, + }); + }, 1); + }, + + + // 联系微信客服 + contact_wx() { + var url = this.data.sys_switch.weapp_customertype_url; + var id = this.data.sys_switch.weapp_customertype_appid; + wx.openCustomerServiceChat({ + extInfo: { + url: url + }, + corpId: id, + success(res) {} + }) + }, + + + // 联系电话客服 + contactService() { + app.getConfig(function(t) { + if (t.store_tel == undefined) { + app.request.get('/api/weshop/store/get/' + os.stoid, { + isShowLoading: 1, + data: {}, + success: function(rs) { + app.globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + app.my_warnning('商家未设置电话', 0, self); + return false; + } + app.confirmBox('请联系客服:' + rs.data.data.store_tel); + } + }) + } else { + app.confirmBox('请联系客服:' + t.store_tel); + } + }); + }, + + + // 评价商品 + access() { + let listLength = this.data.details.list.length; + let order_id = this.data.details.order_id; + let url = ''; + + // 卡项订单跳转到评论页要多加个参数card=1 + // 卡项订单goods_id要带card_id + if (listLength == 1) { + let price = this.data.details.list[0].price; + let card_id = this.data.details.list[0].card_id; + url = + `/packageB/pages/user/add_comment/add_comment?card=1&goods_id=${card_id}&order_id=${order_id}&price=${price}` + }; + if (listLength > 1) { + url = `/packageB/pages/user/comment/comment?card=1&status=0&order_id=${order_id}`; + }; + f + // console.log('url', url); + app.goto(url); + }, + + + // 查看评论 + viewComment() { + let order_id = this.data.details.order_id; + let card_id = this.data.details.list[0].card_id; + let listLength = this.data.details.list.length; + let url = ''; + + // 卡项订单单个商品 + if (listLength == 1) { + url = `/packageB/pages/user/view_comment/view_comment?card=1&goods_id=${card_id}&order_id=${order_id}`; + }; + // 卡项订单多个商品 + if (listLength > 1) { + // status控制评论列表页的activeStatus + url = `/packageB/pages/user/comment/comment?card=1&status=1&order_id=${order_id}`; + }; + + app.goto(url); + }, + + + // 再来一单 + buy2(t) { + let details = this.data.details; + var th = this; + var ind = 1; // 1:加入购物车 + // var ind = t.currentTarget.dataset.openSpecModal_ind; + // var action= t.currentTarget.dataset.action; + var action = 'add'; // + // if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; + + th.setData({ + open_ind_store: ind + }); + + // if(!th.data.sto_sele_name){ + // getApp().my_warnning('请选择门店', 1, th, 450); + // return false; + // } + + + if (action == "buy") { + //--------------此时操作的数据------------ + // var newd = { + // id: th.data.data.id, + // goods_num: th.data.goodsInputNum, + // pick_id: th.data.sto_sele_id, + // keyid: th.data.sto_sele_keyid, + // }; + // newd['pick_name'] = th.data.sto_sele_name; + // newd['guide_id'] = getApp().globalData.guide_id; + // newd['guide_type']=0; + // th.buyNow(newd); + } else { + + var newd = { + // service_id: th.data.data.id, + // service_sn:th.data.data.service_sn, + // service_name:th.data.data.goods_name, + // goods_num: th.data.goodsInputNum, + // pick_id: th.data.sto_sele_id, + // user_id:oo.user_id, + // store_id:os.stoid, + // money:th.data.data.shop_price, + + service_id: details.list[0].card_id, + service_sn: details.list[0].service_sn, + service_name: details.list[0].service_name, + goods_num: details.list[0].qty, + pick_id: details.list[0].pickup_id, + user_id: this.data.userInfo.user_id, + store_id: app.globalData.setting.stoid, + money: details.list[0].price, + }; + if (getApp().globalData.guide_id) { + newd['guide_id'] = getApp().globalData.guide_id; + newd['guide_type'] = 0; + } + + //----先看会员在购物车中是否加入了该商品----- + app.request.get("/api/weshop/cartService/page", { + data: { + store_id: app.globalData.setting.stoid, + user_id: this.data.userInfo.user_id, + service_id: details.list[0].card_id, + pick_id: details.list[0].pickup_id, + }, + success: function(re) { + + //-------如果购物车中有相关的数据--------- + if (re.data.data.total > 0) { + var item = re.data.data.pageData[0]; + var updata = { + id: item.id, + goods_num: details.list[0].qty + item.goods_num, + money: details.list[0].price, + store_id: app.globalData.setting.stoid, + }; + + if (getApp().globalData.guide_id) { + updata['guide_id'] = getApp().globalData.guide_id; + updata['guide_type'] = 1; + } + getApp().request.put("/api/weshop/cartService/update", { + data: updata, + success: function(t) { + // getApp().my_warnning('加入购物车成功', 1, th, 450); + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + app.goto('/pages/cart/cart/cart'); + // th.closeSpecModal(); + } + }); + } else { + + getApp().request.post("/api/weshop/cartService/save", { + data: newd, + success: function(t) { + // getApp().my_warnning('加入购物车成功', 1, th, 450); + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + app.goto('/pages/cart/cart/cart'); + // th.closeSpecModal(); + } + }); + } + } + }); + + } + }, + + + // 取消订单 + // api/weshop/recharge/update?store_id=&order_id=&order_status=3 + cancle() { + wx.showModal({ + title: '提示', + content: '确定取消订单吗?', + success(res) { + if (res.confirm) { + console.log('用户点击确定'); + let order_id = self.data.details.order_id; + let order_sn = self.data.details.order_sn; + app.request.put('/api/weshop/recharge/update', { + data: { + store_id: os.stoid, + order_id: order_id, + order_sn: order_sn, + order_status: 3, + }, + success: function(res) { - }, + //取消成功刷新订单 + let url = '/api/weshop/recharge/user/page' + let data = { + store_id: app.globalData.setting.stoid, + user_id: self.data.userInfo.user_id, + order_id: self.data.options.order_id, + }; - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { + // 请求数据 + app.promiseGet(url, { + data: data, + }).then(res => { + if (res.data.code == 0) { + console.log('请求成功', res); + wx.showToast({ + title: '取消成功', + }); + self.setData({ + details: res.data.data.pageData[0], + }); + } else { + throw (res); + }; + }).catch(err => { + wx.showToast({ + title: err.data.data, + icon: 'error', + }); + }); - }, + }, + }) + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }); + }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - }, + // 立即支付 + pay() { + let order_sn = this.data.details.order_sn; + let order_id = this.data.details.order_id; + let store_id = app.globalData.setting.stoid; - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { + app.request.post('/api/weshop/order/pay/createRechargeOrder', { + data: { + parentSn: order_sn, + store_id: store_id, + }, - }, + success: function(res) { + var n = res.data.data; + self.weixinPay(n, function() { + app.showWarning('支付成功'); + setTimeout(function() { + wx.reLaunch({ + url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, + }) + }, 1000) + }, function() { + app.showWarning('支付失败'); + // setTimeout(function() { + // wx.reLaunch({ + // url: '/packageA/pages/cardList/cardList', + // }) + // }, 1000) + }); + } + }) + }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - }, + //------调起支付框-------- + weixinPay: function(n, success, fail) { + if (!n) return false; + wx.requestPayment({ + timeStamp: String(n.timeStamp), + nonceStr: n.nonceStr, + package: n.packageValue, + signType: n.signType, + paySign: n.paySign, + success: function(n) { + console.log(n), getApp().showSuccess("支付成功!"); + "function" == typeof success && success(); + wx.redirectTo({ + url: "../deposit/deposit" + }); + }, + fail: function(n) { + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : + "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n + .errMsg.substr("requestPayment:fail ".length)), + "function" == typeof fail && fail(); + } + }); + }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - }, - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - } -}) \ No newline at end of file +}) diff --git a/packageA/pages/details_serviceCard/details_serviceCard.wxml b/packageA/pages/details_serviceCard/details_serviceCard.wxml index a3825a8..40b576b 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.wxml +++ b/packageA/pages/details_serviceCard/details_serviceCard.wxml @@ -1,46 +1,88 @@ + + - - - 门店名称名称名称名称名称名称名称名称名称名称 - 待评价 - - - - - - - - 我是商品标题 - 10 + + + + {{item.pickup_name}} + + + 待支付 + 待评价 + 已评价 + 已取消 + 已作废 + + + + + + + + + - - 10个/蓝色 - x1 + + + {{item.service_name}} + {{item.price}} + + + + x{{item.qty}} + - + + + - 共2件商品,合计:21.00 + 共{{filter.count(details.list)}}件商品,合计:{{details.account}} + + 订单信息 + - 订单编号:fwk20221252125222212 - 复制 + 订单编号:{{details.order_sn}} + 复制 - 下单时间:2021-12-27 18:00:00 + 下单时间:{{filter.format_time(details.ctime, 1)}} + - 联系客服 - 卡项同步 + + + + 联系客服 + 联系客服 + + + + - 立即评价 - 再来一单 + + + 取消订单 + 立即支付 + + + + 再来一单 + 立即评价 + + + + 再来一单 + 查看评价 + diff --git a/packageA/pages/details_serviceCard/details_serviceCard.wxss b/packageA/pages/details_serviceCard/details_serviceCard.wxss index 91b3ce2..ca4f2b6 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.wxss +++ b/packageA/pages/details_serviceCard/details_serviceCard.wxss @@ -18,6 +18,7 @@ page { border: 2rpx solid #808080; } + .bg-red { background-image: -webkit-linear-gradient(315deg,#f2140c,#f2270c 70%,#f24d0c); background-image: linear-gradient(135deg,#f2140c,#f2270c 70%,#f24d0c); diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 379e3f8..038dd73 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -8,6 +8,9 @@ var t = require("../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; + +let self = null; + //评价加载更多 var more = function(e) { return e && e.__esModule ? e : { @@ -54,11 +57,14 @@ Page({ shippingCost: 0, enterAddressPage: !1, categories: [{ - name: "商品", + name: "卡项", id: 0 }, { name: "详情", id: 1 + },{ + name: "评价", + id: 2 }], activeCategoryId2: 0, categories2: [{ @@ -68,7 +74,7 @@ Page({ name: "规格参数", id: 1 }], - activeCategoryId3: 1, + activeCategoryId3: 1, // 点击评价-全部、有图、好评、中评时对应的id categories3: [{ name: "全部", id: 1, @@ -148,7 +154,16 @@ Page({ current: 0, //图片计数 swiperCurrent: 0, //轮播的下标 hiddenn: 0, //控制轮播计数显示 - + + currentTab: 0, // 选择器控制参数 + mapurl: "", + mapurl_f_img: "", + videopicture: 0, //视频图片的控制 + + video: 0, //视频图片切换器 + index: 0, + noon: 0, //开始视频的隐藏 + screenWidth: 0, canvasHidden: 1, @@ -195,60 +210,62 @@ Page({ //------初始化加载---------- onLoad: function(t) { - - // console.log("--服务卡项--"); - // console.log('fdsfasfasf111111111111111====================',t); - - - + + self = this; + this.data.options = t; // { goods_id: ...} + + var ee = this, that = ee, th = ee, gid = t.goods_id, first_leader=t.first_leader; + //-- 自定义海报 -- - getApp().request.promiseGet("/api/weshop/goods/poster/page", { - data:{store_id:os.stoid, type:1, is_use:1} - }).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]){ - var poster_data=res.data.data.pageData[0]; - var json_str=poster_data.jsonStr; - if(json_str){ - var json_data=JSON.parse(json_str); - if(json_data.bg_img){ - //-- 把图片那到本地 -- - wx.getImageInfo({ - src:json_data.bg_img, - success: function(res) { - var path= res.path; - th.setData({share_b_img:path}) - }, - fail: function(res) {} - }); - } - th.setData({poster:json_data}) - } - } - }) + // getApp().request.promiseGet("/api/weshop/goods/poster/page", { + // data:{store_id:os.stoid, type:1, is_use:1} + // }).then(res=>{ + // if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]){ + // var poster_data=res.data.data.pageData[0]; + // var json_str=poster_data.jsonStr; + // if(json_str){ + // var json_data=JSON.parse(json_str); + // if(json_data.bg_img){ + // //-- 把图片那到本地 -- + // wx.getImageInfo({ + // src:json_data.bg_img, + // success: function(res) { + // var path= res.path; + // th.setData({share_b_img:path}) + // }, + // fail: function(res) {} + // }); + // } + // th.setData({poster:json_data}) + // } + // } + // }) + //---获取手机地址坐标-- //--如果tg_id是空的话,分享回来-- if (gid == undefined || gid == null || gid == "") { - var gid_str = decodeURIComponent(t.scene); + var gid_str = decodeURIComponent(t.scene); gid_str=gid_str.split("_"); gid=gid_str[0]; if(gid_str.length>1){ first_leader=gid_str[1]; } - //-- 如果有room_id的获取 -- - if(gid_str.length>2 && gid_str[2]){ - room_id=gid_str[2]; - room_user_share=1; - } - - } + //-- 如果有room_id的获取 -- + if(gid_str.length>2 && gid_str[2]){ + room_id=gid_str[2]; + room_user_share=1; + } + }; + ee.setData({ gid: gid}); + if(first_leader){ getApp().globalData.first_leader=first_leader; //调用接口判断是不是会员 @@ -268,21 +285,76 @@ Page({ }) //----获取系统参数----- - getApp().getConfig2(function(e) { - + getApp().getConfig2(function (e) { + ee.setData({ + bconfig: e, + sales_rules: e.sales_rules, + }); + + if (e.categoryset.indexOf("," + 1 + ",") != -1) { + ee.setData({ + is_show_pl: 1 + }); + } + if (e.categoryset.indexOf("," + 3 + ",") != -1) { + ee.setData({ + is_show_pp: 1 + }); + } + if (e.categoryset.indexOf("," + 2 + ",") != -1) { + ee.setData({ + is_show_gb: 1 + }); + } + console.log(e); var json_d = JSON.parse(e.switch_list); ee.setData({ store_config: e, - sys_switch:json_d, + sys_switch: json_d, + is_closecoupon: json_d.is_closecoupon, + is_newsales_rules: json_d.is_newsales_rules }); - - + ee.init(gid); + //------几人评价------- + //n.init(th, "", "comments"); + th.requestCardNum(), wx.pageScrollTo && th.setData({ supportPageScroll: !0 }); - - - },1); + + //计算等级价相关 + // var swithc_list = e.switch_list; + // var sw_arr = JSON.parse(swithc_list); + // //---如果后台又开等级卡的开关--- + // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + // th.setData({ rank_switch: true }); + // //---回调卡的列表--- + // th.getPlusCardType(function (ob) { + // th.setData({ card_list: ob.card_list }); + // var ti = setInterval(function () { + // var user = getApp().globalData.userInfo; + // if (!user) return false; + // clearInterval(ti); + // if (user.card_field && user['card_expiredate']) { + // var str = user['card_expiredate'].replace(/-/g, '/'); + // var end = new Date(str); + // end = Date.parse(end) / 1000; + // var now = ut.gettimestamp(); + // //--- 判断是等级会员,且在有效期范围内 --- + // if (user.card_field && now < end) { + // var card_name = ob.name_map.get(user.card_field); + // //if(card_name.length>6) card_name=card_name.substring(0,6); + + // var is_near_date = 0; + // if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 + // th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); + // } + // } + // }, 500) + // }) + // } + + }, 1); //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ @@ -376,20 +448,175 @@ Page({ }, //------------程序初始化入口------------- - async init(gid) {}, + async init(gid) { + var ee = this, + th = ee, + gallery = null, + is_collect = 0, + collect_id = 0, + categories3 = ee.data.categories3, + fir_com = null, + fir_quan = null, + mapurl = null, + mapurl_f_img = null; + + + //------图片滚动---------- + // await getApp().request.promiseGet("/api/weshop/goodsimages/page", { + // data: { + // store_id: os.stoid, + // goods_id: gid, + // }, + // }).then(res => { + + // var t = res; + // var g = t.data.data.pageData; + // if (g.length == 0) { + // var ie = { + // "image_url": o.imghost + "/public/images/default_goods_image_240.gif" + // }; + // g.push(ie); + // gallery = g; + // return; + // } + // for (var i = 0; i < g.length; i++) { + // if (g[i].image_url.indexOf(o.imghost) == -1) + // g[i].image_url = o.imghost + g[i].image_url; + // } + // gallery = g; + // }) + + + //------是否收藏---------- + await getApp().request.promiseGet("/api/weshop/goodscollect/page", { + data: { + store_id: os.stoid, + goods_id: gid, + user_id: oo.user_id, + } + }).then(res => { + var t = res; + var data = t.data.data.pageData; + if (data && data.length > 0) { + //ee.setData({ is_collect: 1, collect_id: data[0].collect_id, }); + is_collect = 1; + collect_id = data[0].collect_id; + } + }) + + //------获取评价的统计数量---- + await getApp().request.promiseGet("/api/weshop/serviceComment/countlist/", { + data: { + store_id: os.stoid, + service_id: gid + }, + //failRollback: !0, + + }).then(res => { + console.log('get评价统计数量', res.data.data); + var t = res; + var g = t.data.data[0]; + if (g != null && g != undefined) { + var allnum = g.c0 + g.c1 + g.c2 + g.c3 + g.c4 + g.c5; + var num2 = g.c4 + g.c5; + var num3 = g.c3; + var num4 = g.c0 + g.c1 + g.c2; + + var dd = ee.data.categories3; + dd[0].num = allnum; + dd[1].num = g.cimg; + dd[2].num = num2; + dd[3].num = num3; + dd[4].num = num4; + + categories3 = dd; + } + }) + + //----获取详情页的评价---- + await getApp().request.promiseGet("/api/weshop/serviceComment/pageComment", { + data: { + store_id: os.stoid, + service_id: gid, + pageSize: 3, + parent_id: 0, + page: 1, + is_show: 1, + }, + }).then(res => { + console.log('get详情页评价', res.data.data); + fir_com = res.data.data.pageData; + }) + + if (fir_com) { + for (var ind in fir_com) { + if (fir_com[ind].head_pic == "") fir_com[ind].head_pic = ee.data.iurl + "/miniapp/images/hui_hear_pic.png"; + if (fir_com[ind].img) fir_com[ind].img = ut.unserialize(fir_com[ind].img); + if (fir_com[ind].weapp_img) fir_com[ind].weapp_img = JSON.parse(fir_com[ind].weapp_img); + } + } + + // if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length<=0)) { + // //----获取详情页的券的数量---- + // await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { + // data: { + // store_id: os.stoid, + // type: 1, + // pageSize: 3, + // page: 1, + // is_share: 0, + // }, + // }).then(res1 => { + // fir_quan = res1.data.data.pageData; + // }) + // } + + + //this.getHistoryBuy(); //获取历史购买 + ee.setData({ + is_collect: is_collect, + collect_id: collect_id, + categories3: categories3, + fir_quan: fir_quan, + fir_comments: fir_com, + // cardComments: fir_com, + }); + + }, //---展示--- + // gid 在onload阶段已经保存在this.data中 onShow: function() { var that=this; - this.data.is_timer = 1; var ee = this,gid = this.data.gid, i = getApp().request; - this.wait_for_store_config(); + this.data.is_timer = 1; + this.wait_for_store_config(); i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { failRollback: !0, success: function(t) { if (t.data.code == 0) { - + // console.log('GET pic and video'); + if(t.data.data.listServiceVideos && t.data.data.listServiceVideos[0] && t.data.data.listServiceVideos[0].video_url) { + that.setData({ + mapurl: t.data.data.listServiceVideos[0].video_url, + }); + }; + if(t.data.data.listServiceVideos && t.data.data.listServiceVideos[0] && t.data.data.listServiceVideos[0].video_img) { + that.setData({ + mapurl_f_img: t.data.data.listServiceVideos[0].video_img, + }); + }; + if(t.data.data.listServiceImages) { + that.setData({ + gallery: t.data.data.listServiceImages, + }); + }; + if(t.data.data.listServiceItem) { + that.setData({ + listServiceItem: t.data.data.listServiceItem, + }); + }; that.setData({ 'data.goods_name': t.data.data.serviceName, 'data.shop_price': t.data.data.money, @@ -401,9 +628,14 @@ Page({ 'data.sales_sum': t.data.data.sales_sum, 'data.storageId':t.data.data.storageId, 'data.service_sn':t.data.data.serviceSn, + 'data.listServiceVideos': t.data.data.listServiceVideos, + // gallery: t.data.data.listServiceImages, + // mapurl: t.data.data.listServiceVideos[0].video_url, + // mapurl_f_img: t.data.data.listServiceVideos[0].video_img, + //listServiceItem: t.data.data.listServiceItem, }); - + console.log('0xxxxx999999', t.data.data); //-----商品详情--- if(!t.data.data.serviceContent) t.data.data.serviceContent=" "; a.wxParse("content", "html", t.data.data.serviceContent, ee, 6); @@ -433,9 +665,10 @@ Page({ } }); this.data.enterAddressPage && (this.data.enterAddressPage = !1); - this.get_sto(); + this.get_sto(); }, + enterAddress: function() { this.data.enterAddressPage = !0, wx.navigateTo({ url: "/pages/user/address_list/address_list?operate=selectAddress" @@ -697,6 +930,7 @@ Page({ user_id: s.globalData.user_id, store_id: o.stoid, add_time: timestamp, + type: 1, }; //加入收藏夹就是导购的ID if(getApp().globalData.guide_id){ @@ -797,7 +1031,7 @@ Page({ } - var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; + var url="/packageA/pages/goodsInfo/goodsInfo?goods_id=" + th.data.gid; if(getApp().globalData.user_id){ url+="&first_leader="+getApp().globalData.user_id; } @@ -815,25 +1049,25 @@ Page({ path:url, imageUrl: img, }; - if(th.data.prom_type==6){ - title+='\n'+th.data.prom_act.share_remark; - ob.title=title; - ob.desc=th.data.prom_act.share_remark; - } + // if(th.data.prom_type==6){ + // title+='\n'+th.data.prom_act.share_remark; + // ob.title=title; + // ob.desc=th.data.prom_act.share_remark; + // } //如果是积分购的时候 - if(th.data.prom_type==4){ - var name = th.data.prom_act.name; - //-- 积分购的 -- - var pri0 = th.data.prom_act.addmoney; - var integral=th.data.prom_act.integral; - var text=""; - if(integral){text=integral+"积分"; } - if(pri0 && integral){ text+="+";} - if(pri0){ text+="¥"+pri0;} + // if(th.data.prom_type==4){ + // var name = th.data.prom_act.name; + // //-- 积分购的 -- + // var pri0 = th.data.prom_act.addmoney; + // var integral=th.data.prom_act.integral; + // var text=""; + // if(integral){text=integral+"积分"; } + // if(pri0 && integral){ text+="+";} + // if(pri0){ text+="¥"+pri0;} - ob.title= text+" "+name; - } + // ob.title= text+" "+name; + // } return ob; @@ -1642,7 +1876,7 @@ Page({ // ----视频图片---- // 图片计数器 - swiperChange: function(e) { + swiperChange: function (e) { var that = this; if (e.detail.current > 0) { that.setData({ @@ -1661,6 +1895,31 @@ Page({ }) } }, + + /*---视频相关--*/ + videopicture: function (e) { + var vipi = e.currentTarget.dataset.vipi; + this.setData({ + videopicture: vipi, + swiperCurrent: vipi, + noon: 0, + current: 1 + }); + }, + + videoPlay: function (e) { + var _index = e.currentTarget.id + this.setData({ + _index: _index, + noon: 1 + }) + + setTimeout(function () { + //将点击视频进行播放 + var videoContext = wx.createVideoContext(_index) + videoContext.play(); + }, 500) + }, //--获取头像的本地缓存,回调写法-- get_head_temp: function(tt, func) { @@ -2244,10 +2503,210 @@ Page({ corpId: id, success(res) {} }) - } - - + }, + + //评论的调用 + requestComments_new: async function () { + var e = this, th = e, ee = e; var tp = e.data.activeCategoryId3; + var t = '/api/weshop/serviceComment/pageComment?page=' + e.data.c_curr_p; + + wx.showLoading(); + var req_where = { + store_id: o.stoid, pageSize: 5, is_show: 1, + parent_id: 0, goods_id: th.data.gid, commenttype: tp, + service_id: this.data.gid, + } + if (getApp().globalData.userInfo) { + req_where.userId = getApp().globalData.user_id; + } + + var rs_data = null; + await getApp().request.promiseGet(t, { data: req_where }).then(res => { + var tot = res.data.data.total; + e.data.c_curr_p++; + e.setData({ + com_num: tot, //已经有加载 + }); + if (res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { + rs_data = res.data.data.pageData; + } else { + th.setData({ comments_no_more: 1, auto: 1 }); + } + }) + + if (rs_data) { + //var cda = th.data.comments; + var cda = rs_data, com_data = th.data.comments; + for (var ind in cda) { + var ep = cda[ind]; + if (cda[ind].head_pic == '') { + cda[ind].head_pic = th.data.iurl + "/miniapp/images/hui_hear_pic.png"; + } + if (ep.weapp_img != "" && ut.isString(ep.weapp_img)) { + cda[ind].weapp_img = JSON.parse(ep.weapp_img); + } + if (ep.img != "" && ut.isString(ep.img)) { + cda[ind].img = ut.unserialize(ep.img); + } + + //--测量多有字的宽带,计算有多少行-- + var widh = ut.measureText(ep.content, 30); + var lines = widh / 712; + cda[ind].seeMore = false; + if (lines > 3) cda[ind].seeMore = true; + + await getApp().request.promiseGet("/api/weshop/serviceComment/pageComment", { + data: { + store_id: o.stoid, + parent_id: ep.comment_id, + service_id: this.data.gid, + } + }).then(res => { + if (res.data.data.pageData && res.data.data.pageData.length > 0) { + cda[ind].replay_list = res.data.data.pageData; + } + }) + } + + if (!com_data) com_data = cda; + else com_data = com_data.concat(cda); + + th.setData({ comments: com_data }); + } + th.setData({ get_c: 1 }); + wx.hideLoading(); + }, + + + + //--点赞功能-- + click_zan: function (e) { + var com_id = e.currentTarget.dataset.com_id; + var item_id = e.currentTarget.dataset.item_id; + var app = getApp(), + th = this; + + if (app.globalData.userInfo == null || app.globalData.userInfo == undefined) { + app.confirmBox("您还未登录"); + return false; + } + + var iszan = th.data.comments[item_id].userZanNum; + if (this.data.iszaning) return false; + this.data.iszaning = 1; + + + app.request.post("/api/weshop/serviceCommentZan/save", { + data: { + store_id: o.stoid, + user_id: app.globalData.user_id, + goods_id: th.data.gid, + service_id: th.data.gid, + comment_id: com_id + }, + success: function (ee) { + + if (ee.data.code == "-1") { + app.my_warnning("不能给自己点赞", 0, th); + th.data.iszaning = 0; + return; + } + + if (ee.data.code == 0 && iszan != 1) { + var num = th.data.comments[item_id].zan_num; + num++; + var text = "comments[" + item_id + "].zan_num"; + var text1 = "comments[" + item_id + "].userZanNum"; + var _errObj = {}; + _errObj[text] = num; + _errObj[text1] = 1; + th.setData(_errObj); + + } else { + var num = th.data.comments[item_id].zan_num; + num--; + var text = "comments[" + item_id + "].zan_num"; + var text1 = "comments[" + item_id + "].userZanNum"; + var _errObj = {}; + _errObj[text] = num; + _errObj[text1] = 0; + th.setData(_errObj); + } + + setTimeout(function () { + th.data.iszaning = 0; + }, 500) + + } + }) + }, + + + //--外侧评价的点击效果--- + clik_evaluate: function (e) { + var val = e.currentTarget.dataset.val; + this.setData({ + activeCategoryId: 2, + activeCategoryId3: val, + comments: null + }); + this.requestComments_new(); + }, + + + //显示全部 + toggleHandler: function (e) { + var that = this, + index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.comments.length; i++) { + if (index == i) { + for (var i = 0; i < that.data.comments.length; i++) { + that.data.comments[index].auto = true; + that.data.comments[index].seeMore = false; + } + } + } + that.setData({ + comments: that.data.comments + }) + }, + + //收起更多 + toggleContent: function (e) { + var that = this, + index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.comments.length; i++) { + if (index == i) { + that.data.comments[index].auto = true; + that.data.comments[index].seeMore = true; + } + } + that.setData({ + comments: that.data.comments + }) + }, + + //--查看评价-- + look_pj: function () { + this.tabComment(); + this.doScrollTop(); + }, + + previewCommentImgs_w: function (t) { + var e = this.data.comments[t.currentTarget.dataset.cidx].weapp_img; + var b = e.slice() + // for (var i in b) { + // b[i] = this.data.iurl + e[i]; + // } + this.data.show_prew_img = 1; + wx.previewImage({ + current: b[t.currentTarget.dataset.id], + urls: b + }); + }, + + }); diff --git a/packageA/pages/goodsInfo/goodsInfo.json b/packageA/pages/goodsInfo/goodsInfo.json index ab98d72..d201627 100644 --- a/packageA/pages/goodsInfo/goodsInfo.json +++ b/packageA/pages/goodsInfo/goodsInfo.json @@ -4,6 +4,6 @@ "usingComponents": { "nav_box": "/components/nav_box/nav_box", "warn": "/components/long_warn/long_warn", - "goods_recommend": "/components/goods_list/goods_list" + "serviceCard_recommend": "/components/serviceCard_list/serviceCard_list" } } \ No newline at end of file diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 4b1d717..b6516a5 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -15,7 +15,44 @@