From 36f8eae31188615784e2a204ea4b5e8500659c91 Mon Sep 17 00:00:00 2001 From: iceling Date: Fri, 22 Nov 2019 21:35:19 +0800 Subject: [PATCH] 提交评价,历史服务重置,订单列表数据填充 --- pages/user/my_service/appment_main.js | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------- pages/user/my_service/appment_main.wxml | 10 +++++----- pages/user/my_service/beauty_deta.js | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------ pages/user/my_service/beauty_deta.wxml | 19 +++++++++---------- pages/user/my_service/cosmetology_list.js | 2 +- pages/user/my_service/cosmetology_list.wxml | 2 +- pages/user/my_service/hist_service.js | 28 ++++++++++++++++++++-------- pages/user/my_service/hist_service.wxml | 3 ++- pages/user/my_service/i_service.js | 8 ++++---- pages/user/my_service/i_service.wxml | 4 ++-- pages/user/my_service/tment_details.js | 49 ++++++++++++++++++++++++++++++++++--------------- pages/user/my_service/tment_details.wxml | 39 +++++++++++++++++++++------------------ pages/user/my_service/tment_eval.js | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- pages/user/my_service/tment_eval.wxml | 16 ++++++++++------ pages/user/my_service/tment_eval.wxss | 30 ++++++++++++++++++++++-------- pages/user/my_service/tment_order_list.js | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------- pages/user/my_service/tment_order_list.wxml | 26 +++++++++++++------------- pages/user/my_service/tment_order_list.wxss | 2 +- 18 files changed, 500 insertions(+), 242 deletions(-) diff --git a/pages/user/my_service/appment_main.js b/pages/user/my_service/appment_main.js index 72f019c..5637582 100644 --- a/pages/user/my_service/appment_main.js +++ b/pages/user/my_service/appment_main.js @@ -9,10 +9,13 @@ Page({ * 页面的初始数据 */ data: { + inurl: a.url, //接口网址 iurl: a.imghost, //服务器网址 store: 0, //是否显示服务门店列表 beautician: 0, //是否显示美容师列表 beautician_name: "", //选中的美容师名称 + beauticianID: "", //美容师id + bea_index: "", //美容师列表下标 placeholder: "填写备注", //备注为空的placeholder store_list: [], //门店列表 beautician_list: [], //美容师列表 @@ -22,7 +25,7 @@ Page({ pageSize: 8, //页大小 total: 0, ismore: 0, //是否加载完毕 - itemId: "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6", //项目id + itemId: "", //项目id isScroll: true, //scroll-y是否可以滑动 key_word: "", //是否按门店文字查询 is_service_read: 0, //是否调用过门店接口 @@ -30,7 +33,10 @@ Page({ is_success: 0, //是否提交成功 remarks: "", //备注 storageId: "", //线下门店id - url:"/pages/user/my_service/appment_main",//本页面地址路径用于选择时间页面跳转回来 + url: "/pages/user/my_service/appment_main", //本页面地址路径用于选择时间页面跳转回来 + buyType: "", //项目类型 + time: "", //选择预约时间 + tment_count: "", //可预约人数 }, onclickstore: function() { var th = this; @@ -61,51 +67,61 @@ Page({ //提交预约 sub_success: function() { var th = this; - var store = th.data.store_name; //门店 - var bea_name = th.data.beautician_name; //选择的美容师 - // var time = th.data.time; //选择服务的时间 - // //提交预约前的判断 - // if (store == "") { - // getApp().my_warnning("请选择服务门店", 0, th); - // return false; - // } else if (bea_name == "") { - // getApp().my_warnning("请选择美容师", 0, th); - // return false; - // } else if (time == "") { - // getApp().my_warnning("请选择预约时间", 0, th); - // return false; - // } - - // var url = "/api/weshop/marketing/reservation/reservation/insert"; - // getApp().request.post(url, { - // data: { - // projectID: "", - // beauticianID: "", - // buyType: "", - // storeId: a.stoid, - // storageID: "", - // arrangeTime: "", - // userId: d.user_id, - // remark: "", - // states: "" - // } - // }).then(res => { - // if (res.data.code == 0) { - // th.setData({ - // is_success: 1 - // }) - // wx.navigateTo({ - // url: "/pages/user/my_service/tment_details" - // }); - // } else { - // getApp().my_warnning(res.data.msg, 0, th); - // } - // }) - - //测试 - wx.navigateTo({ - url: "/pages/user/my_service/tment_details" - }); + var store = th.data.store_name; //门店名称 + var bea_name = th.data.beautician_name; //美容师名称 + var time = th.data.time; //预约时间 + //提交预约前的判断 + if (store == "") { + getApp().my_warnning("请选择服务门店", 0, th); + return false; + } else if (bea_name == "") { + getApp().my_warnning("请选择美容师", 0, th); + return false; + } else if (time == "") { + getApp().my_warnning("请选择预约时间", 0, th); + return false; + } else { + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 + var projectID = 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 json = { + "projectID": projectID, + "beauticianID": beauticianID, + "buyType": buyType, + "storeId": storeId, + "storageID": storageId, + "arrangeTime": time, + "userId": userId, + "remark": remarks, + "states": 0 + } + var data = JSON.stringify(json); + wx.request({ + url: url, + data: json, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { + if (res.data.code == 0) { + th.setData({ + is_success: 1 + }) + wx.redirectTo({ + url: "/pages/user/my_service/tment_order_list" + }); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + } + }) + } }, goto: function(e) { var th = this; @@ -128,7 +144,10 @@ Page({ return false; } else { th.setData({ - fir_pick_index: index_c + fir_pick_index: index_c, + beautician_name: "", + time: "2019-12-10 18:00:00", + tment_count: "" }) } }, @@ -157,8 +176,7 @@ Page({ //分页查询门店信息 query_store: function() { var th = this; - // var itemId = th.data.itemId;//正式使用项目id - var itemId = "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6"; //测试的项目id + var itemId = th.data.itemId; //正式使用项目id var url = "/api/weshop/marketing/reservation/storage/page"; var key_word = th.data.key_word; getApp().request.promiseGet(url, { @@ -205,11 +223,9 @@ Page({ beautician: 0 }) } - var itemid = "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6"; //测试的项目id - // var itemid = th.data.itemId;//正式使用的项目id - // var storageId = th.data.storageId;//正式使用的线下门店id - var storageId = "FD8EC44A-6474-4BA1-A17C-A87306690E59"; //测试的线下门店id - var url = "/api/weshop/marketing/reservation/staff/page"; + var itemid = th.data.itemId; //正式使用的项目id + var storageId = th.data.storageId; //正式使用的线下门店id + var url = "/api/weshop/marketing/reservation/staff/page"; //接口地址 getApp().request.promiseGet(url, { data: { storeId: a.stoid, @@ -228,10 +244,16 @@ Page({ }, choice_beautician: function(e) { var th = this; - var bea_name = e.currentTarget.dataset.beaname; + 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].Id; th.setData({ beautician_name: bea_name, - beautician: 0 + beautician: 0, + bea_index: bea_index, + beauticianID: BeauticianID, + time: "2019-12-10 19:00:00", + tment_count: "" }) }, @@ -281,14 +303,42 @@ Page({ onLoad: function(options) { var th = this; th.setData({ - itemId: options.itemId + itemId: options.itemId, + buyType: options.BuyType }) }, + //查询剩下可预约人数 + query_more: function() { + var th = this; + var url = "/api/weshop/marketing/reservation/marketing/can/reservation/count"; + var beauticianID = th.data.beauticianID; //美容师id + var projectID = th.data.itemId; //项目id + var seekTime = th.data.time.substring(0, 11); //预约日期 + var storageId = th.data.storageId; //门店id + var storeId = a.stoid; //商家id + getApp().request.promiseGet(url, { + data: { + beauticianID: beauticianID, + projectID: projectID, + seekTime: seekTime, + storageId: storageId, + storeId: storeId + } + }).then(res => { + if (res.data.code == 0) { + var tment_count = res.data.data.CanReservation; + th.setData({ + tment_count: tment_count + }) + } + }) + }, /** * 生命周期函数--监听页面显示 */ onShow: function() { - + var th = this; + th.query_more(); } }) \ No newline at end of file diff --git a/pages/user/my_service/appment_main.wxml b/pages/user/my_service/appment_main.wxml index 68cb162..6ee2307 100644 --- a/pages/user/my_service/appment_main.wxml +++ b/pages/user/my_service/appment_main.wxml @@ -34,7 +34,7 @@ - + {{item.StaffName}} @@ -54,8 +54,8 @@ - - 选择时间 + + {{time==""?'选择时间':time}} @@ -78,8 +78,8 @@ - - 注:剩余可预约人数10人 + + 注:剩余可预约人数{{tment_count}}人 diff --git a/pages/user/my_service/beauty_deta.js b/pages/user/my_service/beauty_deta.js index a5e470b..45220c6 100644 --- a/pages/user/my_service/beauty_deta.js +++ b/pages/user/my_service/beauty_deta.js @@ -10,63 +10,41 @@ Page({ */ data: { iurl: a.imghost, - url:"",//选择选择时间后返回的页面 + url: "", //选择选择时间后返回的页面 defimgurl: "/miniapp/images/yyservice/yyxmdefault.jpg", - seekTime: "2019-11-18", //当前服务预约选择的时间 + seekTime: "", //当前服务预约选择的时间 time_list: [], //可预约时间 name: "", //美容师姓名 comment: "", //美容师评价 + aweeks: [], //七天的预约时间 head_img: "", //美容师头像 time: ["08:00:00", "09:00:00 ", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00"], time_index: 0, //选择预约时间下标 - date: [{ - date_name: "今天", - id: 0, - date_value: "09月10日" - }, { - date_name: "星期四", - id: 1, - date_value: "09月11日" - }, { - date_name: "星期五", - id: 2, - date_value: "09月12日" - }, { - date_name: "星期六", - id: 3, - date_value: "09月13日" - }, { - date_name: "星期天", - id: 4, - date_value: "09月14日" - }, { - date_name: "下礼拜一", - id: 5, - date_value: "09月15日" - }, { - date_name: "下礼拜二", - id: 6, - date_value: "09月16日" - }, ], date_id: 0, //选择日期的id + beautician_id: "", //美容师id + itemId: "", //项目id }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { - var th = this; - th.setData({ - url:options.url - }) + var th = this; + var beautician_id = options.BeauticianID; + th.setData({ + url: options.url, + beautician_id: beautician_id, + itemId: options.itemId + }) th.query_beatea(); - th.query_date(); + th.query_aweek(); + // th.query_date(); }, /** * 生命周期函数--监听页面显示 */ onShow: function() { - + }, //图片失败,默认图片 bind_bnerr1: function(e) { @@ -82,31 +60,30 @@ Page({ check_date: function(e) { var th = this; var id = e.currentTarget.dataset.dateid; + var seekTime = th.data.aweeks[id].time; th.setData({ - date_id: id + date_id: id, + seekTime: seekTime }) + th.query_date(); }, //获取美容师信息 query_beatea: function() { var th = this; - var url = "/api/weshop/marketing/reservation/staff/page"; //接口路径 - var itemId = "08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6", - storageId = "FD8EC44A-6474-4BA1-A17C-A87306690E59"; - + var url = "/api/weshop/marketing/reservation/staff/get"; //接口路径 + var beautician_id = th.data.beautician_id; getApp().request.promiseGet(url, { data: { - itemId: itemId, - storageId: storageId, - storeId: 1, - userId: 5682130 + BeauticianID: beautician_id, + storeId: a.stoid, } }).then(res => { if (res.data.code == 0) { - var data = res.data.data.pageData; + var data = res.data.data; th.setData({ - name: data[0].StaffName, - comment: data[0].Remark1, - head_img: data[0].PhotoUrl + name: data.StaffName, + comment: data.Remark1, + head_img: data.PhotoUrl }) } else { getApp().my_warnning(res.data.msg, 0, th); @@ -130,13 +107,47 @@ Page({ th.setData({ time_index: index }) - } + } + }, + //查询七天预约时间 + query_aweek: function() { + var th = this; + var beautician_id = th.data.beautician_id; //美容师id + var itemId = th.data.itemId; //项目id + var url = "/api/weshop/marketing/reservation/staff/seven/time/list"; //接口地址 + getApp().request.promiseGet(url, { + data: { + BeauticianID: beautician_id, + ProjectID: itemId, + storeId: a.stoid, + } + }).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); + console.log(arr[0].time.length + "1111111111111111111111111" + arr[0].time[0]); + } + th.setData({ + aweeks: arr + }) + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }) + }, query_date: function() { var th = this; + var date_id = th.data.date_id; //日期下标 + var SeekTime = th.data.aweeks[date_id]; var url = "/api/weshop/marketing/reservation/staff/time/list"; - var SeekTime = th.data.seekTime; getApp().request.promiseGet(url, { data: { BeauticianID: "337C11B8-034B-495D-B360-FC2F6CB29394", @@ -147,21 +158,21 @@ Page({ }).then(res => { if (res.data.code == 0) { var data = res.data.data; - var time = th.data.time; //固定时间 - var time_list = []; - for (var i = 0; i < time.length; i++) { - for (var ii = ii; ii < data.length; ii++) { - if (time[i] == data[ii].GroupHour) { - time_list[i] = data[ii].GroupHour; - break; - } else { - time_list[i] = ""; - } - } - } - console.log("1111111111" + time_list.length); + // var date_id = th.data.date_id; //选择日期 + // var time = th.data.aweeks[date_id].val; //固定时间 + // var time_list = []; + // for (var i = 0; i < time.length; i++) { + // for (var ii = ii; ii < data.length; ii++) { + // if (time[i] == data[ii].GroupHour) { + // time_list.push(data[ii].GroupHour); + // continue; + // } else { + // time_list.push(""); + // } + // } + // } th.setData({ - time_list: time_list + time_list: data }) } else { getApp().my_warnning(res.data.msg, 0, th); diff --git a/pages/user/my_service/beauty_deta.wxml b/pages/user/my_service/beauty_deta.wxml index 6084cfe..5cdb322 100644 --- a/pages/user/my_service/beauty_deta.wxml +++ b/pages/user/my_service/beauty_deta.wxml @@ -20,10 +20,10 @@ 服务预约 - + - {{item.date_name}} - {{item.date_value}} + {{item.time}} + @@ -35,12 +35,11 @@ - - - - + + + - {{item}} + {{it.GroupHour}} 约满 @@ -48,9 +47,9 @@ - + - {{item}} + {it.GroupHour}} diff --git a/pages/user/my_service/cosmetology_list.js b/pages/user/my_service/cosmetology_list.js index fc997e0..1a44c70 100644 --- a/pages/user/my_service/cosmetology_list.js +++ b/pages/user/my_service/cosmetology_list.js @@ -34,7 +34,7 @@ Page({ getApp().request.promiseGet(url, { data: { storeId: a.stoid, - userId: 5682130, //5682130 d.user_id + userId: d.user_id, itemId:"08AD49D5-BAFD-4B5E-ABBA-B180EB64EED6", storageId: "FD8EC44A-6474-4BA1-A17C-A87306690E59", page: th.data.curpage, diff --git a/pages/user/my_service/cosmetology_list.wxml b/pages/user/my_service/cosmetology_list.wxml index cf2e68e..374aaf1 100644 --- a/pages/user/my_service/cosmetology_list.wxml +++ b/pages/user/my_service/cosmetology_list.wxml @@ -34,7 +34,7 @@ - + 预约 diff --git a/pages/user/my_service/i_service.js b/pages/user/my_service/i_service.js index 3294328..28f36f9 100644 --- a/pages/user/my_service/i_service.js +++ b/pages/user/my_service/i_service.js @@ -82,8 +82,8 @@ Page({ ismore: ismore, is_service_read: 1, }), wx.stopPullDownRefresh(); //停止下拉刷新 - }else{ - getApp().my_warnning(res.data.msg,0,th); + } else { + getApp().my_warnning(res.data.msg, 0, th); } }) }, @@ -92,7 +92,7 @@ Page({ var th = this; var ind = e.currentTarget.dataset.ind; var item = this.data.service_List[ind]; - var ewm = "^" + th.data.userinfo.erpvipid + "|" + item.ProjectID + "|" + item.BuyType + "|" + item.Validay + "|TY01|"; + var ewm = "^" + th.data.userinfo.erpvipid + "|" + item.ID + "|" + item.BuyType + "|" + item.Validay + "|TY01|"; var tt = th.format_time(1); ewm = ewm + tt; th.data.qr_code_object.val = ewm; @@ -106,7 +106,7 @@ Page({ var _Img = e.target.dataset.img; if (_Img != undefined) { var _errObj = {}; - _errObj[_errImg] = "/miniapp/images/no_cate_def.png"; + _errObj[_errImg] = "/miniapp/images/no_cate_def.png"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; } }, diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml index 8dda735..3321812 100644 --- a/pages/user/my_service/i_service.wxml +++ b/pages/user/my_service/i_service.wxml @@ -8,7 +8,7 @@ - + @@ -49,7 +49,7 @@ 立即使用 - + 预约 diff --git a/pages/user/my_service/tment_details.js b/pages/user/my_service/tment_details.js index f89021f..4753754 100644 --- a/pages/user/my_service/tment_details.js +++ b/pages/user/my_service/tment_details.js @@ -11,6 +11,10 @@ Page({ data: { iurl: a.imghost, tment_details: [], //预约详情 + number:"",//订单号 + arrangeTime:"",//预约年月日 + day:"",//判断是上午还是下午 + }, /** @@ -18,33 +22,48 @@ Page({ */ onLoad: function(options) { var th = this; - var url = "http://localhost:8022/api/weshop/yy_fuwu_meirsxiangq"; - wx.request({ - url: url, - success: function(res) { - if (res.data.code == 0) { - th.setData({ - tment_details:res.data.data - }) - } - } + th.setData({ + number: options.number }) - /* + th.query_bea(); + }, + //查询美容师详情 + query_bea: function() { + var th = this; + var number = th.data.number; var url = "/api/weshop/marketing/reservation/reservation/page"; getApp().request.promiseGet(url, { data: { - storeId: 1, - userId: 5682130 + storeId: a.stoid, + userId: d.user_id, + number: number } }).then(res => { if (res.data.code == 0) { var data = res.data.data.pageData; + var arrangeTime = data[0].ArrangeTime.substring(0,11); + var day = data[0].ArrangeTime.substring(12, 13); + if (day<12){ + day = "上午" + }else{ + day = "下午" + } th.setData({ - tment_details: data + tment_details: data, + arrangeTime: arrangeTime, + day:day }) + + }else{ + getApp().my_warnning(res.data.msg, 0, th); } }) - */ + }, + //跳到首页 + goto: function (e) { + wx.switchTab({ + url: '/pages/index/index/index', + }) }, /** * 生命周期函数--监听页面显示 diff --git a/pages/user/my_service/tment_details.wxml b/pages/user/my_service/tment_details.wxml index d40550c..044af7d 100644 --- a/pages/user/my_service/tment_details.wxml +++ b/pages/user/my_service/tment_details.wxml @@ -1,33 +1,33 @@ - + 预约状态: - 未服务 - 已服务 - 已过期 - 已取消 + 未服务 + 已服务 + 已过期 + 已取消 预约门店: - {{tment_details.store_name}} + {{item.ProjectName}} 预约项目: - {{tment_details.item}} + {{item.StorageName}} 预约时间: - {{tment_details.time}} - {{tment_details.time_interval}} + {{arrangeTime}} + {{day}} @@ -39,7 +39,7 @@ 师: - {{tment_details.Beautician}} + {{item.BeauticianName}} @@ -49,7 +49,7 @@ 人: - {{tment_details.name}} + {{item.VIPName}} @@ -58,7 +58,7 @@ 人: - {{tment_details.phone}} + {{item.MobileTel}} @@ -82,22 +82,25 @@ - - 取消预约 + + 取消预约 - + 我的服务 - + 更改时间 - + 发表评价 - + 重新预约 + + 回到首页 + diff --git a/pages/user/my_service/tment_eval.js b/pages/user/my_service/tment_eval.js index e8161b2..01b1a5a 100644 --- a/pages/user/my_service/tment_eval.js +++ b/pages/user/my_service/tment_eval.js @@ -9,10 +9,16 @@ Page({ * 页面的初始数据 */ data: { + url: a.url, //接口网址 iurl: a.imghost, - stars_index: -1, - labels: [], - sub_evaluate:0 + stars_index: -1, //当前点击的星星下标 + labels: [], //星级标签数组 + sub_evaluate: 0, //是否评价成功 + proposal: "", //用户输入的建议 + proposal_size: 100, //评价意见和建议限定字数 + number: "", //订单单号 + beautician: "", //美容师信息 + fromType: "服务评价", //评价来源 }, //点击星级 check_stars: function(e) { @@ -41,15 +47,13 @@ Page({ }) } }, - //提交评价 - Subs: function() { - var th = this; - th.setData({ - sub_evaluate:1 - }) - wx.navigateTo({ - url: "/pages/user/my_service/tment_order_list" - }); + //输入评价意见和建议 + input_proposal: function(e) { + var th = this; + var value = e.detail.value; + th.setData({ + proposal: value + }) }, //图片失败,默认图片 bind_bnerr1: function(e) { @@ -76,11 +80,90 @@ Page({ [labels]: label_id }) }, + //查询美容师信息 + query_bea: function() { + var th = this; + var url = "/api/weshop/marketing/reservation/reservation/page"; + var number = th.data.number; //订单编号 + getApp().request.promiseGet(url, { + data: { + storeId: a.stoid, + userId: d.user_id, + number: number + } + }).then(res => { + if (res.data.code == 0) { + var data = res.data.data.pageData; + data = data[0].ArrangeTime.substring(0, 11); + th.setData({ + beautician: data[0] + }) + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }) + }, + //提交评价 + evaluate_save: function() { + var th = this; + var stars = th.data.stars_index; //评价星级 + //判断是否评级 + if (stars < 0) { + getApp().my_warnning("请进行评分", 0, th); + return false; + } + var labels = th.data.labels; //星级标签数组 + var evaLabList = []; //用户选择的评价标签 + // 查询评价标签 + for (var i = 0; i < labels.length; i++) { + if (labels[i].check) { + evaLabList.push(labels[i].LabelName); + } + } + var url = th.data.url + "/api/weshop/evaluation/evaluate/save"; + var posNo = th.data.number; //收银单号 + var proposal = th.data.proposal; //用户建议内容 + var fromType = th.data.fromType; //评价来源 + var json = { + "storeId": a.stoid, + "evaLabList": evaLabList, + "fromType": "预约评价", + "posNo": posNo, + "remark": proposal, + "star": stars + 1 + }; + var data = JSON.stringify(json); //转换成json格式 + wx.request({ + url: url, + data: data, + method: 'POST', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { + if (res.data.code == 0) { + th.setData({ + sub_evaluate: 1 + }) + wx.navigateTo({ + url: "/pages/user/my_service/tment_order_list" + }); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + } + }) + + }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { - + var th = this; + th.setData({ + number: options.Number + }) + th.query_bea(); }, /** diff --git a/pages/user/my_service/tment_eval.wxml b/pages/user/my_service/tment_eval.wxml index 164ee4c..8e161a0 100644 --- a/pages/user/my_service/tment_eval.wxml +++ b/pages/user/my_service/tment_eval.wxml @@ -8,19 +8,19 @@ 美容师: - 钱巧玲 + {{beautician.BeauticianName}} 服务项目: - 头部按摩 + {{beautician.ProjectName}} 服务时间: - 2019-09-06 + {{beautician.ArrangeTime}} @@ -31,13 +31,17 @@ - + - + {{item.LabelName}} + @@ -45,7 +49,7 @@ 满意的话请打五星噢,谢谢您的支持! - + 确认提交 diff --git a/pages/user/my_service/tment_eval.wxss b/pages/user/my_service/tment_eval.wxss index 11028fc..d035ec3 100644 --- a/pages/user/my_service/tment_eval.wxss +++ b/pages/user/my_service/tment_eval.wxss @@ -1,5 +1,6 @@ .container { border-top: 7rpx solid rgb(245, 245, 245); + padding-bottom: 100rpx; } .head { @@ -41,9 +42,15 @@ padding: 0rpx 56rpx; } +.proposal { + right: 20rpx; + bottom: 20rpx; + color: rgb(152, 152, 152); +} + textarea { width: 100%; - height: 240rpx; + height: 200rpx; margin-top: 70rpx; border: 2rpx solid rgb(203, 203, 203); border-radius: 13rpx; @@ -55,21 +62,25 @@ textarea { } .labels { - margin-bottom: 35rpx; + margin-bottom: 25rpx; display: inline-block; max-height: 240rxp; + line-height: 50rpx; + padding-left: 15rpx; } .label { - padding: 0rpx 15rpx; + padding: 0rpx 10rpx; height: 48rpx; line-height: 48rpx; border: 2rpx solid rgb(218, 218, 218); color: rgb(152, 152, 152); border-radius: 5rpx; - margin-right: 15rpx; - max-width: 165rpx; + margin-right: 20rpx; + width: 165rpx; display: inline-block; + text-align: center; + margin-bottom: 10rpx; } /* 选择标签的样式 */ @@ -85,14 +96,17 @@ textarea { margin-bottom: 70rpx; } -.Subs{ - background-color: rgb(255,255,255); +.Subs { + background-color: rgb(255, 255, 255); + position: fixed; + width: 100%; + bottom: 40rpx; } .Submission { width: 400rpx; height: 65rpx; - border-radius: 40rpx; + border-radius: 60rpx; background-color: rgb(214, 1, 33); color: rgb(255, 255, 255); } diff --git a/pages/user/my_service/tment_order_list.js b/pages/user/my_service/tment_order_list.js index 14604bf..b9d0b23 100644 --- a/pages/user/my_service/tment_order_list.js +++ b/pages/user/my_service/tment_order_list.js @@ -9,7 +9,8 @@ Page({ * 页面的初始数据 */ data: { - iurl: a.imghost, + url: a.url, //接口网址 + iurl: a.imghost, //图片网址 activeCategoryId: 0, //类别选中下标 defimgurl: "/miniapp/images/yyservice/yyxmdefault.jpg", categories: [{ @@ -26,11 +27,12 @@ Page({ id: 3 }], tm_order_list: [], //我的预约订单列表 - is_service_read: 0, curpage: 1, //当前分页数 pageSize: 10, //页大小 total: 0, ismore: 0, //是否加载完毕 + is_read: 0, //是否加载接口 + states: 4, //4为取消预约 }, /** @@ -48,7 +50,8 @@ Page({ activeCategoryId: id, tm_order_list: [], curpage: 1, - ismore: 0 + ismore: 0, + is_read: 0 }) th.query_orderList(); } else { @@ -80,17 +83,76 @@ Page({ getApp().request.promiseGet(url, { data: { storeId: a.stoid, - userId: 5682130, - state: state_index + userId: d.user_id, + state: state_index, + page: th.data.curpage, + pageSize: th.data.pageSize } }).then(res => { + if (res.data.code == 0) { - var data = res.data.data.pageData; + wx.hideLoading(); + th.data.curpage++; + var arr1 = th.data.tm_order_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({ - tm_order_list: data - }) + tm_order_list: arr3, + total: res.data.data.total, + ismore: ismore, + is_read:1 + }), wx.stopPullDownRefresh(); //停止下拉刷新 { } else { - getApp().my_warnning(res.data.msg, 0, this); //调用失败提示 + th.setData({ + tm_order_list: [], + is_read: 1 + }) + } + }) + + }, + //取消预约 + cancel_tment: function(e) { + var th = this; + var index = e.currentTarget.dataset.index; + var states = th.data.states; + var order_list = th.data.tm_order_list; + var number = order_list[index].Number; + var json = { + "number": number, + "storeId": a.stoid, + "states": 3 + }; + var data = JSON.stringify(json); + var url = th.data.url + "/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); + var id = th.data.activeCategoryId; + if (id == 1) { + order_list.splice(index, 1); + th.setData({ + tm_order_list: order_list + }) + } else { + var start = 'tm_order_list[' + index + '].State'; + th.setData({ + [start]: 3 + }) + } + + } else { + getApp().my_warnning(res.data.msg, 0, th); + } } }) @@ -118,8 +180,8 @@ Page({ */ onReachBottom: function() { var th = this; - if (this.data.total <= th.data.pageSize) return; - if (this.data.ismore) return; + if (th.data.total <= th.data.pageSize) return; + if (th.data.ismore) return; wx.showLoading({ title: '加载中...', diff --git a/pages/user/my_service/tment_order_list.wxml b/pages/user/my_service/tment_order_list.wxml index 55c63fb..8bd0159 100644 --- a/pages/user/my_service/tment_order_list.wxml +++ b/pages/user/my_service/tment_order_list.wxml @@ -18,6 +18,7 @@ 已服务 已过期 已取消 + 订单异常 @@ -36,7 +37,7 @@ 预约项目: - {{item.projectName}} + {{item.ProjectName}} 美容师: @@ -44,11 +45,11 @@ 预约时间: - {{item.ArrangeTime}} + {{item.BillDate}} - + 服务时间: - {{item.BillDate}} + {{item.ArrangeTime}} @@ -57,18 +58,17 @@ - 取消预约 + 取消预约 - 查看详情 + 查看详情 - 更改时间 - 发表评价 - 重新预约 - + 更改时间 + 发表评价 + 重新预约 - + 到底了 @@ -77,9 +77,9 @@ - + - + 暂无预约记录 diff --git a/pages/user/my_service/tment_order_list.wxss b/pages/user/my_service/tment_order_list.wxss index 1d2ed7c..524e9f9 100644 --- a/pages/user/my_service/tment_order_list.wxss +++ b/pages/user/my_service/tment_order_list.wxss @@ -115,7 +115,7 @@ page { .empty_order image { width: 300rpx; - height: 300rpx; + height: 280rpx; margin-top: 202rpx; } -- libgit2 0.21.4