diff --git a/pages/user/my_service/appment_main.js b/pages/user/my_service/appment_main.js
index 14dd47e..8ac5f77 100644
--- a/pages/user/my_service/appment_main.js
+++ b/pages/user/my_service/appment_main.js
@@ -47,23 +47,6 @@ Page({
},
//控制备注输入
check_text: function() {
- wx.requestSubscribeMessage({
- tmplIds: ['Jg7Tj-wPlDfsairz_EHBQdoQnzLLF4nVhT1weCBEmTE'],
- success(res) {
- console.log("222222222222222222222222222222");
- },
-
- fail(res) {
-
- console.log('fail 失败')
-
- console.log(res)
-
- logger.warn('订阅消息fail', res)
-
- }
- })
-
var th = this;
var is_textea = th.data.is_textea;
th.setData({
@@ -77,11 +60,13 @@ Page({
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({
@@ -101,124 +86,141 @@ Page({
//提交成功及发送模版代码
success: function() {
var th = this;
- th.setData({
- is_textea: 0
+ 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; //是否重复提交
+ wx.showLoading({
+ title: '加载中',
})
+ 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.settime();
return false;
} else if (bea_name == "") {
getApp().my_warnning("请选择美容师", 0, th);
+ th.settime();
return false;
} else if (time == "") {
getApp().my_warnning("请选择预约时间", 0, th);
+ th.settime();
return false;
- } else {
- if (is_sub == 0) {
- th.setData({
- is_sub: 1
- })
- 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,
- "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
- })
- 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
- }, {
- "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.setData({
- is_sub: 0
- })
- }
- }
- })
- }
- }
- },
- //提交预约
- sub_success: function(e) {
- var th = this;
- var temp_url = "/api/wx/weappSendlist/page";
- var template_id = "";
+ }else{
//获取模版id
getApp().request.promiseGet(temp_url, {
data: {
@@ -226,7 +228,7 @@ Page({
typeid: "1011"
}
}).then(res => {
- if (res.data.code == 0) {
+ if (res.data.code == 0 && res.data.data.pageData.length > 0) {
template_id = res.data.data.pageData[0].template_id;
// //授权订阅
wx.requestSubscribeMessage({
@@ -238,11 +240,11 @@ Page({
th.success();
}
})
- }else{
+ } else {
th.success();
}
})
-
+ }
},
goto: function(e) {
var th = this;
@@ -252,9 +254,14 @@ Page({
})
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);
}
@@ -285,7 +292,8 @@ Page({
th.setData({
store: 0,
store_name: store_name,
- storageId: Id
+ storageId: Id,
+ is_textea: 1
})
},
onReachBottom: function() {
@@ -340,6 +348,7 @@ Page({
}
} else {
getApp().my_warnning(res.data.msg, 0, th);
+ th.settime();
}
})
},
@@ -351,6 +360,7 @@ Page({
})
if (th.data.store_name == "") {
getApp().my_warnning("请选择服务门店", 0, th);
+ th.settime();
} else {
wx.showLoading({
title: '加载中',
@@ -373,6 +383,7 @@ Page({
})
if (res.data.data.pageData.length < 1) {
getApp().my_warnning("暂无美容师", 0, th);
+ th.settime();
} else {
if (th.data.beautician == 0) {
th.setData({
@@ -385,7 +396,8 @@ Page({
}
}
} else {
- getApp().my_warnning("暂无美容师", 0, th);
+ getApp().my_warnning(res.data.msg, 0, th);
+ th.settime();
}
})
}
@@ -402,7 +414,7 @@ Page({
beauticianID: BeauticianID,
time: "",
tment_count: "",
- is_textea: 0
+ is_textea: 1
})
},
@@ -431,7 +443,6 @@ Page({
nav_bea: function() {
var th = this;
th.setData({
- is_textea: 0,
beautician: 0
})
var storageId = th.data.storageId; //线下门店id
@@ -439,10 +450,15 @@ Page({
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: "/pages/user/my_service/cosmetology_list?" + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id
});
+
}
},
/**
@@ -473,6 +489,7 @@ Page({
});
if (th.data.is_gps == 0) {
getApp().confirmBox("请开启GPS定位", null, 25000, !1);
+ th.settime();
}
} else {
th.setData({
@@ -509,6 +526,7 @@ Page({
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
+ th.settime();
}
})
@@ -522,6 +540,10 @@ Page({
if (seekTime != "") {
th.query_more();
}
+ th.setData({
+ time: th.data.time.substring(0, 16),
+ is_textea: 1
+ })
th.query_project();
},
//获取单个服务项目信息
@@ -542,6 +564,7 @@ Page({
})
} else {
getApp().my_warnning(res.data.msg, 0, th);
+ th.settime();
}
})
},
diff --git a/pages/user/my_service/appment_main.wxml b/pages/user/my_service/appment_main.wxml
index 9621fce..e405f80 100644
--- a/pages/user/my_service/appment_main.wxml
+++ b/pages/user/my_service/appment_main.wxml
@@ -69,12 +69,12 @@
注
-
+
- {{remarks==''?'填写备注':remarks}}
+
diff --git a/pages/user/my_service/hist_service.wxml b/pages/user/my_service/hist_service.wxml
index 5d290d0..2e8cb8e 100644
--- a/pages/user/my_service/hist_service.wxml
+++ b/pages/user/my_service/hist_service.wxml
@@ -39,6 +39,7 @@
+ 未服务
已服务
已过期
已取消
diff --git a/pages/user/my_service/i_service.js b/pages/user/my_service/i_service.js
index 6796f87..54d868b 100644
--- a/pages/user/my_service/i_service.js
+++ b/pages/user/my_service/i_service.js
@@ -86,7 +86,9 @@ Page({
}),
wx.stopPullDownRefresh(); //停止下拉刷新
} else {
- getApp().my_warnning(res.data.msg, 0, th);
+ th.setData({
+ is_service_read: 1
+ })
}
})
},