diff --git a/packageG/pages/goods/com_screen.js b/packageG/pages/goods/com_screen.js new file mode 100644 index 0000000..8c74aac --- /dev/null +++ b/packageG/pages/goods/com_screen.js @@ -0,0 +1,241 @@ +const ut = require("../../../utils/util.js"); +var regeneratorRuntime = require('../../../utils/runtime.js'); +var oo = getApp().globalData.setting; +module.exports = { + //下拉排序 + bind_pk_sort:function (e,th){ + var index=e.detail.value; + var ob=th.data.more_sort_arr[index]; + + var url = th.data.requestUrl; + if (th.data.tabname!=ob.value){ + + var txt='desc'; + if(ob.value=='sort') txt='asc' + th.setData({ tabname: ob.value, adname:txt }); + } + th.resetData(); + + //开始点击分类 + if(th.requestGoodsList) { + //-- 开始点击分类 -- + th.requestGoodsList(url); + }else if(th.requestSearch){ + //-- 重新开始搜索 -- + th.requestSearch(url); + } + + }, + + //-- 获取列表 -- + set_screen:async function (url,th){ + if(!url) url=th.data.requestUrl; + + var arr=url.split('1=1&'); + url='/api/weshop/goods/goodsBrandGroup?'+arr[1]; + + var screen_brand=null; + var screen_nation=null; + var screen_price=null; + var screen_cate=null; + //如果有分类的话 + if( th.data.cat_id && !th.data.screen_cate){ + var c_url="/api/weshop/goodscategory/get/"+oo.stoid+"/"+ th.data.cat_id; + var f_cate=null; + await getApp().request.promiseGet(c_url,{ + }).then(res=>{ + if(res.data.code==0 && res.data.data){ + f_cate=res.data.data; + } + }) + + //分类必须有parent_id_path值 + if(f_cate && f_cate['parent_id_path']){ + var new_arr=f_cate['parent_id_path'].split('_'); + c_url='/api/weshop/goodscategory/page?store_id='+oo.stoid+'&parent_id_path='+(new_arr[0]+"_"+new_arr['1']); + await getApp().request.promiseGet(c_url,{ + data:{level:2,pageSize:1000} + }).then(res=>{ + if(ut.ajax_ok(res) ){ + screen_cate=res.data.data.pageData.filter(function(e){ + return e.name + }); + } + }) + } + + } + + + if(url.indexOf('brand_id')==-1) { + var url1 = url + "&grouptype=1"; + await getApp().request.promiseGet(url1, { + data: {is_mainshow: 1, isonsale: 1, store_id: oo.stoid} + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length) { + screen_brand = res.data.data.filter(function(e){ + return e.name + }); + } + }) + } + + if(url.indexOf('nation_id')==-1) { + url1 = url + "&grouptype=2"; + await getApp().request.promiseGet(url1, { + data: {is_mainshow: 1, isonsale: 1, store_id: oo.stoid} + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length) { + screen_nation = res.data.data.filter(function(e){ + return e.name; + }); + } + }) + } + + + if(url.indexOf('startprice')==-1) { + url1 = url + "&grouptype=3"; + await getApp().request.promiseGet(url1, { + data: {is_mainshow: 1, isonsale: 1, store_id: oo.stoid} + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length) { + var price = res.data.data; + var max_price = price[0].final_price; + var psize = Math.ceil(max_price / 5); // 每一段累积的价钱 + var parr = []; + for (var i = 0; i < 5; i++) { + var start = i * psize; + var end = start + psize; + // 如果没有这个价格范围的商品则不列出来 + var ii = false; + for (var v in price) { + var item_p = price[v]; + if (item_p.final_price > start && item_p.final_price <= end) { + ii = true; + } + } + if (ii == false) continue; + var obj = {}; + obj['price'] = start + "-" + end; + if (i == 0) obj['name'] = end + "元以下"; + else if (i == 4) obj['name'] = start + "元以上"; + else obj['name'] = start + "-" + end + '元'; + parr.push(obj) + } + screen_price = parr; + } + }) + } + + th.setData({screen_brand,screen_nation,screen_price,screen_cate}) + + }, + + + filterGoods:function (e,th){ + + var index=e.currentTarget.dataset.index; + var type=e.currentTarget.dataset.type; + var url=th.data.requestUrl; + + switch (type){ + case "1"://分类 + var item=th.data.screen_cate[index]; + if( th.data.cat_id){ + var arr_m=url.split("1=1&"); + var arr_m2=arr_m[1].split('&'); + var url=""; + for(var jj in arr_m2){ + if(arr_m2[jj].indexOf('cat_id')>=-1){ + url+="&cat_id="+item.id; + }else if(arr_m2[jj].indexOf('pid')>=-1){ + url+="&pid="+item.parent_id; + }else{ + url+="&"+arr_m2[jj]; + } + } + }else { + url+="&cat_id="+item.id+"&pid="+item.parent_id; + } + url=arr_m[0]+"1=1&"+url; + break; + case "2"://国别 + var item=th.data.screen_nation[index]; + url+="&nation_id="+item.nation_id; + break; + case "3"://品牌 + var item=th.data.screen_brand[index]; + url+="&brand_id="+item.brand_id; + break; + case "4"://价格 + var item=th.data.screen_price[index]; + var p_arr=item.price.split('-'); + url+="&startprice="+p_arr[0]+"&endprice="+p_arr[1]; + break; + } + + th.setData({screen_brand:null,screen_nation:null,openFilterModal:0,is_go:0, + screen_price:null,screen_cate:null,requestData:null}) + th.data.currentPage=1; + //进行筛选 + this.set_screen(url,th); + + th.setData({ + tabname:"sort", //排序的字段 + adname:"asc", //升降的字段 + }) + + //开始点击分类 + if(th.requestGoodsList) { + //-- 开始点击分类 -- + th.requestGoodsList(url); + }else if(th.requestSearch){ + //-- 重新开始搜索 -- + th.requestSearch(url); + } + }, + + //-- 展开和收起的控制 -- + open_more:function(e,th){ + var type=e.currentTarget.dataset.type; + switch(type){ + case "1": + if(th.data.fil_cate_state==0 || th.data.fil_cate_state==2) th.setData({fil_cate_state:1}) + else th.setData({fil_cate_state:2}) + break; + case "2": + if(th.data.fil_nation_state==0 || th.data.fil_nation_state==2) th.setData({fil_nation_state:1}) + else th.setData({fil_nation_state:2}) + break; + case "3": + if(th.data.fil_brand_state==0 || th.data.fil_brand_state==2) th.setData({fil_brand_state:1}) + else th.setData({fil_brand_state:2}) + break; + case "4": + if(th.data.fil_price_state==0 || th.data.fil_price_state==2) th.setData({fil_price_state:1}) + else th.setData({fil_price_state:2}) + break; + + } + }, + + clear_fil(th){ + var url=th.data.old_req_url; + th.setData({screen_brand:null,screen_nation:null,openFilterModal:0,is_go:0, + screen_price:null,screen_cate:null,requestData:null}) + th.data.currentPage=1; + + //进行筛选 + this.set_screen(url,th); + if(th.requestGoodsList) { + //-- 开始点击分类 -- + th.requestGoodsList(url); + }else if(th.requestSearch){ + //-- 重新开始搜索 -- + th.requestSearch(url); + } + } + + +} \ No newline at end of file diff --git a/packageG/pages/goods/com_screen.wxss b/packageG/pages/goods/com_screen.wxss new file mode 100644 index 0000000..7309f21 --- /dev/null +++ b/packageG/pages/goods/com_screen.wxss @@ -0,0 +1,79 @@ +/*--三角形的显示--*/ +.arrow_down,.arrow_up{ + width: 0px; + height: 0px; + font-size: 0; + line-height: 0; + border-right: 5px solid transparent; + border-left: 5px solid transparent; +} + +.arrow_down { + border-top: 5px solid #a5a5a5; margin-top: 4rpx; +} +.arrow_up{ + border-bottom: 5px solid #a5a5a5; +} + +.arrow_down.on{ + border-top: 5px solid #F4281C ; +} +.arrow_up.on{ + border-bottom: 5px solid #F4281C; +} + +.f_cate_item{ height:80rpx; display:flex; justify-content: space-between; align-items: center; border-bottom: 1rpx solid #dcdcdc;} + +.filter-items{ color: #666; overflow:hidden} +.filter-items.normal_to{ max-height: 260rpx} +.filter-items.back_to{ height: 0rpx} + +.up_ar{ transform: rotate(180deg)} +.fil_btn{ width: 47%; height:80rpx; border-radius:10rpx; display: flex; + justify-content:center; align-items: center; font-size:28rpx;color:#fff} +.fil_cancle{ background-color: #25c6fc } +.fil_sure{ background-color:#dd272c } + +.filter-modal { + position: fixed; + left: 150rpx; + top: 0; + right: 0; + bottom: 0; + z-index: 1120; + background-color: white; + overflow-x: hidden; +} + +.filter-box { + box-sizing: border-box; + width: 100%; + font-size: 28rpx; + padding: 20rpx; +} + +.filter-name { + width: 100%; + padding: 20rpx 0; + word-break: keep-all; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: 30rpx; +} + +.filter-item { + float: left; + width: fit-content; + max-width: 500rpx; + word-break: keep-all; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding: 10rpx; + border-radius: 10rpx; + border: 1rpx #ddd solid; + margin: 0 10rpx 10rpx 0; + background-color: #fdfdfd; + color: #666; +} \ No newline at end of file diff --git a/packageG/pages/goods/search/g_filter.wxs b/packageG/pages/goods/search/g_filter.wxs new file mode 100644 index 0000000..c4f0f55 --- /dev/null +++ b/packageG/pages/goods/search/g_filter.wxs @@ -0,0 +1,107 @@ +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 arr = []; + var min_price = 0; + var min_name = ""; + + 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 (price1 < min_price) { + min_price = price1; min_name = vl['CardName']; + } + } + if (vl['CorrPrice'] == "Price2" && price2 > 0) { + if (min_price == null) { + min_price = price2; min_name = vl['CardName']; + } + else if (price2 < min_price) { + min_price = price2; min_name = vl['CardName']; + } + } + + if (vl['CorrPrice'] == "Price3" && price3 > 0) { + if (min_price == null) { + min_price = price3; min_name = vl['CardName']; + } + else if (price3 < min_price) { + min_price = price3; min_name = vl['CardName']; + } + } + + } + if (min_price == null) { + if (type == 0) return 0; + return ""; + } + + //if(type==0) return arr.length; + //--进行排序,升序--- + /*--- + arr.sort(function(a,b){ + if (a.price < b.price) { + return -1; + } else if (a.fee == b.fee) { + return 0; + } else { + return 1; + } + })--*/ + //-- 获取最下价钱,和相应的卡的名称 -- + //min_price=min.price; + //min_name=min.name; + if (type == 0) return min_price.toFixed(2); + if (min_name.length > 7) min_name = min_name.substring(0, 8); + return min_name; + }, + + + get_goods_url: function (item) { + + var url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type="+item.prom_type + // 预售活动 + if (item.prom_type == 8) { + url1 = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + } + // 如果是幸运购活动商品 + if (item.prom_type == 9) { + url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id + } + + if ([1,2,6].indexOf(item.prom_type)>-1 && item.prom_id > 0) { + url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type="+item.prom_type; + } + + + return url1; + } +} + +module.exports = { + is_has_rank: g_filters.is_has_rank, + get_card_price: g_filters.get_card_price, + get_goods_url: g_filters.get_goods_url +} \ No newline at end of file diff --git a/packageG/pages/goods/search/search.js b/packageG/pages/goods/search/search.js new file mode 100644 index 0000000..b5778d4 --- /dev/null +++ b/packageG/pages/goods/search/search.js @@ -0,0 +1,609 @@ +var t = function (t) { + return t && t.__esModule ? t : { + default: t + }; +}(require("../../../../utils/LoadMore.js")), ut = require("../../../../utils/util.js"), + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting; +const com_fil = require("../com_screen.js"); + +Page({ + data: { + url: a.globalData.setting.imghost, + resourceUrl: a.globalData.setting.resourceUrl, + currentPage: 1, + requestData: null, + allData: null, + openFilterModal: !1, + openSearchModal: !1, + baseUrl: "/api/weshop/goods/page?isnewwhere=1", + requestUrl: "", + old_req_url:'', + //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ] + hotWords: null, + is_no_plus: 1, + tabname: "sort", //排序的字段 + adname: "asc", //升降的字段 + rq_data: null, + searchRecord: [], + keyword: '', + is_his: 0, + hiddenClear: true, + fliter_flag: false, + + more_sort_arr:[ + {name:'综合',value:'sort'}, + {name:'新品',value:'on_time'}, + {name:'评论',value:'comment_count'}, + ], + + fil_cate_state:0, + fil_nation_state:0, + fil_brand_state:0, + fil_price_state:0, + }, + + onLoad: function (t) { + this.data.rq_data = t; + //群id + if(t && t.groupchat_id){ + getApp().globalData.groupchat_id=t.groupchat_id + } + if (t.o) { + this.data.rq_data.o = JSON.parse(t.o); + }; + if(t.o) { + var req = t.o; + if(req.cat_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&cat_id="+req.cat_id + this.setData({ baseUrl: baseUrl }); + } + if(req.nation_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&nation_id="+req.nation_id + this.setData({ baseUrl: baseUrl }); + } + if(req.brand_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&brand_id="+req.brand_id + this.setData({ baseUrl: baseUrl }); + } + }else{ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1" + this.setData({ baseUrl: baseUrl }); + } + + + + //接受有没有导购的参数 + var first_leader = t.first_leader; + if (first_leader) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id= res.data.data.pickup_id + } + }) + } + + //调用接口判断商家plus有没有过期 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + + var th = this; + a.getConfig2(function (rs) { + var arr = new Array(), arr2 = new Array(); + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") { + var arr1 = rs.hot_keywords.split('|'); + for (var i = 0; i < arr1.length; i++) { + if (i % 5 == 0 && i != 0) { + arr.push(arr2); + arr2 = []; + } else { + arr2.push(arr1[i]); + } + } + if (arr2.length > 0) arr.push(arr2); + th.setData({ hotWords: arr }); + } + + + //计算等级价相关 + var swithc_list = rs.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + ut.get_plus_name_price(sw_arr,th); + if(sw_arr.is_retail_price){ + th.setData({is_retail_price:1}); + } + + }) + //e.init(this, "", "requestData"); + var url = this.data.baseUrl; + + //扫一扫过来,显示搜索的内容 + var s_key = t.s_key; + if (s_key) { + s_key = s_key.trim(); + this.search(s_key); this.openSearchModal(); + return; + } + + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; } + if (0 != t.ladder_id && t.ladder_id != undefined) { + url += "&ladder_id=" + t.ladder_id; + this.setData({ + baseUrl: url, + }) + } + if (url != this.data.baseUrl) return this.requestSearch(url); + this.openSearchModal(); + // 获取历史搜索记录 + this.getHistorySearch(); + }, + + onShow: function () { + getApp().check_can_share(); + }, + + changeTab: function (t) { + var ord = t.currentTarget.dataset.href; + var ad = t.currentTarget.dataset.ad; + + var url = this.data.requestUrl; + + if (this.data.tabname != ord) { + this.setData({ tabname: ord, adname: "desc" }); + } else { + ad = ad == "desc" ? "asc" : "desc"; + this.setData({ adname: ad }); + } + this.resetData(), this.requestSearch(url); + + }, + + //-----------真的调用地址进行搜索------------ + requestSearch: function (t) { + // console.log('t===>', t); + if (this.data.loading) return false; + this.data.loading = 1; + var e = this, th = e; + if (getApp().globalData.userInfo) { + t += "&user_id=" + getApp().globalData.userInfo.user_id; + } + this.data.requestUrl = t; + + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + let data = { + is_mainshow: 1, + isonsale: 1, + store_id: oo.stoid, + orderField: e.data.tabname, + orderType: e.data.adname, + page: e.data.currentPage, + }; + + let o = this.data.rq_data.o; + if (o) { + if (o.cat_id) data.cat_id = o.cat_id; + if (o.pid && o.pid != 'three') data.parent_id = o.pid; + if (o.nation_id) data.nation_id = o.nation_id; + if (o.brand_id) data.brand_id = o.brand_id; + }; + + + getApp().request.promiseGet(t, { data: data }).then(async res => { + th.data.loading = 0; + if (ut.ajax_ok(res)) { + if (!e.data.requestData) { + // e.data.requestData=[]; + e.setData({ + requestData: [], + }); + }; + for (let i in res.data.data.pageData) { + let item = res.data.data.pageData[i]; + item.original_img = th.data.url + item.original_img; + + /*-- + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:oo.stoid,goodsidlist:item.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; + } + })--*/ + + var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 + var prom_id = item.prom_id; + var now = ut.gettimestamp(); + var url = ""; + switch (prom_type) { + case 1: + url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id; + break; + case 2: + url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id + break; + case 4: + url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id; + break; + case 6: + url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", { + data: { + store_id: oo.stoid, + is_end: 0, + is_show: 1, + user_id: getApp().globalData.user_id, + pageSize: 1000, + } + }).then(pd => { + let pd_list = pd.data.data.pageData; + if (res.data.code == 0 && pd_list.length > 0) { + var flag = pd_list.some(pd => { + return pd.goods_id == item.goods_id + }) + + if (!flag) { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; + } + } + }) + break; + case 8: + var presell_id = prom_id; + var url1 = "/api/weshop/marketing/marketingPresellList/list"; + var rd = { + store_id: oo.stoid, + presell_id: presell_id, + goods_id: item.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.presell_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(async res => { + var prom = null; + if (res.data.code == 0 && res.data.data) { + prom = res.data.data; + + if (prom != null && prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom_type!=2 && prom.show_time && prom.show_time < now))) { + item.prom_price = res.data.data.price; + if(prom_type==4){ + item.prom_price= res.data.data.addmoney; + } + + if (res.data.data.user_price) item.prom_price = res.data.data.user_price; + var vNum = prom.virtual_num ? prom.virtual_num : 0; + var vNum1 = prom.virtualNum ? prom.virtualNum : 0; + var vNum2 = prom.virtual ? prom.virtual : 0; + item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2); + } else { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; + } + } + }) + }; + if (!th.data.requestData) th.data.requestData = []; + th.data.requestData.push(item); + e.setData({ requestData: e.data.requestData }); + } + } + e.closeSearchModal(); + }) + }, + onReachBottom: function () { + console.log('触发上滑加载事件'); + this.data.currentPage++ + console.log('触发上滑加载事件currentPage', this.data.currentPage); + this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl); + }, + + + openFilterModal: function () { + this.setData({ + openFilterModal: !0 + }); + }, + closeFilterModal: function () { + this.setData({ + openFilterModal: !1 + }); + }, + filterGoods: function (t) { + this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal(); + }, + + + + resetData: function () { + e.resetConfig(), + // this.data.requestData = null, + this.data.currentPage = 1; + this.setData({ + requestData: null, + }); + }, + + //---回复最初的设置---显示全部分类-- + restoreData: function () { + this.setData({ + requestData: this.data.allData, + }); + this.data.currentPage = 2; + }, + openSearchModal: function () { + this.setData({ + openSearchModal: !0 + }); + }, + closeSearchModal: function () { + this.setData({ + openSearchModal: !1 + }); + }, + + submitSearch: function (t) { + var val = t.detail.value.word; + if (val == undefined) val = t.detail.value; + val = val ? val.trim() : ''; + if (!val) { + a.showWarning("请输入关键词"); + } + this.search(val); + }, + + //热搜关键字 + searchHotWord: function (t) { + var word = t.currentTarget.dataset.word; + if (word) { + this.setData({ + keyword: word, + hiddenClear: false, + }); + }; + this.historyRecord(word); + this.search(word); + }, + + //-----点击搜索按钮---- + search: function (t) { + if ("string" != typeof t || "" == t) return a.showWarning("请输入关键词"); + this.data.key_str = t; + this.resetData(); + + this.data.old_req_url=this.data.baseUrl + "&key_str=" + encodeURIComponent(t); + + this.set_screen(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)) + this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); + this.historyRecord(); + }, + + //---------分享配置-------- + onShareAppMessage: function (e) { + getApp().globalData.no_clear = 1; + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + + if (this.data.key_str) { + pagePath += "?s_key=" + this.data.key_str; + } + + if (getApp().globalData.user_id) { + + if (pagePath.indexOf("?") > 0) { + pagePath += "&first_leader=" + getApp().globalData.user_id; + } else { + pagePath += "?first_leader=" + getApp().globalData.user_id; + } + } + //群id分享 + if (getApp().globalData.groupchat_id) { + pagePath+="&groupchat_id="+getApp().globalData.groupchat_id + } + + // console.log("11-11"+pagePath); + return { + title: "商品搜索", + path: pagePath, + } + }, + + + //---------图片失败,默认图片-------- + bind_bnerr: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + //--- 获取卡类列表 --- + getPlusCardType: function (func) { + var storid = oo.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; + + 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); + }) + }, + + + getInput(e) { + let val = e.detail.value; + if (val) { + this.setData({ + keyword: e.detail.value, + hiddenClear: false, + }); + } else { + this.setData({ + hiddenClear: true, + }); + } + + }, + + historyRecord(w) { + let keyword = w; + let self = this; + if (!keyword) { + keyword = this.data.key_str.trim(); + } + let searchRecord = this.data.searchRecord; + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || []; + + if (keyword) { + + var index = searchRecord.indexOf(keyword); + if (index > -1) { + // 已经存在该值 + searchRecord.splice(index, 1); + searchRecord.unshift(keyword); + + // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + + return; + } else { + if (searchRecord.length >= 10) { + searchRecord.pop(); // 删除最早的一条记录 + }; + searchRecord.unshift(keyword); + + // // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + }; + }; + }, + + closePoster() { + this.setData({ + fliter_flag: false, + }); + }, + + show_fliter() { + this.setData({ + fliter_flag: true + }) + }, + fliter_close() { + this.setData({ + fliter_flag: false, + }) + }, + + + // 获取历史搜索记录 + getHistorySearch() { + this.setData({ + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 + }); + }, + + // 清除历史搜素记录 + clearSearchRecord() { + wx.clearStorageSync('searchRecord'); + this.setData({ + searchRecord: [] + }); + }, + + go_url: function (e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + + clearInput() { + this.setData({ + keyword: '', + hiddenClear: true, + openSearchModal: true, + }); + }, + + inputFocus(e) { + this.setData({ + openSearchModal: true, + }); + }, + + /*-- 和筛选相关的 --*/ + bind_pk_sort(e){ com_fil.bind_pk_sort(e,this); }, + set_screen(url){ com_fil.set_screen(url,this); }, + filterGoods(e){ com_fil.filterGoods(e,this); }, + open_more(e){ com_fil.open_more(e,this); }, + clear_fil(){ com_fil.clear_fil(this); } + + +}); \ No newline at end of file diff --git a/packageG/pages/goods/search/search.json b/packageG/pages/goods/search/search.json new file mode 100644 index 0000000..daca033 --- /dev/null +++ b/packageG/pages/goods/search/search.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "商品搜索", + "enablePullDownRefresh": false, + "usingComponents": { + "share_box": "/components/share_box/share_box" + }, + "componentPlaceholder": { + "van-popup": "view" + } +} \ No newline at end of file diff --git a/packageG/pages/goods/search/search.wxml b/packageG/pages/goods/search/search.wxml new file mode 100644 index 0000000..1b7c591 --- /dev/null +++ b/packageG/pages/goods/search/search.wxml @@ -0,0 +1,181 @@ + + + + + +
+ + + + + + + +
+
+ + + + + + + 历史搜索 + + + + + {{item}} + + + 暂无历史搜索记录 + + + + 热门搜索 + + + {{item}} + + + + + + + + + + + + + + 新品 + 评论 + 综合 + + + + + + + + 筛选 + + + + + + + + + + + + + + + {{item.goods_name}} + + + + + {{item.prom_integral}}积分 + + + ¥{{item.prom_price}} + + + + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + + + + + + ¥{{item[card_field]}} + + + + {{card_name}} + + + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + + + ¥{{g_filter.get_card_price(item,card_list,0)}} + + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + + + + + + + 没有相关的数据 + 去逛逛 + + + +
+ + \ No newline at end of file diff --git a/packageG/pages/goods/search/search.wxss b/packageG/pages/goods/search/search.wxss new file mode 100644 index 0000000..6f525a6 --- /dev/null +++ b/packageG/pages/goods/search/search.wxss @@ -0,0 +1,397 @@ +.container { + color: #666; + overflow: visible; +} + +.nav { + position: sticky; + top: 90rpx; + background-color: white; + z-index: 99; +} + +.nav-item { + /* float: left; + width: 30%; + height: 90rpx; + line-height: 90rpx; */ + padding: 14rpx 10rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + border-bottom: 2rpx solid #E6E6E6; + background-color: #fff; +} + +.nav-item .ico-dg { + width: 18rpx; + height: 12rpx; + margin-left: 10rpx; + line-height: 0; +} + +.nav-item .ico-filter { + width: 20rpx; + height: 20rpx; + margin-left: 10rpx; + line-height: 0; +} + +.ico-dir { + width: 16rpx; + height: 22rpx; + margin-left: 10rpx; + background-repeat: no-repeat; + background-size: cover; + background-position-x: 0; +} + +.ico-dir-dn { + background-position-x: -16rpx; +} + +.ico-dir-up { + background-position-x: -32rpx; +} + +.nav-search { + width: 10%; +} + +.nav-item .search-img { + width: 30rpx; + height: 30rpx; +} + +.choice_list { + background-color: #fff; +} + +.choice_item { + position: relative; + width: 100%; + min-height: 200rpx; + padding: 10rpx 0; + border-bottom: 2rpx solid #E6E6E6; + font-size: 30rpx; +} + +.img-wrap { + /* float: left; */ + width: 180rpx; + height: 180rpx; + padding: 0 10rpx 0 30rpx; + flex-shrink: 0; + /* padding: 10rpx; */ +} + +.img-wrap image { + width: 100%; + height: 100%; +} + +.item-cont .title { + height: 72rpx; + margin: 16rpx 0; + padding-right: 30rpx; + line-height: 36rpx; + color: #333; + overflow: hidden; + text-align: justify; +} + +.price { + display: inline-block; + color: #f23030; + /* line-height: 24rpx; */ + /* padding-bottom: 20rpx; */ +} + +.comment { + font-size: 25rpx; + padding-right: 30rpx; + margin-top: 4rpx; +} + + +.viewall-btn { + margin-top: 20rpx; + width: 300rpx; +} + +.search-modal { + /* position: fixed; + top: 0; + right: 0; + left: 0; + bottom: 0; + z-index: 20; + background-color: white; + overflow-x: hidden; + padding: 80rpx 30rpx; + font-size: 30rpx; + color: #555; */ +} + +.search-bar { + /* width: 100%; + box-sizing: border-box; */ + background-color: white; + position: sticky; + top: 0; + z-index: 1; +} + +.search-input { + width: 80%; + float: left; + border: 1rpx solid #e0e0e0; + box-sizing: border-box; + height: 80rpx; + padding-left: 20rpx; + border-top-left-radius: 10rpx; + border-bottom-left-radius: 10rpx; +} + +.search-btn { + width: 20%; + height: 80rpx; + background-color: #f23030; + display: inline-block; + text-align: center; + border-top-right-radius: 10rpx; + border-bottom-right-radius: 10rpx; +} + +.search-btn .search-img { + height: 45rpx; + width: 45rpx; + padding: 20rpx; +} + +.search-hot { + margin-top: 40rpx; +} + +.hot-title { + font-size: 35rpx; + color: black; + /* margin-bottom: 30rpx; */ +} + +.hot-row { + display: flex; + /*--justify-content: space-between---*/ + padding: 10rpx 0; +} + +.hot-item { + padding: 6rpx 20rpx; + border: 2rpx solid #e0e0e0; + border-radius: 40rpx; + font-size: 28rpx; + margin-right: 16rpx; +} + +/* .card_bg { + display: flex; + max-width: 110rpx; + height: 25rpx; + align-items: center; + border-radius: 26rpx; + font-size: 19rpx; + padding: 2rpx 10rpx; + background: #333; + color: #fff; + justify-content: center; + margin-left: 8rpx; + margin-top: 7rpx; + line-height: 25rpx; + width: auto; +} */ + +.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; + flex-shrink: 0; +} + +.card_name { + position: relative; + top: -4rpx; +} + +/* .card_bg image { + width: 19rpx; + height: 19rpx; + margin-right: 1rpx; + vertical-align: middle; +} + +.card_bg .card_name { + max-width: 76rpx; + width: auto; + overflow: hidden; + white-space: nowrap; +} */ + +.navigator-hover { + opacity: 1; +} + +.mk_price { + margin-left: 10rpx; + font-size: 25rpx; +} + +.item-cont { + /* line-height: 38rpx; */ + flex-grow: 1; +} + +.history { + background-color: #f0f0f0; + color: #7b7b7b; + border: none; + margin-bottom: 16rpx; +} + +.history:first-of-type { + /* margin-left: 0; */ +} + +.input-box { + position: relative; + flex: 1; + padding-left: 50rpx; + padding-right: 70rpx; + background-color: #f0f0f0; + border-radius: 60rpx; +} + +.input-box::before { + font-family: iconfont; + position: absolute; + left: 20rpx; + top: 50%; + transform: translateY(-50%); + content: '\e618'; +} + +.input-search { + position: relative; + padding: 10rpx; + font-size: 28rpx; +} + + +.btn { + margin-left: 0; + margin-right: 0; + line-height: 1; + padding: 20rpx; + font-size: 30rpx; +} + +.btn::after { + border: none; +} + +.icon-guan { + font-size: 20rpx; + padding: 10rpx; + position: absolute; + right: 20rpx; + top: 50%; + transform: translateY(-50%); +} + +.lookat { + display: inline-block; + color: #FF6768; + border: 2rpx solid #FF6768; + border-radius: 80rpx; + font-size: 30rpx; +} + +.no-data .no-data-title { + font-size: 28rpx; + color: #999; +} + +.mt30 { + margin-top: 30rpx; +} + +.popup_item { + display: flex; + justify-content: space-between; + margin-top: 30rpx; +} + +.popup_input { + border-radius: 20rpx; + width: 40%; + font-size: 24rpx; + padding: 10rpx; + background: #f9f9f9; +} +.popup_price1 { + text-align: center; + padding: 0 30rpx; + margin-top: 30rpx; + background: red; + border-radius: 20rpx; +} + +.popup_price { + text-align: center; + padding: 10rpx 30rpx; + margin-top: 30rpx; + background: red; + border-radius: 35rpx; +} +.mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; + background-color: rgba(0,0,0,.4); + } + +.popup_brand { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.filter { + height: 100%; + position: absolute; + right: 0; + top: 0; + background: pink; + width: 80%; + z-index: 1000; + transition: all .5s; +} + + +@import '../com_screen.wxss'; \ No newline at end of file diff --git a/packageG/pages/payment/pay_success/pay_success.js b/packageG/pages/payment/pay_success/pay_success.js new file mode 100644 index 0000000..2dfcc15 --- /dev/null +++ b/packageG/pages/payment/pay_success/pay_success.js @@ -0,0 +1,149 @@ +var e = getApp(); +var regeneratorRuntime = require('../../../../utils/runtime.js'); +var ut = require("../../../../utils/util.js"); +Page({ + /** + * 页面的初始数据 + */ + data: { + url: e.globalData.setting.imghost, + resourceUrl: e.globalData.setting.resourceUrl, + iurl: e.globalData.setting.imghost, + order:null, + type:1, + allmoney:0, + user_money:0, + order_sn:"", + pick:null, + pre_cut:0,//预存金额 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad:async function(options) { + wx.setNavigationBarTitle({ + title: '支付成功', + }); + this.setData({ + options, + }); + var type=options.type,order_sn=options.order_sn; + var th=this,order=null; + + getApp().request.promiseGet("/api/weshop/ad/page?pid=1211&store_id=" + getApp().globalData.setting.stoid, { + data: { + enabled: 1 + } + }).then(res => { + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { + var a = res.data.data.pageData; + var arr = new Array(); + for (var i = 0; i < a.length; i++) { + var tt = { + 'ad_code': getApp().globalData.setting.imghost + a[i].ad_code, + 'media_link': '', + 'ad_weapplink': a[i].ad_weapplink + }; + arr.push(tt); + } + if (arr.length > 0) th.setData({ + banner: arr, + }); + } + }) + + + + // 卡项订单 + if(options.card == 1) { + let url = '/api/weshop/recharge/user/page' + let data = { + store_id: getApp().globalData.setting.stoid, + user_id: getApp().globalData.userInfo.user_id, + order_id: this.data.options.order_id, + }; + + // 请求数据 + getApp().promiseGet(url, { + data: data, + }).then(res => { + if (res.data.code == 0) { + console.log('请求成功', res); + this.setData({ + order: res.data.data.pageData[0], + order_sn: res.data.data.pageData[0].order_sn, + }); + } else { + throw (res); + }; + }).catch(err => { + wx.showToast({ + title: err.data.data, + icon: 'error', + }); + }); + } else { + + //如果是等1,就是单个订单的订单号 + if(type==1){ + await getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:e.globalData.setting.stoid,order_sn:order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + order=res.data.data.pageData[0]; + th.setData({order:order,order_sn:order_sn}) + } + + }) + }else{ + await getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:e.globalData.setting.stoid,parent_sn:order_sn}}).then(res=>{ + + if(ut.ajax_ok(res)){ + var allmoney=0,user_money=0; + for(var i in res.data.data.pageData){ + var item=res.data.data.pageData[i]; + allmoney+=item.order_amount; + user_money += item.user_money?item.user_money:0; + } + order=res.data.data.pageData[0]; + th.setData({ order: order, type: 2, allmoney: allmoney, order_sn: order_sn, user_money: user_money}) + } + + + }) + } + //--获取门店-- + if(order.exp_type==1) { + await getApp().request.promiseGet("/api/weshop/pickup/get/"+ e.globalData.setting.stoid+"/"+order.pickup_id, + {1:1}).then(res => { + th.setData({pick:res.data.data}) + }); + }; + //--只使用预存支付,达到免单时要请求预存使用额度---- + if(order.order_amount==0 && order.user_money==0){ + await getApp().request.promiseGet("/api/weshop/orderMore/get/"+ e.globalData.setting.stoid+"/"+order_sn,{1:1}).then(res => { + if(res.data && res.data.code==0 && res.data.data){ + let pre_cut=res.data.data.pre_cut + th.setData({pre_cut}) + } + }); + } + + }; + + + + }, + + goto: function() { + var url= '/pages/index/index/index'; + getApp().goto(url) + }, + + gotoshequn:function(e){ + getApp().goto(e.currentTarget.dataset.url); + }, + + +}) \ No newline at end of file diff --git a/packageG/pages/payment/pay_success/pay_success.json b/packageG/pages/payment/pay_success/pay_success.json new file mode 100644 index 0000000..3d262cb --- /dev/null +++ b/packageG/pages/payment/pay_success/pay_success.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "支付成功" +} \ No newline at end of file diff --git a/packageG/pages/payment/pay_success/pay_success.wxml b/packageG/pages/payment/pay_success/pay_success.wxml new file mode 100644 index 0000000..4d1ba08 --- /dev/null +++ b/packageG/pages/payment/pay_success/pay_success.wxml @@ -0,0 +1,151 @@ + + + + + + + + + + + 订单支付成功! + + + + + + + + + + + + 订单详情 + + + + + 立即预约 + + + + + + + + 回到首页 + + + 查看订单 + + + + + + + + + + + + + 订单编号 : + {{order_sn}} + + + + + + 实付金额 : + + + {{filters.toFix(order.account,2) }}元 + + + + {{filters.toFix(pre_cut,2)}}元 + {{filters.toFix(order.order_amount+order.user_money+order.pt_tail_money,2)}}元 + + + {{filters.toFix(pre_cut,2)}}元 + {{filters.toFix(allmoney+user_money,2) }}元 + + + + + + + 支付方式 : + 微信支付 + + + + + 支付方式 : + 微信支付,余额支付 + 微信支付 + 余额支付 + + 预存抵扣 + 免单 + + + + 支付方式 : + 微信支付,余额支付 + 微信支付 + 余额支付 + + 预存抵扣 + 免单 + + + + + + + + + + + + + + + + + + + + + 收货人 : + {{order.consignee}} + {{order.mobile}} + + + 收货地址 : + {{order.more_address+order.address}} + + + + + + + 门店 : + {{order.list[0].pickup_name}} + {{pick.pickup_name}} + + + 门店地址 : + {{order.list[0].fulladdress}} + {{pick.fulladdress}} + + + + + + + + + + \ No newline at end of file diff --git a/packageG/pages/payment/pay_success/pay_success.wxss b/packageG/pages/payment/pay_success/pay_success.wxss new file mode 100644 index 0000000..afc16f0 --- /dev/null +++ b/packageG/pages/payment/pay_success/pay_success.wxss @@ -0,0 +1,146 @@ +page { + border-top: 2rpx solid rgb(245, 245, 245); +} +.line { + border-top: 2rpx solid rgb(245, 245, 245); + width: 700rpx; +} + +.payradio .Success_box { + padding-top: 45rpx; + padding-bottom: 45rpx; +} + +.payradio .Success_box .Success_box_title { + margin-top: 45rpx; + color: rgb(8, 8, 8); +} + +.payradio image { + width: 140rpx; + height: 140rpx; + display: flex; +} + +.payitem_max { + padding: 0rpx 55rpx; + color: rgb(104, 104, 104); + padding-bottom: 30rpx; +} + +.payitem_max .payitem { + margin-top: 30rpx; +} + +.payitem_max .payitem .pay_nam { + width: 200rpx; +} + +.payitem_max .payitem view { + margin-right: 50rpx; +} +.pay_money{ + color: rgb(219, 27, 52); +} + +.pay_User { + padding-left: 55rpx; + color: rgb(104, 104, 104); +} + +.pay_User .payitem { + margin-top: 30rpx; +} + +.pay_User .payitem .pay_Receiving { + width: 128rpx; + margin-right: 50rpx; +} + +.pay_User .payitem .pay_name { + margin-right: 38rpx; + /* max-width: 250rpx; */ +} + +.btn { + box-sizing: border-box; + height: 75rpx; + line-height: 75rpx; + /* padding: 10rpx; */ + text-align: center; + border-radius: 20rpx; + padding: 0 40rpx; +} + +.pay_home { + /* margin-top: 35rpx; */ + color: rgb(255, 255, 255); + /* width: 566rpx; + height: 68rpx; */ + border-radius: 30rpx; + background-color: rgb(219, 27, 52); +} +.address{ + width: 470rpx; +} + +.bg-red { + background-color: rgb(219, 27, 52); +} + +.bg-yellow { + background-color: #feca53; +} + +.border { + border: 2rpx solid #ccc; +} + + +.shequn{ + width: 94%; + margin:0 23rpx 23rpx 23rpx; + min-height: 260rpx; + background: white; + border-radius: 15rpx; + display: flex; +} + +.shequnleft{ + display: block; + width: 60%; + margin: 30rpx; +} +.shequnleft .one1{ + display: flex; + width: 100%; + height: 110rpx; + line-height: 110rpx; + margin-top: -15rpx; + font-size: 30rpx; + color: #313131; + font-weight: bold; +} +.shequnleft .one2{ + display: flex; + width: 100%; + color: #f39700; + font-size: 24rpx; +} +.shequnleft .one3{ + display: flex; + width: 100%; + color: #313131; + font-size: 24rpx; +} +.shequnright{ + display: flex; + width: 40%; + justify-content: center; + align-items: center; +} + +.shequnright image{ + width: 150rpx; + height: 150rpx; +} diff --git a/packageG/pages/user/my_service/appment_main.js b/packageG/pages/user/my_service/appment_main.js new file mode 100644 index 0000000..034182c --- /dev/null +++ b/packageG/pages/user/my_service/appment_main.js @@ -0,0 +1,734 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + + /** + * 页面的初始数据 + */ + data: { + inurl: a.url, //接口网址 + iurl: a.imghost, //服务器网址 + store: 0, //是否显示服务门店列表 + beautician: 0, //是否显示美容师列表 + beautician_name: "", //选中的美容师名称 + beauticianID: "", //美容师id + bea_index: "", //美容师列表下标 + placeholder: "填写备注", //备注为空的placeholder + store_list: [], //门店列表 + beautician_list: [], //美容师列表 + store_name: "", //选择的服务门店 + fir_pick_index: 0, //选择的门店下标 + curpage: 1, //当前分页数 + pageSize: 8, //页大小 + total: 0, + ismore: 0, //是否加载完毕 + itemId: "", //服务id + project_id: "", //项目id + isScroll: true, //scroll-y是否可以滑动 + key_word: "", //是否按门店文字查询 + is_service_read: 0, //是否调用过门店接口 + is_search: 0, //是否通过key_word调用接口 + is_success: 0, //是否提交成功 + remarks: "", //备注 + storageId: "", //线下门店id + url: "/packageG/pages/user/my_service/appment_main", //本页面地址路径用于选择时间页面跳转回来 + buyType: "", //项目类型 + time: "", //选择预约时间 + tment_count: "", //可预约人数 + lat: "", //纬度坐标 + lon: "", //经度坐标 + is_gps: 1, //是否开启gps + validay: "", //服务项目有效期 + is_sub: 0, //判断是否重复提交 + is_textea: 1, //备注是否是可输入 + }, + //控制备注输入 + check_text: function() { + var th = this; + var is_textea = th.data.is_textea; + th.setData({ + is_textea: 1, + beautician: 0 + }) + }, + onclickstore: function() { + var th = this; + var store = th.data.store; + if (store) { + th.setData({ + store: 0, + is_textea: 1 + }) + } else { + th.setData({ + beautician: 0, + store: 1, + is_textea: 0 + }) + if (th.data.store_list.length < 1) { + wx.showLoading({ + title: '加载中', + }) + th.query_store(); + } + } + }, + //输入的备注 + input_remarks: function(e) { + var remarks = e.detail.value; + this.setData({ + remarks: remarks + }) + }, + //提交成功及发送模版代码 + success: function() { + var th = this; + var store = th.data.store_name; //门店名称 + var bea_name = th.data.beautician_name; //美容师名称 + var time = th.data.time; //预约时间 + var is_sub = th.data.is_sub; //是否重复提交 + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 + var serviceId = th.data.itemId; //服务id + var beauticianID = th.data.beauticianID; //美容师id + var buyType = th.data.buyType; //服务项目类型 + var storeId = a.stoid; //商家id + var storageId = th.data.storageId; //门店id + var userId = d.user_id; //用户id + var remarks = th.data.remarks; //用户备注 + var project_id = th.data.project_id; //项目id + var validay = th.data.validay; + var json = { + "arrangeTime": time + ":00", + "beauticianId": beauticianID, + "buyType": buyType, + "effectiveDay": "", + "number": "", + "projectId": project_id, + "remark": remarks, + "serviceId": serviceId, + "states": 0, + "storageId": storageId, + "storeId": storeId, + "userId": userId, + "validay": validay + } + var data = JSON.stringify(json); + wx.request({ + url: url, + data: json, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { + th.setData({ + is_sub: 0 + }) + wx.hideLoading(); + if (res.data.code == 0) { + getApp().my_warnning("预约成功", 1, th); + var store_name = th.data.store_name; //预约门店 + var number = res.data.data.Number; + var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 + var userinfo = getApp().globalData.userInfo; + var name = d.userInfo.nickname; + var json = { + // "formId": formid, + "keyWord": [{ + "keyword": res.data.data.ServiceName + }, + { + "keyword": time.substring(0, 16) + }, { + "keyword": res.data.data.BeauticianName + }, { + "keyword": res.data.data.StorageName + }, { + "keyword": res.data.data.Address + } + ], + "page": "/pages/user/my_service/tment_details?number=" + number, + "storeId": a.stoid, + "typeId": "1011", + "userId": d.user_id + }; + var data = JSON.stringify(json); + //调用发送预约成功模版接口 + wx.request({ + url: th.data.inurl + temp_url, + data: data, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(data) {} + }) + setTimeout(function() { + wx.redirectTo({ + url: "/pages/user/my_service/tment_details?number=" + number + }); + }, 1000); + } else { + getApp().my_warnning(res.data.msg, 0, th); + th.settime(); + } + } + }) + + }, + //定时显示texteat + settime: function() { + var th = this; + setTimeout(function() { + th.setData({ + is_textea: 1 + }) + }, 2000); + }, + //提交预约 + sub_success: function(e) { + var th = this; + var temp_url = th.data.inurl + "/api/wx/weappSendlist/page"; + var template_id = ""; + if (th.data.is_sub == 1) { + return false; + } + var store = th.data.store_name; //门店名称 + var bea_name = th.data.beautician_name; //美容师名称 + var time = th.data.time; //预约时间 + var is_sub = th.data.is_sub; //是否重复提交 + th.setData({ + is_textea: 0, + is_sub: 1 + }) + //提交预约前的判断 + if (store == "") { + getApp().my_warnning("请选择服务门店", 0, th); + th.setData({ + is_sub: 0 + }) + th.settime(); + return false; + } else if (bea_name == "") { + getApp().my_warnning("请选择美容师", 0, th); + th.setData({ + is_sub: 0 + }) + th.settime(); + return false; + } else if (time == undefined || time == '') { + getApp().my_warnning("请选择预约时间", 0, th); + th.setData({ + is_sub: 0 + }) + th.settime(); + return false; + } else { + var version =""; + //判断微信版本是否达到预约成功订阅的要求 + wx.getSystemInfo({ + success(res) { + version = res.version; + } + }) + wx.showLoading({ + title: '加载中', + }) + if (th.ver(version, '7.0.4') >= 0) { + //获取模版id + getApp().request.promiseGet(temp_url, { + data: { + store_id: a.stoid, + typeid: "1011" + } + }).then(res => { + if (res.data.code == 0 && res.data.data.pageData.length > 0) { + template_id = res.data.data.pageData[0].template_id; + // //授权订阅 + wx.requestSubscribeMessage({ + tmplIds: [template_id], + success(res) { + th.success(); + }, + fail(res) { + th.success(); + } + }) + } else { + th.success(); + } + }) + } else { + // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 + wx.showModal({ + title: '提示', + content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' + }) + th.setData({ + is_sub: 0 + }) + } + + } + }, + //版本判断 + ver:function(v1,v2){ + v1 = v1.split('.') + v2 = v2.split('.') + var num1 = "" ; + var num2 = ""; + var len = Math.max(v1.length, v2.length) + + while (v1.length < len) { + v1.push('0') + } + while (v2.length < len) { + v2.push('0') + } + + for (let i = 0; i < len; i++) { + num1 = parseInt(v1[i]) + num2 = parseInt(v2[i]) + + if (num1 > num2) { + return 1 + } else if (num1 < num2) { + return -1 + } + } + return 0 + }, + goto: function(e) { + var th = this; + th.setData({ + beautician: 0, + is_textea: 0 + }) + if (th.data.store_name == "") { + getApp().my_warnning("请选择服务门店", 0, th); + th.settime(); + } else if (th.data.beautician_name == "") { + getApp().my_warnning("请选择美容师", 0, th); + th.settime(); + } else { + th.setData({ + is_textea: 1 + }) + var url = e.currentTarget.dataset.url; + getApp().goto(url); + } + }, + //点击选择门店 + choose_for_store: function(e) { + var th = this; + var index_c = e.currentTarget.dataset.ind; + var fir_pick_index = th.data.fir_pick_index; + //判断是否点击选中的门店,防止重复点击重复设置选中下标 + if (index_c == fir_pick_index) { + return false; + } else { + th.setData({ + fir_pick_index: index_c, + beautician_name: "", + time: "", + tment_count: "" + }) + } + }, + //确认选择门店 + choice_store: function() { + var th = this; + var index = th.data.fir_pick_index; + var store_name = th.data.store_list[index].StorageName; + var Id = th.data.store_list[index].Id; + th.setData({ + store: 0, + store_name: store_name, + storageId: Id, + is_textea: 1 + }) + }, + onReachBottom: function() { + var th = this; + if (this.data.total <= th.data.pageSize) return; + if (this.data.ismore) return; + + wx.showLoading({ + title: '加载中...', + }) + th.query_store(); + }, + //分页查询门店信息 + query_store: function() { + var th = this; + th.setData({ + is_textea: 0 + }) + var itemId = th.data.itemId; //服务id + var url = "/api/weshop/marketing/reservation/storage/pagenew"; + var key_word = th.data.key_word; + key_word = key_word.replace(/\s+/g, ""); + getApp().request.promiseGet(url, { + data: { + userId:getApp().globalData.user_id, + storeId: a.stoid, + serviceId: itemId, + latitude: th.data.lat, + longitude: th.data.lon, + page: th.data.curpage, + pageSize: th.data.pageSize, + keyWord: key_word + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + th.data.curpage++; + var arr1 = th.data.store_list; + var arr2 = res.data.data.pageData; + var arr3 = [...arr1, ...arr2]; + var ismore = 0; + if (arr3.length == res.data.data.total) ismore = 1 + th.setData({ + store_list: arr3, + total: res.data.data.total, + ismore: ismore, + is_service_read: 1, + }), wx.stopPullDownRefresh(); //停止下拉刷新 + if (key_word != "" && res.data.data.pageData.length < 1) { + th.setData({ + is_search: 1 + }) + } + } else { + getApp().my_warnning(res.data.msg, 0, th); + th.settime(); + } + }) + }, + //查询 + query_beautician: function() { + var th = this; + th.setData({ + is_textea: 0 + }) + if (th.data.store_name == "") { + getApp().my_warnning("请选择服务门店", 0, th); + th.settime(); + } else { + wx.showLoading({ + title: '加载中', + }) + var itemid = th.data.itemId; //正式使用的项目id + var storageId = th.data.storageId; //正式使用的线下门店id + var url = "/api/weshop/marketing/reservation/staff/pagenew"; //接口地址 + + getApp().request.promiseGet(url, { + data: { + storeId: a.stoid, + userId: d.user_id, + serviceId: itemid, + storageId: storageId, + VipId:getApp().globalData.userInfo.erpvipid, + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + th.setData({ + beautician_list: res.data.data + }) + if (res.data.data.length < 1) { + getApp().my_warnning("暂无美容师", 0, th); + th.settime(); + } else { + if (th.data.beautician == 0) { + th.setData({ + beautician: 1, + }) + } else { + th.setData({ + beautician: 0, + }) + } + } + } else { + getApp().my_warnning(res.data.msg, 0, th); + th.settime(); + } + }) + } + }, + choice_beautician: function(e) { + var th = this; + var bea_index = e.currentTarget.dataset.baaindex; + var bea_name = th.data.beautician_list[bea_index].StaffName; + var BeauticianID = th.data.beautician_list[bea_index].staffid; + var StorageId=th.data.beautician_list[bea_index].StorageId + + th.setData({ + beautician_name: bea_name, + beautician: 0, + bea_index: bea_index, + beauticianID: BeauticianID, + time: "", + tment_count: "", + is_textea: 1, + StorageId:StorageId + }) + + }, + //获取搜索门店输入的值 + input_store: function(e) { + this.setData({ + key_word: e.detail.value + }) + }, + //搜索门店 + search_store: function() { + var th = this; + var key_word = th.data.key_word; + var store_list = th.data.store_list; + th.setData({ + curpage: 1, + is_search: 0, + store_list: [] + }) + wx.showLoading({ + title: '加载中', + }) + th.query_store(); + }, + //美容师预约跳转页面 + nav_bea: function() { + var th = this; + th.setData({ + beautician: 0 + }) + var storageId = th.data.storageId; //线下门店id + var itemId = th.data.itemId; //服务id + var project_id = th.data.project_id; + if (storageId == "") { + getApp().my_warnning("请选择服务门店", 0, th); + th.settime(); + } else { + th.setData({ + is_textea: 1 + }) + wx.navigateTo({ + url: "/packageG/pages/user/my_service/cosmetology_list?" + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id + }); + + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var th = this; + th.setData({ + itemId: options.service_id, + buyType: options.BuyType, + project_id: options.ProjectID, + validay: options.Validay + }) + wx.getLocation({ + type: 'gcj02', + success: function(res) { + th.data.lat = res.latitude; + th.data.lon = res.longitude; + th.data.is_get_local_ok = 1; + th.setData({ + is_gps: 1 + }); + }, + fail: function(res) { + if (res.errCode == 2) { + th.setData({ + is_gps: 0 + }); + if (th.data.is_gps == 0) { + getApp().confirmBox("请开启GPS定位", null, 25000, !1); + th.settime(); + } + } else { + th.setData({ + is_gps: "3" + }); + } + + th.data.is_get_local_ok = 1; + } + }) + //获取上一次的预约 + this.get_fir_service(); + + }, + //查询剩下可预约人数 + query_more: function() { + var th = this; + var url = "/api/weshop/marketing/reservation/can/reservation/countnew"; + var beauticianID = th.data.beauticianID; //美容师id + var projectID = th.data.itemId; //服务id + var seekTime = th.data.time; //预约日期 + var storageId = th.data.storageId; //门店id + var storeId = a.stoid; //商家id + getApp().request.promiseGet(url, { + data: { + beauticianId: beauticianID, + seekTime: seekTime, + serviceId: projectID, + storageId: storageId, + storeId: storeId + } + }).then(res => { + if (res.data.code == 0) { + var tment_count = res.data.data.CanReservation; + th.setData({ + tment_count: tment_count + }) + } else { + getApp().my_warnning(res.data.msg, 0, th); + th.settime(); + } + }) + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + var th = this; + var seekTime = th.data.time; //预约日期 + if (seekTime != "") { + th.query_more(); + } + th.setData({ + time: th.data.time.substring(0, 16), + is_textea: 1 + }) + th.query_project(); + }, + //获取单个服务项目信息 + query_project: function() { + var th = this; + var url = "/api/weshop/marketing/reservation/sm/page"; //获取服务项目接口 + var project_id = th.data.project_id; //服务项目id + getApp().request.promiseGet(url, { + data: { + storeId: a.stoid, + userId: d.user_id, + projectId: project_id + } + }).then(res => { + if (res.data.code == 0) { + th.setData({ + validay: res.data.data.pageData[0].Validay + }) + } else { + getApp().my_warnning(res.data.msg, 0, th); + th.settime(); + } + }) + }, + //关闭导航 + close: function() { + var th = this; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.close_box(); + }, + + //判断分享的导购是不是有门店,是不是该门店下又该会员 + check_firleader(data){ + var th=this; + var itemId = this.data.itemId; //服务id + var url = "/api/weshop/marketing/reservation/storage/pagenew"; + var key_word = data.store_name; + key_word = key_word.replace(/\s+/g, ""); + var usr=getApp().globalData.userInfo; + getApp().request.promiseGet(url, { + data: { + userId: usr.user_id, + storeId: os.stoid, + serviceId: itemId, + page: 1, + pageSize: 1000, + keyWord: key_word + } + }).then(res => { + //-- 如果是门店的话 -- + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { + var store_data=null; + for(var i in res.data.data.pageData){ + var it=res.data.data.pageData[i]; + if(it.Id==data.StorageId){ + store_data={ + store_name: data.store_name, + storageId: data.StorageId, + }; + break; + } + } + if(!store_data) return false; + th.setData(store_data) + + }else{ + return false; + } + + //导购接口地址 + var url = "/api/weshop/marketing/reservation/staff/pagenew"; + return getApp().request.promiseGet(url, { + isShowLoading:1, + data: { + storeId: os.stoid, + userId: usr.user_id, + serviceId: itemId, + storageId: data.StorageId + } + }) + }).then(res=>{ + if (res && res.data && res.data.code == 0) { + var beautician_list=res.data.data; + for(var i in beautician_list){ + var item=beautician_list[i]; + if(item.staffid==data.beauticianID){ + th.setData({ + beautician_name:data.beautician_name, + beauticianID:data.beauticianID, + }) + break; + } + } + + } + }) + }, + + //获取上一次预约的信息 + get_fir_service:function (){ + var th=this; + var usr=getApp().globalData.userInfo; + if(!usr) return false; + + getApp().promiseGet("/api/weshop/marketing/reservation/reservation/page",{ + data:{storeId:os.stoid,userId:usr.user_id,projectId:th.data.project_id} + }).then(res=>{ + if(res.data.code==0 && res.data.data && res.data.data.pageData ){ + var ppdata= res.data.data.pageData[0]; + var data={ + store_name:ppdata.StorageName, + beautician_name:ppdata.BeauticianName, + beauticianID:ppdata.BeauticianID, + StorageId:ppdata.StorageID, + } + //检查门店和导购能不能默认使用 + th.check_firleader(data); + }; + }) + } + + + +}) \ No newline at end of file diff --git a/packageG/pages/user/my_service/appment_main.json b/packageG/pages/user/my_service/appment_main.json new file mode 100644 index 0000000..104895a --- /dev/null +++ b/packageG/pages/user/my_service/appment_main.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "预约服务", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "nav_b": "/components/nav_b/nav_b" + } +} \ No newline at end of file diff --git a/packageG/pages/user/my_service/appment_main.wxml b/packageG/pages/user/my_service/appment_main.wxml new file mode 100644 index 0000000..3fbd1d9 --- /dev/null +++ b/packageG/pages/user/my_service/appment_main.wxml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + {{store_name==""?'选择服务门店':store_name}} + + + + + + + + + + + + + + + + {{beautician_name==''?'选择美容师':beautician_name}} + + + + + + + {{item.StaffName}} + + + + + + + + + + + + + + + 预约时间 + + + + + {{time==""?'选择时间':time}} + + + + + + + + + + + + + + + + + {{remarks==''?'填写备注':remarks}} + + + + + + 注:剩余可预约人数{{tment_count}}人 + + + + + 我的预约 + +
+ +
+
+
+ +
+ + + + + 选择服务门店 + + + + + + 搜索 + + + + + + + + + + + + + + {{item.StorageName}} + + 距您:{{item.Distance}}km + + + {{item.Address}} + + + + + 没有找到{{key_word}}门店 + + + + + 数据加载完毕 + + + + + + 确定 + + + + + + + + \ No newline at end of file diff --git a/packageG/pages/user/my_service/appment_main.wxss b/packageG/pages/user/my_service/appment_main.wxss new file mode 100644 index 0000000..ba5d2c1 --- /dev/null +++ b/packageG/pages/user/my_service/appment_main.wxss @@ -0,0 +1,288 @@ +.container { + border-top: 7rpx solid rgb(245, 245, 245); +} + +.main { + width: 100%; + height: 305rpx; +} + +.angle { + transform: rotate(-45deg); + margin-right: 15rpx; + margin-bottom: 10rpx; + font-size: 26rpx; + color: rgb(142, 142, 142); +} +.StaffName{ + max-width: 350rpx; +} +.angler { + transform: rotate(227deg); + margin-bottom: 0rpx; +} + +.users { + background-color: rgb(255, 255, 255); +} + +.user { + width: 40rpx; + height: 40rpx; + margin-left: 15rpx; +} + +.Fram { + padding: 0rpx 60rpx; + margin-top: 60rpx; + background-color: rgb(255, 255, 255); +} + +.subSuccess { + position: fixed; + z-index: 3; + top: 420rpx; + left: 110rpx; + width: 540rpx; + height: 315rpx; + background-color: rgb(155, 155, 155); + text-align: center; + border-radius: 20rpx; + color: rgb(255, 255, 255); + font-weight: bold; +} + +.Success { + width: 110rpx; + height: 110rpx; + margin-top: 70rpx; + margin-bottom: 30rpx; +} + +.appment, .sub_appment { + width: 270rpx; + height: 60rpx; + line-height: 55rpx; + border-radius: 40rpx; +} + +button { + height: 100%; + background-color: rgb(214, 1, 33); +} + +.appment { + background-color: rgb(238, 238, 238); +} + +.sub_appment { + background-color: rgb(214, 1, 33); + color: rgb(255, 255, 255); +} + +.head { + width: 122rpx; + margin-right: 40rpx; + height: 50rpx; + line-height: 50rpx; +} + +.textarea { + width: 420rpx; + background-color: rgb(238, 238, 238); + border-radius: 6rpx; + height: 130rpx; + padding-left: 40rpx; + padding-right: 15rpx; + padding-top: 15rpx; + padding-bottom: 15rpx; +} + +.mabot { + margin-bottom: 35rpx; +} + +.select { + width: 420rpx; + height: 55rpx; + line-height: 55rpx; + background-color: rgb(238, 238, 238); + border-radius: 6rpx; + padding-left: 40rpx; + padding-right: 15rpx; +} + +.Cosmetology { + padding-left: 40rpx; + padding-right: 15rpx; + width: 365rpx; + background-color: rgb(238, 238, 238); + height: 50rpx; + line-height: 50rpx; + border-radius: 6rpx; +} + +.beauticians { + width: 407rpx; + z-index: 3; + top: 45rpx; + left: -1rpx; + padding: 0rpx 5rpx; + border: 2rpx solid rgb(238, 238, 238); + background-color: rgb(255, 255, 255); + padding-bottom: 5rpx; + height: 279rpx; + overflow-x: scroll; + overflow-y: scroll; +} + +.beautician { + height: 70rpx; + border-bottom: 2rpx solid rgb(238, 238, 238); + padding-left: 25rpx; +} + +.beaclone { + border-bottom: 0rpx; +} + +.notes { + margin-top: 15rpx; + margin-bottom: 60rpx; + margin-right: 8rpx; +} + +.color { + color: rgb(172, 172, 172); +} + +.submitMax { + margin-top: 50rpx; + padding: 0rpx 15rpx; +} + +.Remarks { + margin-top: 15rpx; +} + +/* 蒙尘 */ + +.disgraceful { + position: fixed; + z-index: 4; + width: 100%; + height: 100%; + top: 0rpx; + left: 0rpx; + background-color: rgba(0, 0, 0, 0.4); +} + +.storeList { + z-index: 5; + left: 0rpx; + border-top-left-radius: 25rpx; + border-top-right-radius: 25rpx; + background-color: rgb(255, 255, 255); + width: 100%; + padding: 45rpx 0rpx; +} + +.storeListpadd { + padding: 0rpx 31rpx; +} + +.choice { + margin-bottom: 5rpx; +} + +.inputstore { + width: 510rpx; + height: 43rpx; + line-height: 43rpx; + border-radius: 30rpx; + border: 2rpx solid rgb(238, 238, 238); + padding-left: 30rpx; +} + +.searchbar { + height: 95rpx; + border-bottom: 2rpx solid rgb(238, 238, 238); +} + +.search { + width: 125rpx; + height: 45rpx; + line-height: 45rpx; + background-color: rgb(219, 27, 52); + border-radius: 30rpx; + color: rgb(255, 255, 255); +} + +.stores { + height: 500rpx; + overflow-y: scroll; +} + +.store { + margin: 0rpx 16rpx; + padding-right: 15rpx; + border-bottom: 2rpx solid rgb(238, 238, 238); + padding: 20rpx 0rpx; +} + +.icon { + padding: 0rpx 15rpx; +} + +.circular { + width: 37rpx; + height: 37rpx; + border-radius: 50%; + border: 2rpx solid rgb(52, 52, 52); + margin: 0rpx 15rpx; +} + +.store_name_dis { + width: 90%; +} + +.name_dis { + margin-bottom: 5rpx; +} + +.store_name { + max-width: 420rpx; +} + +.store_dis { + height: 30rpx; + line-height: 30rpx; + padding: 5rpx 15rpx; + background-color: rgb(227, 227, 227); + border-radius: 25rpx; + margin-right: 20rpx; + color: rgb(159, 159, 159); + max-width: 200rpx; +} + +.store_address { + color: rgb(159, 159, 159); +} + +.determine { + background-color: rgb(196, 24, 26); + width: 500rpx; + border-radius: 35rpx; + height: 60rpx; + color: rgb(255, 255, 255); + margin: 20rpx 0rpx; +} + +.value { + max-width: 300rpx; +} + +.notstore { + height: 80rpx; + color: rgb(159, 159, 159); +} diff --git a/packageG/pages/user/my_service/beauty_deta.js b/packageG/pages/user/my_service/beauty_deta.js new file mode 100644 index 0000000..d49c9c3 --- /dev/null +++ b/packageG/pages/user/my_service/beauty_deta.js @@ -0,0 +1,427 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + + /** + * 页面的初始数据 + */ + data: { + inurl: a.url, //接口网址 + iurl: a.imghost, + url: "", //选择选择时间后返回的页面 + defimgurl: "/miniapp/images/no-head.jpg", + seekTime: "", //当前服务预约选择的时间 + time_list: [], //可预约时间 + name: "", //美容师姓名 + comment: "", //美容师评价 + aweeks: [], //七天的预约时间 + head_img: "", //美容师头像 + time: ['08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30'], + weeks: [], //星期几数组 + time_index: -1, //选择预约时间下标 + date_id: 0, //选择日期的id + beautician_id: "", //美容师id + itemId: "", //服务id + number: "", //预约单号 + modify: 0, //是否是修改时间 + iscos: 0, //是否是从美容师列表过来的 + hours: "", //获取当前时分秒 + projectId: "", //项目id + StaffName: "", //美容师名称 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var th = this; + var myDate = new Date(); + var minutes = myDate.getMinutes(); //获取当前分钟数(0-59) + var hours = myDate.getHours() + ":" + minutes; //获取当前小时数(0-23) + var beautician_id = options.BeauticianID; + var storageId = options.StorageId; + + + th.setData({ + beautician_id: beautician_id, + itemId: options.itemId, + modify: options.modify, + hours: hours, + projectId: options.projectId, + storageId: storageId, + VipId:options.VipId, + }) + if (options.url != undefined) { + th.setData({ + url: options.url + }) + } + if (options.number != undefined) { + th.setData({ + number: options.number + }) + } + if (options.iscos != undefined) { + th.setData({ + iscos: options.iscos + }) + } + if (options.StaffName != undefined) { + th.setData({ + StaffName: options.StaffName + }) + } + th.query_beatea(th.query_aweek); + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + var th = this; + //获取当前时间 + var myDate = new Date(); + // var date = myDate.getHours(); //获取当前小时数(0-23); + let str = myDate.toTimeString(); //"10:55:24 GMT+0800 (中国标准时间)" + let date = str.substring(0, 8); // '10:55:24' + th.setData({ + hours: date + }); + }, + + //图片失败,默认图片 + bind_bnerr1: function (e) { + var _errImg = e.target.dataset.errorimg; + var _Img = e.target.dataset.img; + if (_Img != undefined) { + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/no-head.jpg"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + } + }, + //选择服务日期 + check_date: function (e) { + var th = this; + var id = e.currentTarget.dataset.dateid; + var date_id = th.data.date_id; + var seekTime = th.data.aweeks[id].time; + if (id != date_id) { + th.setData({ + date_id: id, + seekTime: seekTime + }) + th.query_date(); + } + }, + //获取美容师信息 + query_beatea: function (func) { + var th = this; + var url = "/api/weshop/marketing/reservation/staff/get"; //接口路径 + var beautician_id = th.data.beautician_id; + getApp().request.promiseGet(url, { + data: { + beauticianId: beautician_id, + storeId: a.stoid, + } + }).then(res => { + if (res.data.code == 0) { + var data = res.data.data; + var ob = { + name: data.StaffName, + comment: data.Remark1, + head_img: data.PhotoUrl + }; + if (!th.data.storageId) { + ob.storageId = data.StorageId; + } + th.setData(ob); + func(); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }) + }, + //返回上个页面 + navigateBack: function () { + var th = this; + var modify = th.data.modify; //是否是更改时间 + var seekTime = th.data.seekTime; //选择的日期 + var time_list = th.data.time_list; + var time_index = th.data.time_index; + if (time_index == -1) { + getApp().my_warnning("请选择预约时间", 0, th); + return false; + } + var date_id = th.data.date_id; + var date = th.data.aweeks[date_id].time; + var time = date + " " + time_list[time_index] + ":00"; + if (modify == 1) { + var json = { + "arrangeTime": time, + "number": th.data.number, + "remark": "更改时间", + "states": 0, + "storeId": a.stoid, + }; + var data = JSON.stringify(json); + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址 + wx.request({ + url: url, + data: data, + method: 'put', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function (res) { + if (res.data.code == 0) { + getApp().my_warnning(res.data.data, 1, th); + setTimeout(function () { + wx.navigateBack({ + //返回 + delta: 1 + }) + }, 1000); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + } + }) + } else { + var pages = getCurrentPages(); //当前页面 + var iscos = th.data.iscos; + var delta = 1; + if (Number(iscos) == 1) { + delta = delta + Number(iscos); //返回哪个页面 + var prevPage = pages[pages.length - 2 - Number(iscos)]; //上一页面 + prevPage.setData({ + //直接给上一个页面赋值 + time: time, + beautician_name: th.data.StaffName, + beauticianID: th.data.beautician_id + }); + wx.navigateBack({ + //返回 + delta: 2 + }) + } else { + var prevPage = pages[pages.length - 2]; //上一页面 + prevPage.setData({ + //直接给上一个页面赋值 + time: time + }); + wx.navigateBack({ + //返回 + delta: 1 + }) + } + } + }, + //选择时间 + Selection_time: function (e) { + var th = this; + var index = e.currentTarget.dataset.index; + var time_index = th.data.time_index; + if (index == time_index) { + return false; + } else { + th.setData({ + time_index: index + }) + } + }, + //查询七天预约时间 + query_aweek: function () { + var th = this; + var beautician_id = th.data.beautician_id; //美容师id + var storageId = th.data.storageId; + + var itemId = th.data.itemId; //服务id + var projectId = th.data.projectId; //项目id + var number = th.data.number; //预约单号 + var url = "/api/weshop/marketing/reservation/staff/seven/time/listnew"; //接口地址 + getApp().request.promiseGet(url, { + data: { + projectId: projectId, + beauticianId: beautician_id, + serviceId: itemId, + storeId: a.stoid, + storageId: storageId, + number: number, + VipId: getApp().globalData.userInfo.erpvipid, + } + }).then(res => { + if (res.data.code == 0) { + var data = res.data.data; + var arr = []; + for (var i in data) { + var em = { + "time": i, + "val": data[i] + }; + arr.push(em); + } + arr.sort(th.sort_arr); + var weeks = ["今天", "明天", "后天"]; + var week = ""; + for (var i = 3; i < arr.length; i++) { + var date = new Date(arr[i].time); + if (date.getDay() == 0) week = "周日" + if (date.getDay() == 1) week = "周一" + if (date.getDay() == 2) week = "周二" + if (date.getDay() == 3) week = "周三" + if (date.getDay() == 4) week = "周四" + if (date.getDay() == 5) week = "周五" + if (date.getDay() == 6) week = "周六" + weeks[i] = week; + } + th.setData({ + aweeks: arr, + weeks: weeks + }) + th.query_date(); + + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }) + + }, + + query_date: function () { + var th = this; + var projectId = th.data.projectId; + var date_id = th.data.date_id; //日期下标 + var SeekTime = th.data.aweeks[date_id].time; + var val = th.data.aweeks[date_id].val; + var number = th.data.number; //预约单号 + var url = "/api/weshop/marketing/reservation/staff/time/listnew"; + getApp().request.promiseGet(url, { + data: { + projectId: projectId, + staffId: th.data.beautician_id, + storageId: th.data.storageId, + serviceId: th.data.itemId, + seekTime: SeekTime, + storeId: a.stoid, + number: number, + VipId: getApp().globalData.userInfo.erpvipid, + } + }).then(res => { + if (res.data.code == 0) { + var hours = th.data.hours; + var time_list = res.data.data; + var time = th.data.time; + var date_id = th + var new_time = []; + var date = th.data.hours.substring(0, 2); + + //不等于空就是有可以预约的时间 + if (time_list != null) { + if (res.data.data && res.data.data[0] != undefined) { + if (res.data.data[0].GroupHour && res.data.data[0].GroupHour.length > 11) { + getApp().my_warnning(res.data.data[0].GroupHour, 0, th); + } + } + //循环固定和可预约的时间 + for (var i = 0; i < time.length; i++) { + for (var ii = 0; ii < time_list.length; ii++) { + //判断固定的时间和可以预约的时间 + if (time[i] == time_list[ii].begintime.substring(0, 5)) { + var date_id = th.data.date_id; + if (date > time_list[ii].begintime.substring(0, 2) && date_id == 0) { + new_time[i] = ""; + break; + } else { + new_time[i] = time_list[ii].begintime.substring(0, 5); + break; + } + } else { + new_time[i] = ""; + } + } + } + } else { + for (var i = 0; i < time.length; i++) { + new_time[i] = ""; + } + } + th.setData({ + time_list: new_time, + }) + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }) + + }, + //更改预约时间 + change_time: function () { + var th = this; + var seekTime = th.data.seekTime; //选择的日期 + var time_list = th.data.time_list; + var time_index = th.data.time_index; + var time = time_list[time_index]; + var number = th.data.number; //预约单号 + var json = { + "arrangeTime": seekTime + " " + time, + "number": number, + "remark": "更改预约时间", + "states": 0, + "storeId": a.stoid + }; + var data = JSON.stringify(json); + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址 + wx.request({ + url: url, + data: data, + method: 'put', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function (res) { + if (res.data.code == 0) { + getApp().my_warnning("更改成功", 0, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + } + }) + }, + //预览头像 + previewImage: function (e) { + var th = this; + var current = e.currentTarget.dataset.src; + getApp().globalData.no_clear=1; + wx.previewImage({ + current: current, // 当前显示图片的http链接 + urls: [th.data.head_img] // 需要预览的图片http链接列表 + }) + }, + + sort_arr: function (a, b) { + a = a['time']; + b = b['time']; + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }, + + check_is_in_arr: function (val, pdata) { + if (!val || !pdata) return false; + for (var i in pdata) { + if (pdata[i].begintime.indexOf(val) != -1) { + return true; + } + } + return false; + } + + + +}) \ No newline at end of file diff --git a/packageG/pages/user/my_service/beauty_deta.json b/packageG/pages/user/my_service/beauty_deta.json new file mode 100644 index 0000000..710a83b --- /dev/null +++ b/packageG/pages/user/my_service/beauty_deta.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "美容师详情", + "usingComponents": { + "warn": "/components/long_warn/long_warn" + } +} \ No newline at end of file diff --git a/packageG/pages/user/my_service/beauty_deta.wxml b/packageG/pages/user/my_service/beauty_deta.wxml new file mode 100644 index 0000000..57591e4 --- /dev/null +++ b/packageG/pages/user/my_service/beauty_deta.wxml @@ -0,0 +1,77 @@ + + + + + + + + {{name}} + + + + + + + {{comment}} + + + 暂无介绍 + + + + + + + + + + 服务预约 + + + + + {{weeks[index]}} + {{item.time}} + + + + + {{weeks[index]}}(约满) + {{item.time}} + + + + + + + + + + + + + + {{it}} + + + + + + + {{it}} + + + + + + 确定选择 + + + + + + + + + + \ No newline at end of file diff --git a/packageG/pages/user/my_service/beauty_deta.wxss b/packageG/pages/user/my_service/beauty_deta.wxss new file mode 100644 index 0000000..09fc465 --- /dev/null +++ b/packageG/pages/user/my_service/beauty_deta.wxss @@ -0,0 +1,134 @@ +.container { + border-top: 7rpx solid rgb(245, 245, 245); +} + +.backcolor { + position: absolute; + top: 0rpx; + left: 0rpx; + z-index: 0; + width: 100%; + height: 270rpx; + background-color: rgb(214, 1, 33); + +} + +.comments { + position: absolute; + top: 45rpx; + left: 0rpx; + z-index: 1; + padding: 0rpx 23rpx; +} + +.name { + font-weight: bold; + float: left; + width: 250rpx; +} + +.head { + width: 130rpx; + height: 130rpx; + border-radius: 50%; + float: right; + margin: 0rpx 15rpx; + /* border: 2rpx solid red; */ +} + +.introduce { + margin-top: 90rpx; + text-indent: 2em; + color: rgb(102, 102, 102); +} + +.Personal { + width: 640rpx; + height: 300rpx; + background-color: rgb(255, 255, 255); + border-radius: 5rpx; + box-shadow: 0rpx 2rpx 2rpx 2rpx rgb(250, 228, 230); + margin-bottom: 65rpx; + padding-top: 40rpx; + padding-left: 35rpx; + padding-right: 35rpx; +} + +.choice { + height: 70rpx; + background-color: rgb(214, 1, 33); + color: rgb(255, 255, 255); + margin-top: 30rpx; +} + +.scroll-h { + white-space: nowrap; + width: 704rpx; + overflow: visible; + height: 125rpx; + color: transparent; +} + +.scroll-item-h { + display: inline-block; + width: 172rpx; + text-align: center; + overflow: visible; + height: 70rpx; + padding: 15rpx 0rpx; +} +::-webkit-scrollbar{ + width: 0; + height: 0; + color: transparent; +} +.box { + width: 0px; + height: 0px; + margin-left: 15rpx; + border-top: 21rpx solid transparent; + border-right: 21rpx solid transparent; + border-left: 21rpx solid transparent; + display: inline-block; + transform: rotate(180deg); + border-bottom: 21rpx solid rgb(214, 1, 33); +} + +.bd { + /* border: 2rpx solid rgb(238, 238, 238); */ + background-color: rgb(255, 255, 255); + color: rgb(20, 20, 20); +} + +.chbd { + border: 2rpx solid rgb(214, 1, 33); + background-color: rgb(214, 1, 33); + color: rgb(255, 255, 255); +} + +.Times { + background-color: rgb(238, 243, 247); + margin-bottom: 30rpx; + padding:34rpx 27rpx; +} + +.Time { + border: 2rpx solid rgb(238, 238, 238); + width: 160rpx; + height: 70rpx; + background-color: rgb(255, 255, 255); + text-align: center; + padding-top: 15rpx; + padding-bottom: 15rpx; +} +.chTime{ + border-color: rgb(214, 1, 33); +} +.nochTime{ + color: rgb(174,177,177); + background-color: rgb(250,250,250); +} +.abs { + left: 55rpx; + bottom: -39rpx; +} diff --git a/packageG/pages/user/my_service/cosmetology_list.js b/packageG/pages/user/my_service/cosmetology_list.js new file mode 100644 index 0000000..5d71119 --- /dev/null +++ b/packageG/pages/user/my_service/cosmetology_list.js @@ -0,0 +1,108 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + + /** + * 页面的初始数据 + */ + data: { + defimgurl: "/miniapp/images/no-head.jpg", + iurl: a.imghost, + cosmetology_list: [], //美容师列表 + is_cosmetology_read: 0, //是否有读过美容师接口,该属性用在没有美容师列表的排版 + curpage: 1, //当前分页数 + pageSize: 10, //页大小 + total: 0, //总数量 + ismore: 0, //是否加载完毕 + itemId: 0, //服务id, + storageId: 0, //线下门店id + projectId:"",//项目id + }, + onReachBottom: function() { + var th = this; + if (this.data.total <= th.data.pageSize) return; + if (this.data.ismore) return; + wx.showLoading({ + title: '加载中...', + }) + th.query_cology(); + }, + query_cology: function() { + var th = this; + var url = "/api/weshop/marketing/reservation/staff/pagenew"; + var itemId = th.data.itemId; //服务id + var storageId = th.data.storageId; + getApp().request.promiseGet(url, { + data: { + storeId: a.stoid, + userId: d.user_id, + serviceId: itemId, + storageId: storageId, + page: th.data.curpage, + pageSize: th.data.pageSize + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + th.data.curpage++; + var arr1 = th.data.cosmetology_list; + var arr2 = res.data.data; + var arr3 = [...arr1, ...arr2]; + + + th.setData({ + cosmetology_list: arr3, + total: res.data.data.total, + is_service_read: 1, + is_cosmetology_read:1 + }), wx.stopPullDownRefresh(); //停止下拉刷新 + } else { + th.setData({ + is_cosmetology_read:1, + ismore:1 + }) + } + }) + }, + //图片失败,默认图片 + bind_bnerr1: function(e) { + var _errImg = e.target.dataset.errorimg; + var _Img = e.target.dataset.img; + if (_Img != undefined) { + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/no-head.jpg"; + console.log(_errObj,"zzzzzzz"); + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var th = this; + th.setData({ + projectId: options.projectId, + itemId: options.itemId, + storageId: options.storageId + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + var th = this; + th.data.curpage++; + th.setData({ + cosmetology_list: [], + total: 0, + is_service_read: 0, + is_cosmetology_read:0 + }) + th.query_cology(); + }, + +}) \ No newline at end of file diff --git a/packageG/pages/user/my_service/cosmetology_list.json b/packageG/pages/user/my_service/cosmetology_list.json new file mode 100644 index 0000000..90bf58b --- /dev/null +++ b/packageG/pages/user/my_service/cosmetology_list.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "美容师列表", + "usingComponents": { + "warn": "/components/long_warn/long_warn" + } +} \ No newline at end of file diff --git a/packageG/pages/user/my_service/cosmetology_list.wxml b/packageG/pages/user/my_service/cosmetology_list.wxml new file mode 100644 index 0000000..403789f --- /dev/null +++ b/packageG/pages/user/my_service/cosmetology_list.wxml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + {{item.StaffName}} + + + + + + + + + {{it.LabelName}} + + + + + + + + 预约 + + + + + {{item.Remark1}} + + + + 暂无介绍 + + + + + + + + 到底了 + + + + + + + + + + 暂无美容师 + + + 其他项目 + + + + \ No newline at end of file diff --git a/packageG/pages/user/my_service/cosmetology_list.wxss b/packageG/pages/user/my_service/cosmetology_list.wxss new file mode 100644 index 0000000..4a8fb7b --- /dev/null +++ b/packageG/pages/user/my_service/cosmetology_list.wxss @@ -0,0 +1,124 @@ +page{ + height: 100%; +} +.container{ + background-color: rgb(255,255,255); +} +.appointment { + width: 100%; + height: 305rpx; +} + +.single { + margin-left: 10rpx; + border-bottom: 1rpx solid rgb(229, 229, 229); + padding-bottom: 30rpx; + padding-left: 20rpx; + padding-right: 35rpx; + padding-top: 30rpx; +} + +.portrait { + width: 140rpx; + height: 140rpx; + border-radius: 50%; + margin-right: 30rpx; +} +.UserName{ + max-width: 250rpx; +} +.Stars { + width: 25rpx; + height: 25rpx; + margin-right: 7rpx; +} +.Labels{ + width: 100%; + margin-top: 15rpx; +} +.Label { + margin-top: 25rpx; +} + +.Labelitem { + width: 100rpx; + height: 30rpx; + border-radius: 20rpx; + line-height: 30rpx; + margin-right: 10rpx; + padding:0rpx 9rpx; +} + +.itone { + border: 2rpx solid rgb(22, 232, 131); + color: rgb(22, 232, 131); +} + +.itwo { + border: 2rpx solid rgb(92, 135, 248); + color: rgb(92, 135, 248); +} + +.ith { + border: 2rpx solid rgb(244, 143, 55); + color: rgb(244, 143, 55); +} + +.gofu { + width: 120rpx; + padding: 5rpx 0rpx; + border-radius: 25rpx; +} + +.go { + border: 1rpx solid rgb(196, 26, 46); + color: rgb(196, 26, 46); + background-color: rgb(255,255,255); +} + +.gofull { + border: 1rpx solid rgb(185, 185, 185); + color: rgb(185, 185, 185); + background-color: rgb(255,255,255); +} + +.information { + margin-top: 25rpx; + text-indent: 2em; + color: rgb(103, 103, 103); +} +/* 无订单 */ +.empty_order image { + width: 330rpx; + height: 280rpx; + margin-top: 120rpx; +} + +.empty_order .xc-ash { + margin-top: 10rpx; + font-weight: 600px; +} + +.empty_order navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.empty_order navigator view { + width: 247rpx; + height: 56rpx; + background-color: rgb(255, 72, 72); + border-radius: 40rpx; +} +.After_all { + height: 80rpx; +} + +.After_all .Line { + border-top: 3rpx solid rgb(0, 0, 0); + width: 130rpx; +} + +.After_all .end { + margin: 0rpx 15rpx; +} diff --git a/packageG/pages/user/my_service/tment_order_list.js b/packageG/pages/user/my_service/tment_order_list.js new file mode 100644 index 0000000..8ad4b7f --- /dev/null +++ b/packageG/pages/user/my_service/tment_order_list.js @@ -0,0 +1,230 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片网址 + activeCategoryId: 0, //类别选中下标 + defimgurl: "/miniapp/images/yyservice/yyxmdefault.jpg", + categories: [{ + name: "全部", + id: 0 + }, { + name: "未服务", + id: 1 + }, { + name: "已服务", + id: 2 + }, { + name: "已过期", + id: 3 + }], + tm_order_list: [], //我的预约订单列表 + curpage: 1, //当前分页数 + pageSize: 10, //页大小 + total: 0, + ismore: 0, //是否加载完毕 + is_read: 0, //是否加载接口 + states: 4, //4为取消预约 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var state=options.state; + if (state != null && state != undefined && state!=""){ + this.setData({ activeCategoryId: state }); + } + + }, + changeTab: function(e) { + var th = this; + var id = e.currentTarget.dataset.id; + var activeCategoryId = th.data.activeCategoryId; + if (id != activeCategoryId) { + th.setData({ + activeCategoryId: id, + tm_order_list: [], + curpage: 1, + ismore: 0, + is_read: 0 + }) + th.query_orderList(); + } else { + return false; + } + }, + //显示核销码 + code_show: function(e) { + var th = this; + //--获取成功的时候-- + var no = e.currentTarget.dataset.order_sn; + var qc_com = th.selectComponent("#qc_com"); //组件的id + var obj = { + val: no, + content: "请将二维码展示给核销员,使用更快捷" + }; + qc_com.open(obj) + }, + query_orderList: function() { + wx.showLoading({ + title: '加载中', + }) + var th = this; + var url = "/api/weshop/marketing/reservation/reservation/page"; + + var state_index = th.data.activeCategoryId; + if (state_index == 0) { + state_index = ""; + } else { + --state_index; + } + th.setData({ + is_read: 0 + }) + getApp().request.promiseGet(url, { + data: { + storeId: a.stoid, + userId: d.user_id, + state: state_index, + page: th.data.curpage, + pageSize: th.data.pageSize + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + th.data.curpage++; + var arr1 = th.data.tm_order_list; + var arr2 = res.data.data.pageData; + var arr3 = [...arr1, ...arr2]; + for(var i = 0;i + + + + {{item.name}} + + + + + + + + + 订单编号:{{item.Number}} + + + 未服务 + 已服务 + 已过期 + 已取消 + 已评价 + + + + + + + + + + + + + + 预约门店: + {{item.StorageName}} + + + 预约项目: + {{item.ServiceName}} + + + + 服务美容师: + + + + 预约美容师: + + + {{item.BeauticianName}} + + + 预约时间: + {{item.ArrangeTime}} + + + 服务时间: + {{item.WriteTime}} + + + + + + + + + 取消预约 + + + 查看详情 + + 更改时间 + 发表评价 + 重新预约 + 评价详情 + + + + + 到底了 + + + + + + + + + + + 无预约记录 + + + 立即预约 + + + + + + + + + \ No newline at end of file diff --git a/packageG/pages/user/my_service/tment_order_list.wxss b/packageG/pages/user/my_service/tment_order_list.wxss new file mode 100644 index 0000000..2219dee --- /dev/null +++ b/packageG/pages/user/my_service/tment_order_list.wxss @@ -0,0 +1,152 @@ +page { + height: 100%; +} + +.container { + background-color: rgb(255, 255, 255); +} + +.type-navbar { + border-top: 3rpx solid rgb(221, 221, 221); + display: flex; + justify-content: space-between; + position: fixed; + background-color: rgb(255,255,255); + width:696rpx; +} +.itemMax{ + margin-top: 93rpx; +} + +.type-box { + height: 88rpx; + line-height: 88rpx; + padding: 0rpx 15rpx; + border-bottom: 5rpx solid rgb(255, 255, 255); +} + +.chtypebox { + border-bottom: 5rpx solid rgb(224, 18, 18); +} + +.Commodity_number { + height: 80rpx; + border-top: 13rpx solid rgb(245, 245, 245); +} + +.Commodity_number image { + width: 30rpx; + height: 32rpx; +} + +.padding { + padding: 0rpx 27rpx; +} + +.lin { + border-left: 2rpx solid rgb(211, 29, 54); + margin-left: 17rpx; + margin-right: 14rpx; + height: 40rpx; +} + +.order_number { + max-width: 550rpx; +} +.state{ + color: rgb(216,63,82); +} +.items { + border-top: 4rpx solid rgb(245, 245, 245); + border-bottom: 4rpx solid rgb(245, 245, 245); + height: 260rpx; +} +.code{ + width: 55rpx; + height: 55rpx; +} +.itemimage { + width: 190rpx; + height: 190rpx; + margin-right: 20rpx; + border-radius: 50%; + border: 1px solid #eee; +} + +.details { + height: 190rpx; +} + +.itemname { + width: 150rpx; + margin-right: 20rpx; +} + +.itemvalue { + max-width: 300rpx; +} + +.Unimportance { + width: 140rpx; + height: 40rpx; + line-height: 40rpx; + border-radius: 8rpx; + background-color: rgb(255, 255, 255); + margin-left: 20rpx; + border: 2rpx solid rgb(191, 191, 191); +} + +.important { + background-color: rgb(212, 28, 52); + border: 2rpx solid rgb(212, 28, 52); + color: rgb(255, 255, 255); +} + +.Unim { + height: 110rpx; +} + +.exactly { + height: 80rpx; + background-color: rgb(245, 245, 245); +} + +.exactly_text { + margin: 0rpx 15rpx; +} + +.line { + border-top: 2rpx solid rgb(0, 0, 0); + width: 130rpx; +} + +/* 无预约 */ + +.empty_order image { + width: 300rpx; + height: 280rpx; + margin-top: 202rpx; +} + +.empty_order .xc-ash { + margin-top: 10rpx; + font-weight: 600px; +} + +.empty_order navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.empty_order navigator view { + width: 247rpx; + height: 65rpx; + background-color: rgb(255, 72, 72); + border-radius: 40rpx; +} +.base{ + display: flex; + height: 38rpx; + line-height: 38rpx; + align-items: baseline; +} \ No newline at end of file diff --git a/packageG/pages/user/userinfo/userinfo.js b/packageG/pages/user/userinfo/userinfo.js new file mode 100644 index 0000000..1773a31 --- /dev/null +++ b/packageG/pages/user/userinfo/userinfo.js @@ -0,0 +1,1107 @@ +function e(e, a, r) { + return a in e ? Object.defineProperty(e, a, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[a] = r, e; +} + +var a = getApp(), + r = a.globalData.setting, + t = a.request, + s = require("../../../../utils/common.js"), + util = require("../../../../utils/util.js"), + ut = util, + d = getApp().globalData; + +var timestamp = Date.parse(new Date()); +var date = new Date(timestamp); +const { + barcode, + qrcode +} = require('../../../../utils/index.js'); + +Page({ + data: { + phone: "", + url: r.url, + resourceUrl: r.resourceUrl, + iurl: r.imghost, + defaultAvatar: r.resourceUrl + "/static/images/user68.jpg", + user: null, + tc_hide: true, + stoname: "", + checkDate: false, + datet: "", + year: date.getFullYear(), + store: 0, + all_sto: "", + region_name: "", + def_pick_store: "", + sort_store: 0, //门店分类 + sec_sto: "", + more_store: 0, //选择门店 + choice_sort_store: 0, //选择分类门店 + more_store: 0, //选择门店 + lat: null, //维度 + lon: null, //经度 + fir_pick_index: 0, + sec_pick_index: 0, + is_gps: 1, + is_no_plus:1, + lon: 0, + only_pk: 0, + open_ind_store: 0, //哪里打开的门店列表的控制属性 + ispwhid: 1, //是否隐藏密码显示 + isstcsp: 0, //是否启用密码消费 + isGender: 1, //什么性别 + iscalendar: 0, //是否是农历 + consumption: "", //消费密码 + identity_card: "", //身份证值 + address: "", //地址 + openid: "", //openid + pulscardname: "", //PLUS会员的卡 + gradename: "", //会员权益的卡 + isBool: "", + sto_sele_id: "", //所属门店id + is_zy: 0, //是否执行onshow + is_lable_set: "", //是否启用我的兴趣标签 + check_label: [], //我选择的兴趣标签 + fir_guide_id:null, //存储会员详情接口出来的美导ID + + userInfo: {}, + hasUserInfo: false, + canIUseGetUserProfile: false, + getusercode_vailtime:10,//会员二维码时效 + + sele_ing:0, + set_isstcsp:0 + + }, + //通过路径跳转到其他页面 + goto: function(e) { + this.data.is_zy=1; //避免页面重新加载 + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + //获取配置信息 + get_config: function() { + var th = this; + getApp().getConfig2(function(ee) { + console.log('ee',ee); + var sms_conf = ee.switch_list; + sms_conf = JSON.parse(sms_conf); + let reg_type = ee.reg_type; + let reg_info = ee.reg_info; + var con_f={ + rank_switch:sms_conf.rank_switch, + is_lable_set: sms_conf.user_label_set, //是不是会员标签设置 + guide_title:sms_conf.guide_consultant, //系统参数 导购标题 + guide_change_time:sms_conf.guide_change_time, //每月能修改几次 + } + if(reg_type) con_f.reg_info= JSON.parse(reg_info); + th.setData(con_f) + + if (sms_conf.usercode_vailtime!=null && parseInt(sms_conf.usercode_vailtime)>0) + { + th.setData({ getusercode_vailtime: sms_conf.usercode_vailtime }); + } + if (sms_conf.user_label_set) { + th.query_checklabels(); + } + },1) + }, + //查找会员选择的兴趣标签 + query_checklabels: function() { + var th = this; + var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; + var interest_lables = th.data.interest_lables; //兴趣标签 + getApp().request.promiseGet(url, { + data: { + userId: d.user_id, + storeId: r.stoid + } + }).then(res => { + if (res.data.code == 0) { + var data = res.data.data; + var VipLabel = th.data.check_label; //通过id标签找到已选择的标签 + var dateList = data.VipLabel.split(","); + for (var i in dateList) { + if (dateList[i] != "") { + VipLabel.push(dateList[i]); + } + } + th.setData({ + check_label: VipLabel + }) + } else { + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); + } + }) + }, + //是否启动密码消费 + isstcsp: function() { + var th = this; + var isstcsp = th.data.isstcsp; + if (isstcsp == 0) { + th.setData({ + isstcsp: 1 + }) + } else { + + if(this.data.user.isVerification) { + getApp().my_warnning("已设置消费需启用密码,无法取消", 0, th); + return false; + } + + th.setData({ + isstcsp: 0 + }) + } + }, + //出生日期是否是农历 + iscalendar: function() { + + if(this.data.user.birthday) return false; + var th = this; + var iscalendar = th.data.iscalendar; + if (iscalendar == 0) { + th.setData({ + iscalendar: 1 + }) + } else { + th.setData({ + iscalendar: 0 + }) + } + }, + //性别 + isGender: function(e) { + var th = this; + var sex = e.currentTarget.dataset.sex; + th.setData({ + isGender: sex + }) + }, + //密码是否隐藏显示 + ispwhid: function() { + var th = this; + var ispwhid = th.data.ispwhid; + + if (ispwhid == 0) { + th.setData({ + ispwhid: 1 + }) + } else { + th.setData({ + ispwhid: 0 + }) + } + }, + checkDate: function() { + var th = this; + if (th.data.checkDate) { + th.setData({ + checkDate: false + }) + } else { + th.setData({ + checkDate: true + }) + } + }, + bindChange: function(e) { + this.setData({ + datet: e.detail.value, + }); + }, + //---点击二级之后的选择--- + choose_for_store: function(e) { + var index_c = e.currentTarget.dataset.ind; + + this.setData({ + sec_pick_index: index_c, + fir_pick_index: index_c + }) + }, + //确定def_pick为选择的门店 + sure_pick: function(e) { + var th = this; + var item = null; + var openindstore = th.data.open_ind_store; + if (th.data.choice_sort_store == 0) { + var index = th.data.fir_pick_index; + if (th.data.is_show_sto_cat == 1) { + item = th.data.def_pickpu_list[index]; + } else { + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 + } + + } else { + var index = th.data.sec_pick_index; + item = th.data.sec_sto.s_arr[index]; + } + if(!item) return false; + th.setData({ + def_pick_store: item, + stoname: item.pickup_name, + sto_sele_name: item.pickup_name, + sto_sele_id: item.pickup_id, + sto_sele_distr: item.distr_type, + store: 0, + choice_sort_store: 0, + fir_pick_index: 0 + }); + + if (openindstore == 1) { + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, + }); + } else if (openindstore == 2) { + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, + openSpecModal_pt: 1 + }); + } + }, + choose_for_store_fir: function(e) { + var index_c = e.currentTarget.dataset.ind; + this.setData({ + fir_pick_index: index_c + }) + }, + wait_for_store_config: function() { + var th = this; + wx.getLocation({ + type: 'gcj02', + success: function(res) { + th.data.lat = res.latitude; + th.data.lon = res.longitude; + th.data.is_get_local_ok = 1; + }, + fail: function(res) { + if (res.errCode == 2) { + th.setData({ + is_gps: 0 + }); + if (th.data.is_gps == 0) { + getApp().confirmBox("请开启GPS定位", null, 10000, !1); + } + } else { + th.setData({ + is_gps: "3" + }); + } + th.data.is_get_local_ok = 1; + } + }) + }, + onclickstore: function() { + var th = this; + //检验门店的点击,看下次数是不是到了 + this.check_click_ok(function(){ + if (th.data.store == 0) { + th.setData({ + store: 1 + }) + } else { + th.setData({ + store: 0 + }) + } + var dd = { + store_id: r.stoid, + isstop: 0, + pageSize: 2000 + } + th.setData({ + sort_store: 0 + }); + var i = getApp().request; + //如果有距离的话 + if (th.data.lat != null) { + dd.lat = th.data.lat; + dd.lon = th.data.lon; + } + //----------获取门店---------------- + getApp().request.get("/api/weshop/pickup/list", { + data: dd, + success:function(res){ + var e = res; + if (e.data.code == 0) { + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- + if (th.data.def_pick_store) { + for (var k = 0; k < e.data.data.pageData.length; k++) { + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { + e.data.data.pageData.splice(k, 1); //删除 + break; + } + } + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 + } + + //单总量超出5个的时候 + if (e.data.data.total > 10) { + i.get("/api/weshop/storagecategory/page", { + data: { + store_id: r.stoid, + pageSize: 1000, + orderField:"sort", + orderType:'asc', + }, + success: function(ee) { + if (ee.data.code == 0) { + + var check_all_cate=0; + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ + for(let i in ee.data.data.pageData){ + let item=ee.data.data.pageData[i]; + if(item.is_show==1){ + check_all_cate=1;break + } + } + } + + + if (check_all_cate) { + + var sto_cate = ee.data.data.pageData; + var sto_arr = e.data.data.pageData; + var newarr = new Array(); + var qita = new Array(); + + var is_del_pk=0; + //----要进行门店分组-------- + for (var i = 0; i < sto_arr.length; i++) { + //找一下这个门店有没有在分类数组内 + var find2 = 0, find2name = "",sort=0; + is_del_pk=0; + for (var m = 0; m < sto_cate.length; m++) { + if (sto_arr[i].category_id == sto_cate[m].cat_id) { + if(sto_cate[m].is_show!=1){ + is_del_pk=1; sto_arr.splice(i,1); + i--; + }else { + find2 = sto_cate[m].cat_id; + find2name = sto_cate[m].cat_name; + sort = sto_cate[m].sort; + is_del_pk=0; + } + break; + } + } + + if(is_del_pk) continue; + if (newarr.length > 0) { + var find = 0; + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + for (var ii = 0; ii < newarr.length; ii++) { + if (sto_arr[i].category_id == newarr[ii].cat_id) { + newarr[ii].s_arr.push(sto_arr[i]); + find = 1; + break; + } + } + if (find == 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + sort:sort, + s_arr: arr0 + }; + newarr.push(item); + } + } else { + qita.push(sto_arr[i]); + } + } else { + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + sort:sort, + s_arr: arr0 + }; + newarr.push(item); + } else { + qita.push(sto_arr[i]); + } + } + } + + var def_arr = new Array(); + //-- 开始就看10个门店 -- + for (var k = 0; k < 10; k++) { + if (k == e.data.data.pageData.length) break; + def_arr.push(e.data.data.pageData[k]); + } + + th.setData({ + def_pickpu_list: def_arr, + pickpu_list: ee.data.data.pageData + }); + + //门店分类要排序下 + function compare(property){ + return function(a,b){ + var value1 = a[property]; + var value2 = b[property]; + return value1 - value2; + } + } + if(newarr.length>0) + newarr.sort(compare("sort")); + + //----安排其他的分类----- + if (qita.length > 0) { + var item = { + cat_id: -1, + name: "其他", + s_arr: qita + }; + newarr.push(item); + } + th.setData({ + is_show_sto_cat: 1, + all_sto: newarr + }); + + } else { + th.setData({ + is_show_sto_cat: -1, + only_pk: e.data.data.pageData + }); + } + } else { + th.setData({ + is_show_sto_cat: -1, + only_pk: e.data.data.pageData + }); + } + } + }); + } else { + th.setData({ + is_show_sto_cat: 0, + only_pk: e.data.data.pageData + }); + } + } + } + }) + + },2) + + }, + + //选择更多门店 + more_store: function() { + this.setData({ + sort_store: 1 + }); + }, + //---选择分类门店--- + choice_sort_store: function(e) { + var index = e.currentTarget.dataset.index; + var region_name = e.currentTarget.dataset.region; + var item = this.data.all_sto[index]; + this.setData({ + region_name: region_name, + sort_store: 0, + choice_sort_store: 1, + sec_sto: item, + sec_pick_index: 0 + }); + }, + // 返回按钮 + returns: function() { + this.setData({ + sort_store: 0, + choice_sort_store: 0 + }); + }, + //身份证号严格校验 + IdentityIDCard: function(e) { + var code = e.detail.value; + //身份证号前两位代表区域 + var city = { + 11: "北京", + 12: "天津", + 13: "河北", + 14: "山西", + 15: "内蒙古", + 21: "辽宁", + 22: "吉林", + 23: "黑龙江 ", + 31: "上海", + 32: "江苏", + 33: "浙江", + 34: "安徽", + 35: "福建", + 36: "江西", + 37: "山东", + 41: "河南", + 42: "湖北 ", + 43: "湖南", + 44: "广东", + 45: "广西", + 46: "海南", + 50: "重庆", + 51: "四川", + 52: "贵州", + 53: "云南", + 54: "西藏 ", + 61: "陕西", + 62: "甘肃", + 63: "青海", + 64: "宁夏", + 65: "新疆", + 71: "台湾", + 81: "香港", + 82: "澳门", + 91: "国外 " + }; + //身份证格式正则表达式 + var idCardReg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i; + var errorMess = ""; //错误提示信息 + var isPass = true; //身份证验证是否通过(true通过、false未通过) + + //如果身份证不满足格式正则表达式 + if (!code || !idCardReg.test(code)) { + errorMess = "您输入的身份证号格式有误!"; + isPass = false; + } + + //区域数组中不包含需验证的身份证前两位 + else if (!city[code.substr(0, 2)]) { + errorMess = "您输入的身份证地址编码有误!"; + isPass = false; + } else { + //18位身份证需要验证最后一位校验位 + if (code.length == 18) { + code = code.split(''); + //∑(ai×Wi)(mod 11) + //加权因子 + var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + //校验位 + var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]; + var sum = 0; + var ai = 0; + var wi = 0; + for (var i = 0; i < 17; i++) { + ai = code[i]; + wi = factor[i]; + sum += ai * wi; + } + var last = parity[sum % 11]; + if (parity[sum % 11] != code[17]) { + errorMess = "您输入的身份证号不存在!"; + isPass = false; + } + } + } + var returnParam = { + 'errorMess': errorMess, + 'isPass': isPass + } + if (errorMess != "") { + wx.showModal({ + title: errorMess, + content: '', + showCancel: false, + confirmText: '确定', + confirmColor: '', + success: function(res) {}, + fail: function(res) {}, + complete: function(res) {}, + }) + } + return returnParam; + }, + //------初始化加载---------- + onLoad: function(t) { + let th= this; + var user = getApp().globalData.userInfo; + if (user.card_field != '' && user.card_field != null && user.card_field != undefined && user.card_expiredate) { + var now = ut.gettimestamp(); + var str = user.card_expiredate.replace(/-/g, '/');; + var end = new Date(str); + end = Date.parse(end) / 1000; + if (now < end) { + this.puls_user(); + } + } + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + r.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + this.initial_user(); + // 获取用户昵称 + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + //如果有指定要启用密码的时候 + if(t.isstcsp){ + this.setData({set_isstcsp:1,ispwhid:0}); + } + + }, + + // 获取用户头像昵称 + getUserProfile(e) { + var th = this; + + var ob={ + nickname:this.data.user.nickname, + head_pic:this.data.user.head_pic, + } + getApp().globalData.up_nick_avatar=ob; + getApp().goto('/packageE/pages/user/nick_avatar/nick_avatar'); + + + // new Promise((resolve, reject) => { + // wx.getUserProfile({ + // desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + // success: (res) => { + // th.data.user.nickname = res.userInfo.nickName; + // th.data.user.head_pic = res.userInfo.avatarUrl; + // this.setData({ + // userInfo: res.userInfo, + // hasUserInfo: true, + // user: th.data.user, + // }); + // resolve(res.userInfo); + // }, + // + // }); + // }).then((userInfo) => { + // getApp().request.put("/api/weshop/users/update", { + // data: { + // storeId: r.stoid, + // user_id: getApp().globalData.user_id, + // nickname: userInfo.nickName, + // head_pic: userInfo.avatarUrl + // + // }, + // success: function(su) { + // if (su.data.code == 0) { + // console.log("update user info OK"); + // } + // } + // }); + // }); + + + }, + + + //-----------会员是否初始化--------------------- + initial_user: function() { + + var th = this; + getApp().request.get("/api/weshop/users/grade/vip/init/get", { + data: { + storeId: r.stoid, + }, + success: function(su) { + var isBool = su.data.data.isBool; + th.setData({ + isBool: isBool + }); + + if (!isBool) return false; + //-----会员权益获取-------------- + getApp().request.get("/api/weshop/users/grade/aftervipinfo/get", { + data: { + storeId: r.stoid, + userId: getApp().globalData.user_id, + }, + success: function(su) { + var gradename = su.data.data.GradeName; + th.setData({ + gradename: gradename + }); + } + }); + + } + }); + this.get_config(); + }, + + + //-----Plus会员获取----------- + puls_user: function() { + var th = this; + getApp().request.get("/api/weshop/plus/vip/mem/list", { + data: { + storeId: r.stoid, + userId: getApp().globalData.user_id, + }, + success: function(su) { + + if (su.data.code == 0) { + var cardname = su.data.data[0].MemCardName; + th.setData({ + pulscardname: cardname + }); + } + } + }); + }, + + onShow: function() { + getApp().check_can_share(); + var e = this; + + //如果有传值进行跳转的话, + var choice_guide=null; + if(getApp().globalData.choice_guide){ + choice_guide=JSON.parse(JSON.stringify(getApp().globalData.choice_guide)); + getApp().globalData.choice_guide=null; + let user=this.data.user; + this.setData({ + 'user.staffName':choice_guide.StaffName, + 'user.staffId':choice_guide.Id, + 'user.staffTel':choice_guide.Tel + }) + return false; + } + + if (this.data.is_zy){ + this.data.is_zy=0; + return false; + } + this.wait_for_store_config(); + + + + var req = t; + req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { + success: function(src) { + var a = src.data.data; + + if(!a) a={}; + var time ="",birthday =""; + if(a && a.reg_time) time=util.formatTime(a.reg_time, "'Y/M/D"); + if(a && a.birthday) birthday=util.formatTime(a.birthday, "'Y/M/D"); + + a.reg_time = time; + a.birthday = birthday + + if(a.address=='null' || !a.address){ + a.address=""; + } + + e.data.fir_guide_id=a.staffId; + if(choice_guide){ + a.staffName=choice_guide.StaffName; + a.staffId=choice_guide.Id; + a.staffTel=choice_guide.Tel; + } + + if(e.data.set_isstcsp){ + a.vipnopwd=1; + } + + e.setData({ + phone: a.mobile, + user: a, + openid: a.openid, + sto_sele_id: a.pickup_id, + consumption: a.paypwd, + identity_card: a.idcard, + address: a.address, + isGender: a.sex, + isstcsp: a.vipnopwd, + iscalendar:a.islunar + }); + + } + }) + + + a.getUserInfo(function(a) { + var txt = util.formatTime(a.birthday, 'yyyy-M-d'), + arr = txt.split(' '); + a.birthday = arr[0]; + var txt2 = util.formatTime(a.reg_time, 'yyyy-M-d'), + arr2 = txt.split(' '); + a.reg_time = arr2[0]; + if (a.pickup_id != null) { + req.get("/api/weshop/pickup/get/" + r.stoid + "/" + a.pickup_id, { + success: function(da) { + if(da.data.data){ + //设置门店 + e.setData({ + stoname: da.data.data.pickup_name + }); + } + + } + }) + } + + }, !0); + }, + + onHide:function (){ + this.data.sele_ing=0; + }, + + editUserInfo: function(e) { + var r = e.currentTarget.dataset.type; + if (("password" == r || "paypwd" == r) && !this.data.user.mobile) return a.showWarning("请先绑定手机号码"); + r && this.data.user && wx.navigateTo({ + url: "/pages/user/userinfo_edit/userinfo_edit?type=" + r + }); + }, + + /*--------------------修改头像---------------------*/ + changeAvatar: function() { + return false; + var r = this; + getApp().globalData.no_clear=1; + wx.chooseImage({ + count: 1, + sizeType: ["compressed", "original"], + sourceType: ["camera", "album"], + success: function(u) { + t.uploadFile(r.data.url + "/api/user/upload_headpic", { + filePath: u.tempFilePaths[0], + name: "head_pic", + success: function(t) { + var u = s.getFullUrl(t.data.result); + r.setData(e({}, "user.head_pic", u)), a.globalData.userInfo.head_pic = u, a.showSuccess("设置头像成功"); + } + }); + } + }); + }, + + + //------卡片的显示和关闭-------- + show_tc: function() { + var that=this; + var req = t; + if (!getApp().globalData.userInfo) return false; + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') + var getnowtime; + req.get("/api/weshop/users/getServerTime", { + success: function (res) { + if (res.data.code == 0) + { + getnowtime=res.data.data; + if (!getnowtime) + { + getApp().showWarning("获取服务时间失败"); + return; + } + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; + val = "^" + ut.base64_encode(val); + + qrcode('qrcode', val, 480, 480, that); + that.setData({ + tc_hide: false, + }); + } + } + }) + + + }, + hide_tc: function() { + this.setData({ + tc_hide: true, + }); + }, + //消费密码输入框失去焦点事件 + lose_focus: function(e) { + var th = this; + var val = e.detail.value; + this.setData({ + consumption: val + }) + }, + + //地址 + address: function(e) { + var val = e.detail; + this.setData({ + address: val.value + }); + }, + + //身份证验证 + identity_card: function(e) { + var val = e.detail; + + this.setData({ + identity_card: val.value + }); + + }, + //用户名字 + user_name: function(e) { + var th = this; + var name = e.detail.value; + var vipname = 'user.vipname'; + if (name != "" || name != null) { + th.setData({ + [vipname]: name + }); + } + + }, + + //点击确认修改信息 + confirm_revision: function() { + var th = this; + var isstcsp = th.data.isstcsp; //是否启用消费密码 + var phone = th.data.phone; //手机号码 + if (phone == "" || phone == null) { + getApp().my_warnning("手机不能为空", 0, th); + return false; + } + var consumption = th.data.consumption; //消费密码 + var isstcsp = th.data.isstcsp; + if (isstcsp == 1) { + + if (consumption == null || consumption == "" || consumption == undefined) { + getApp().my_warnning("消费密码不能为空", 0, th); + return false; + } + if (consumption.length < 6) { + getApp().my_warnning("消费密码不能小于6位", 0, th); + return false; + } + } + var sex = th.data.isGender; //性别 + + if (sex != "1" && sex != "2") { + getApp().my_warnning("请选择性别", 0, th); + return false; + } + var user_name = th.data.user.vipname; //用户姓名 + if (user_name == "" || user_name == null) { + getApp().my_warnning("请输入名字", 0, th); + return false; + } + var identity_card = th.data.identity_card; //身份证 + + if (identity_card!=null && identity_card!=undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { + getApp().my_warnning("身份证号码错误", 0, th); + return false; + } + var address = th.data.address; //地址 + var sto_sele_id = th.data.sto_sele_id; + var datas = { + mobile: phone, //手机号码 + store_id: r.stoid, + user_id: getApp().globalData.user_id, + vipnopwd: isstcsp, + //vippass: consumption, //消费密码 + sex: sex, //性别 + vipname: user_name, //昵称 + idcard: identity_card, //身份证 + address: address, //地址 + pickup_id: sto_sele_id ,//自提门店 所属门店 + islunar:th.data.iscalendar, + birthday:th.data.datet + } + + if (isstcsp == 1) { + datas.vippass=consumption; + } + + + //往上提交美导的ID + if(th.data.fir_guide_id!=th.data.user.staffId){ + datas.staffId=th.data.user.staffId; + datas.StaffName=th.data.user.staffName; + } + + getApp().request.put("/api/weshop/users/updateUserInfo", { + data: datas, + success: function(res) { + if (res.data.code == 0) { + getApp().my_warnning("修改成功", 1, th); + getApp().goto("/pages/user/index/index"); + } else { + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); + } + } + }) + }, + //选择地址 + goto_address: function() { + // this.setData({ is_zy: 1 }); + }, + //更换手机 + go_phone: function(e) { + var url = e.currentTarget.dataset.url; + this.setData({ + is_zy: 1 + }); + getApp().goto(url); + }, + + //--点击分享事件--- + onShareAppMessage: function(t) { + getApp().globalData.no_clear=1; + return o.share; + }, + + //-- 跳转到获取导购的列表 -- + go_get_guide:function () { + let th=this; + + if(this.data.sele_ing) return false; + this.data.sele_ing=1; + this.check_click_ok(function(){ + th.data.is_zy=1; + getApp().goto("/packageB/pages/user/choice_guide/choice_guide?is_back=1"); + + },1) + }, + + //点击门店,导购的次数判断, type 1=导购 2=门店 + check_click_ok:function(func,idx){ + var th=this; + var userId=getApp().globalData.user_id; + getApp().request.get("/api/weshop/users/getGuideNum/"+r.stoid+"/"+userId+"/"+idx, { + success: function(res) { + if(res.data.code==0){ + func(); + }else{ + getApp().my_warnning(res.data.msg, 0, th); + } + } + }); + } + + +}); \ No newline at end of file diff --git a/packageG/pages/user/userinfo/userinfo.json b/packageG/pages/user/userinfo/userinfo.json new file mode 100644 index 0000000..9a57847 --- /dev/null +++ b/packageG/pages/user/userinfo/userinfo.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "个人资料", + "enablePullDownRefresh": false, + "usingComponents": { + "warn": "/components/long_warn/long_warn" + } +} \ No newline at end of file diff --git a/packageG/pages/user/userinfo/userinfo.wxml b/packageG/pages/user/userinfo/userinfo.wxml new file mode 100644 index 0000000..8e92f9a --- /dev/null +++ b/packageG/pages/user/userinfo/userinfo.wxml @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + {{user.nickname}} + + + + + + + + + + {{gradename}} + + + + + + + + {{pulscardname}} + + + + + + + + + + + + 我的二维码 + + + + + + + + 卡号 + {{user.erpvipno}} + + + + 是否启用消费密码 + + + + + + + + + 启用密码消费 + + + + + + + 消费密码 + + + + + + + + + + + + + + + + + + + + + 性别 + + + + + + + + + + + + + + + + + + + + + + +{{reg_info.sex}}积分 + +{{reg_info.sex}}成长值 + + + + + + + + 出生日期 + + + + + + + + + + + + + + + + + + + 农历 + + + + + + + {{datet?datet:"请选择时间"}} + + + + {{datet==""? user.birthday==""?"":filters.replace_time2(user.birthday):datet}} + + + + +{{reg_info.birthday}}积分 + +{{reg_info.birthday}}成长值 + + + + + + + + + 姓名 + + + + +{{reg_info.name}}积分 + +{{reg_info.name}}成长值 + + + + + + 身份证 + + + + +{{reg_info.idcard}}积分 + +{{reg_info.idcard}}成长值 + + + + + + 更换手机 + + {{phone}} + + + + + + 地址 + + + + + +{{reg_info.address}}积分 + +{{reg_info.address}}成长值 + + + + + + + + 所属门店 + + {{stoname}} + + + + +{{reg_info.pick}}积分 + +{{reg_info.pick}}成长值 + + + + + + + + + {{guide_title}} + + {{user.staffName?user.staffName:"*选择顾问"}} + + + + + + {{guide_title}}电话 + + {{user.staffTel}} + + + + + + + + + + + + + + 我的兴趣 + + + + + + + {{label}} + + + + + + + 标签 + + + + + + + + 收货地址 + + + + + + + 绑定时间 + {{user.reg_time?filters.replace_time2(user.reg_time):""}} + + + + + + + 确认修改 + + + + + + + + + + + + + + {{choice_sort_store==0?'附近的门店':region_name}} + + + + + + {{choice_sort_store==0?'更多门店':'返回'}} + + + + + + + + + + + + + + + Г + + + + + + + + {{item.pickup_name}} + + + + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}} + + + 地址:{{item.fulladdress}} + + + + + + + + + + Г + + + + + + + + + {{item.pickup_name}} + + + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}} + + + + 地址:{{item.fulladdress}} + + + + + + + + + + + + Г + + + + + + + + + {{item.pickup_name}} + + + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}} + + + 地址:{{item.fulladdress}} + + + + + + + + + + + 确定 + + + + + + + + + + 门店分类选择 + + + + + + + + + + + {{item.name}} + + + + + + + + + + + + \ No newline at end of file diff --git a/packageG/pages/user/userinfo/userinfo.wxss b/packageG/pages/user/userinfo/userinfo.wxss new file mode 100644 index 0000000..8d60f47 --- /dev/null +++ b/packageG/pages/user/userinfo/userinfo.wxss @@ -0,0 +1,668 @@ +.container { + padding-bottom: 165rpx; + transform: translate(); +} + +.user-container { + font-size: 30rpx; +} + +input { + width: 450rpx; +} + +.head { + height: 220rpx; + border-bottom: 6rpx solid rgb(245, 245, 245); + border-top: 2rpx solid rgb(245, 245, 245); + background-size: 100%; +} + +.angle { + transform: rotate(225deg); + font-size: 24rpx; + margin-top: 2rpx; + color: rgb(153, 153, 153); +} + +.Headportrait { + width: 145rpx; + height: 145rpx; + border-radius: 50%; + margin-left: 40rpx; +} + +.vip { + margin-top: 30rpx; + color: rgb(255, 255, 255); +} + +.AncrownMax { + background-color: rgb(57, 57, 57); + height: 36rpx; + border-radius: 20rpx; + margin-right: 20rpx; + line-height: 36rpx; + padding-right: 14rpx; + padding-left: 10rpx; +} + +.Nickname { + max-width: 375rpx; +} + +.Ancrown { + width: 30rpx; + height: 30rpx; + margin-right: 5rpx; +} + +.plusMax { + background-color: rgb(212, 58, 30); + height: 36rpx; + border-radius: 20rpx; + line-height: 36rpx; + padding-left: 10rpx; + padding-right: 14rpx; +} + +.fuls { + width: 25rpx; + height: 25rpx; + margin-right: 5rpx; +} + +.Bbottom { + border-bottom: 6rpx solid rgb(245, 245, 245); +} + +.Mleft { + margin-left: 8rpx; +} + +.Birth { + width: 500rpx; +} + +.Gendercheck { + width: 90rpx; + height: 35rpx; + border: 2rpx solid rgb(212, 2, 31); + color: rgb(212, 2, 31); + border-radius: 20rpx; + margin-left: 15rpx; +} + +.Gender { + width: 90rpx; + height: 35rpx; + border: 2rpx solid rgb(153, 153, 153); + color: rgb(153, 153, 153); + border-radius: 20rpx; + margin-left: 15rpx; +} + +.GenderImage { + width: 25rpx; + height: 25rpx; + margin-right: 10rpx; +} + +.confirm { + width: 100%; + position: fixed; + left: 0rpx; + bottom: 0rpx; + height: 130rpx; + background-color: rgb(255, 255, 255); + z-index: 9; + border-top: 1rpx solid #ddd; +} + +.confirmtext { + width: 495rpx; + height: 65rpx; + color: rgb(255, 255, 255); + background-color: rgb(214, 1, 33); + border-radius: 35rpx; +} + +.cmleft { + margin-left: 45rpx; +} + +.hion { + width: 300rpx; + text-align: right; + margin-top: 3rpx; + margin-right: 5rpx; +} + +.eye { + width: 50rpx; + height: 50rpx; +} + +.user-head { + height: 95rpx; + background-color: white; + margin: 0rpx 20rpx; + border-bottom: 2rpx solid rgb(245, 245, 245); + padding: 0rpx 20rpx; + padding-top: 20rpx; +} + +.user_headimg { + height: 140rpx; + width: 140rpx; + border-radius: 70rpx; +} + +.user-name { + height: 95rpx; + margin-top: 2rpx; + background-color: white; + margin: 0rpx 20rpx; + border-bottom: 2rpx solid rgb(245, 245, 245); + padding: 0rpx 20rpx; +} + +.user-name.mt { + margin-top: 20rpx; +} + +.address { + max-width: 300rpx; +} + +.Receiving_goods { + width: 330rpx; +} + +.user-change { + width: 100%; + height: 100rpx; + margin-top: 20rpx; + background-color: white; +} + +.one-line { + white-space: nowrap; + word-break: keep-all; + overflow: hidden; +} + +/*---弹出层---*/ + +.modal-box { + position: fixed; + width: 100%; + height: 100%; + top: 0px; + background: rgba(0, 0, 0, 0.4); + overflow: hidden; +} + +.modal-body { + position: fixed; + top: 80rpx; + left: 0; + z-index: 100; + background: #fff; + margin-left: 73rpx; + width: 600rpx; + height: 860rpx; + border-radius: 8px; + text-align: center; +} + +.modal-content { + width: 480rpx; + margin: 0 auto; + margin-top: 60rpx; + overflow: hidden; +} + +.modal-content .hd_img { + width: 170rpx; + height: 170rpx; + border-radius: 5px; +} + +.ctent_txt { + margin-left: 30rpx; + text-align: left; +} + +.txt1 { + font-size: 34rpx; + font-weight: bold; +} + +.txt2 { + font-size: 30rpx; + color: #999; + margin-top: 20rpx; +} + +.arrow-right { + width: 35rpx; + height: 35rpx; + margin-left: 10rpx; + position: relative; + top: 5rpx; +} + +.code { + margin-bottom: 10rpx; +} + +.user-txt-right { + color: rgb(153, 153, 153); + font-size: 28rpx; +} + +.user-txt { + font-size: 32rpx; +} + +.m_ta { + margin-top: 50rpx; +} + +.g_img { + width: 480rpx; + height: 480rpx; +} + +.s_sao { + font-size: 27rpx; + margin-top: 25rpx; +} + +.order-ico1 { + width: 80rpx; + height: 46rpx; + margin-left: 40rpx; + margin-right: 20rpx; + color: rgba(0, 0, 0, 0.4); +} + +.f_btn { + font-size: 24rpx; + padding: 0 12rpx; + margin-right: 26rpx; + margin-top: -10rpx; +} + +.order-ico3 { + width: 54rpx; + height: 40rpx; + margin-left: 40rpx; + margin-right: 20rpx; +} + +.wh1001 { + width: 62rpx; + height: 100%; +} + +.wh1002 { + width: 76rpx; + height: 100%; +} + +.order-ico.cla { + width: 32rpx; +} + +.order-ico.cla2 { + width: 42rpx; + margin-left: 34rpx; +} + +.order-ico.cla3 { + width: 40rpx; + margin-left: 36rpx; +} + +/* 日期控件 */ + +.pi { + width: 200rpx; + height: auto; + margin-left: 10rpx; +} + +.vipmax { + margin-left: 20rpx; +} + +/* 门店地址 */ + +.xc-address_frame { + border-top: 1rpx solid #eee; + width: 100%; + height: auto; +} + +.on_height { + height: 90rpx; +} + +.sn_height { + height: 170rpx; +} + +.xc-address_frame .address_frame { + width: 92%; + padding-left: 10rpx; + margin: auto; +} + +.stores-img { + width: 40rpx; + height: 35rpx; + margin-right: 10rpx; +} + +.shop_name { + margin-right: 10rpx; +} + +.address { + width: 87%; + margin-top: 5rpx; + margin-bottom: 5rpx; +} + +.distance { + padding-left: 15rpx; + padding-right: 15rpx; + background: #eee; + border-radius: 20rpx; + margin-right: 5rpx; + color: #999; + height: 38rpx; + line-height: 38rpx; +} + +/* 选择门店的弹窗 */ + +.mongolia-layer { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; + z-index: 11; + background: rgba(0, 0, 0, 0.4); + width: 100%; + height: 91.9%; +} + +.popup-frame { + position: fixed; + bottom: -1rpx; + z-index: 20; + background: white; + width: 100%; + border-radius: 20rpx 20rpx 0 0; +} + +.popup-top { + border-bottom: 1rpx solid #eee; + height: 155rpx; + width: 95%; + margin: auto; + line-height: 155rpx; +} + +.bg_rights { + border-top: 2rpx solid; + border-right: 2rpx solid; + transform: rotate(45deg); + display: inline-block; + width: 15rpx; + height: 15rpx; + border-color: #da0b31; +} + +.modal-closes { + position: absolute; + right: 30rpx; + top: 20rpx; + height: 50rpx; + line-height: 50rpx; +} + +.choose_more { + margin-top: 40rpx; + padding-right: 20rpx; +} + +.choose_mores { + margin-top: 30rpx; + margin-right: 15rpx; +} + +.store-list { + width: 95%; + min-height: 300rpx; + max-height: 610rpx; + overflow-y: scroll; + margin: auto; +} + +.store-list .store_choose { + width: 100%; + height: 120rpx; + line-height: 125rpx; + border-bottom: 1rpx solid #eee; +} + +.store-list .store_choose .store { + width: 100%; + margin: auto; + line-height: 37rpx; + padding-left: 20rpx; +} + +.xc-hook { + width: 33rpx; + height: 33rpx; + transform: rotate(-145deg); + line-height: 37rpx; + text-align: center; +} + +.xc-hooks { + width: 30rpx; + height: 30rpx; + border: 1rpx solid #999; +} + +.address-frame { + width: 93%; + margin-left: 7rpx; +} + +.nearby_store { + margin-left: 17rpx; +} + +.address_name { + margin-right: 10rpx; +} + +.address-val { + height: 38rpx; + line-height: 38rpx; +} + +.store-bottom { + width: 85%; + margin: auto; + height: 90rpx; +} + +.determine { + width: 320rpx; + height: 55rpx; + border-radius: 50rpx; + line-height: 55rpx; +} + +.default { + width: 260rpx; + height: 55rpx; + border: 3rpx solid #c8c8c8; + border-radius: 50rpx; + line-height: 55rpx; +} + +.store-bottom-frame { + width: 95%; + margin: auto; +} + +/* 门店分类列表 */ + +.sort_store_list { + max-height: 700rpx; + overflow: hidden; + overflow-y: scroll; + width: 95%; + margin: auto; +} + +.sort_store_list .sort-store-frame { + width: 100%; + height: 100rpx; + line-height: 100rpx; + border-bottom: 1rpx solid #eee; +} + +.sort_store_list .sort-store-frame .sort-store { + width: 94.5%; + margin: auto; +} + +.black_rights-frame { + width: 50%;; +} + +.black_rights-frame .black_rights { + border-top: 3rpx solid; + border-right: 3rpx solid; + transform: rotate(45deg); + display: inline-block; + width: 20rpx; + height: 20rpx; +} + +.xc-val-money { + height: 80rpx; +} + +.xc-distance-bottom { + margin-bottom: 40rpx; +} + +.xc-distance-top { + margin-top: 10rpx; +} + +.xc-width { + width: 100%; +} + +.right-arrow { + width: 15rpx; + height: 15rpx; + border-top: 2rpx solid #d70026; + border-right: 2rpx solid #d70026; + transform: rotate(45deg); + display: inline-block; + margin-bottom: 3rpx; +} + +.xc-goods-attribute { + border-bottom: 1px solid #eee; + padding-bottom: 15px; + margin-bottom: 40rpx; +} + +.xc-val-fream { + width: 105rpx; +} + +.is_stock { + width: 58%; + height: 70rpx; + border-radius: 55rpx; +} + +.select_store_height { + height: 50rpx; +} + +.butttem5 { + margin-bottom: 5rpx; +} + +.s_btn { + margin-top: 25rpx; +} + +.padding { + padding: 0rpx 20rpx; +} + +.interest { + padding: 0rpx 20rpx; + padding-top: 30rpx; + padding-bottom: 30rpx; +} + +.lables { + display: inline-block; + padding-top: 25rpx; +} + +.lable { + display: inline-block; + height: 44rpx; + line-height: 44rpx; + margin-right: 15rpx; + color: rgb(255, 255, 255); + border: 2rpx solid rgb(255, 138, 160); + background-color: rgb(255, 138, 160); + padding: 0rpx 25rpx; + border-radius: 30rpx; + margin-bottom: 21rpx; + max-width: 195rpx; +} + +.add_lable { + height: 44rpx; + line-height: 44rpx; + color: rgb(189, 189, 189); + border: 2rpx solid rgb(189, 189, 189); + border-radius: 30rpx; + padding: 0rpx 25rpx; +} + +.plus { + font-weight: bold; + margin-right: 8rpx; +} + +.lable_wh { + height: 46rpx; + line-height: 46rpx; +} + +.lb_txt{ + color: red; font-size: 24rpx; +}