232 changed files with 8666 additions and 0 deletions
Split View
Diff Options
-
166app.js
-
51app.json
-
13app.wxss
-
BINimages/addr.png
-
BINimages/address.png
-
BINimages/agreement.png
-
BINimages/banner1.png
-
BINimages/banner2.png
-
BINimages/index_gray.png
-
BINimages/index_green.png
-
BINimages/inner-back.png
-
BINimages/my_gray.png
-
BINimages/my_green.png
-
BINimages/order.png
-
BINimages/order_gray.png
-
BINimages/order_green.png
-
BINimages/phone.png
-
BINimages/service.png
-
BINimages/title-icon.png
-
BINimages/two_code.jpg
-
1libs/bmap-wx.min.js
-
239pages/addr/addr.js
-
3pages/addr/addr.json
-
18pages/addr/addr.wxml
-
94pages/addr/addr.wxss
-
38pages/agreement/agreement.js
-
3pages/agreement/agreement.json
-
3pages/agreement/agreement.wxml
-
4pages/agreement/agreement.wxss
-
224pages/create_order/create_order.js
-
3pages/create_order/create_order.json
-
54pages/create_order/create_order.wxml
-
162pages/create_order/create_order.wxss
-
169pages/detail/detail.js
-
3pages/detail/detail.json
-
57pages/detail/detail.wxml
-
176pages/detail/detail.wxss
-
123pages/index/index.js
-
44pages/index/index.wxml
-
169pages/index/index.wxss
-
160pages/jz/jz.js
-
5pages/jz/jz.json
-
62pages/jz/jz.wxml
-
120pages/jz/jz.wxss
-
230pages/login/login.js
-
3pages/login/login.json
-
23pages/login/login.wxml
-
90pages/login/login.wxss
-
15pages/logs/logs.js
-
3pages/logs/logs.json
-
6pages/logs/logs.wxml
-
8pages/logs/logs.wxss
-
118pages/mcenter/mcenter.js
-
3pages/mcenter/mcenter.json
-
25pages/mcenter/mcenter.wxml
-
68pages/mcenter/mcenter.wxss
-
56pages/message/message.js
-
3pages/message/message.json
-
36pages/message/message.wxml
-
128pages/message/message.wxss
-
66pages/mypage/mypage.js
-
1pages/mypage/mypage.json
-
2pages/mypage/mypage.wxml
-
1pages/mypage/mypage.wxss
-
270pages/order/order.js
-
5pages/order/order.json
-
50pages/order/order.wxml
-
123pages/order/order.wxss
-
37pages/out/out.js
-
1pages/out/out.json
-
1pages/out/out.wxml
-
1pages/out/out.wxss
-
101pages/pay/pay.js
-
3pages/pay/pay.json
-
9pages/pay/pay.wxml
-
56pages/pay/pay.wxss
-
69pages/remark/remark.js
-
3pages/remark/remark.json
-
5pages/remark/remark.wxml
-
40pages/remark/remark.wxss
-
98pages/serviceDesc/serviceDesc.js
-
3pages/serviceDesc/serviceDesc.json
-
8pages/serviceDesc/serviceDesc.wxml
-
22pages/serviceDesc/serviceDesc.wxss
-
68pages/two_code/two_code.js
-
3pages/two_code/two_code.json
-
5pages/two_code/two_code.wxml
-
18pages/two_code/two_code.wxss
-
32project.config.json
-
19utils/util.js
-
BINwxParse/emojis/00.gif
-
BINwxParse/emojis/01.gif
-
BINwxParse/emojis/02.gif
-
BINwxParse/emojis/03.gif
-
BINwxParse/emojis/04.gif
-
BINwxParse/emojis/05.gif
-
BINwxParse/emojis/06.gif
-
BINwxParse/emojis/07.gif
-
BINwxParse/emojis/08.gif
-
BINwxParse/emojis/09.gif
@ -0,0 +1,166 @@ |
|||
//app.js
|
|||
App({ |
|||
gw: { |
|||
hostUrl: 'https://www.1haojiazheng.cn', |
|||
mapUrl:'https://api.map.baidu.com' |
|||
}, |
|||
onLaunch: function () { |
|||
// 展示本地存储能力
|
|||
var logs = wx.getStorageSync('logs') || [] |
|||
logs.unshift(Date.now()) |
|||
wx.setStorageSync('logs', logs) |
|||
|
|||
// 登录
|
|||
wx.login({ |
|||
success: res => { |
|||
var code = res.code; |
|||
this.getSessionKey(code); |
|||
|
|||
} |
|||
}) |
|||
|
|||
|
|||
}, |
|||
getSessionKey: function (code) { |
|||
var that = this; |
|||
wx.request({ |
|||
url: this.gw.hostUrl + '/mall/wxa/auth/session', |
|||
method: 'post', |
|||
data: { |
|||
code: code, |
|||
state: '5' |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded' |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
var data = res.data; |
|||
if (data.code != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
return false; |
|||
} |
|||
|
|||
// that.globalData.userInfo['sessionId'] = data.response.session_key;
|
|||
that.globalData.openid = data.response.openid; |
|||
that.onLoginUser(); |
|||
|
|||
// that.prepareOrder();
|
|||
// 获取用户信息
|
|||
wx.getSetting({ |
|||
success: res => { |
|||
// if (res.authSetting['scope.userInfo']) {
|
|||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
// 可以将 res 发送给后台解码出 unionId
|
|||
that.globalData.userInfo = res.userInfo; |
|||
|
|||
|
|||
// this.onLoginUser();
|
|||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|||
that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv); |
|||
|
|||
|
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
if (that.userInfoReadyCallback) { |
|||
that.userInfoReadyCallback(res) |
|||
} |
|||
} |
|||
}) |
|||
// }
|
|||
} |
|||
}) |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:getsessionkeys', |
|||
icon:'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
}, |
|||
onLoginUser: function () { |
|||
var that = this; |
|||
wx.request({ |
|||
url: this.gw.hostUrl + '/mall/wxa/auth/login', |
|||
method: 'post', |
|||
data: { |
|||
openid: this.globalData.openid |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded' |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return false; |
|||
} |
|||
that.globalData.sessionId= data.response.sessionId; |
|||
wx.setStorageSync('sessionId', data.response.sessionId); |
|||
console.log('sessionId : ' + data.response.sessionId); |
|||
|
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
}, |
|||
commitUserInfo: function (openid, encryptedData, iv) { |
|||
var that = this; |
|||
wx.request({ |
|||
url: this.gw.hostUrl + '/mall/wxa/auth/userinfo', |
|||
method: 'POST', |
|||
data: { |
|||
openid: openid, |
|||
encryptedData: encryptedData, |
|||
iv: iv |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return false; |
|||
} |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
}, |
|||
globalData: { |
|||
userInfo: null, |
|||
sessionId: '', |
|||
openid: '' |
|||
} |
|||
}) |
|||
@ -0,0 +1,51 @@ |
|||
{ |
|||
"pages": [ |
|||
"pages/jz/jz", |
|||
"pages/index/index", |
|||
"pages/logs/logs", |
|||
"pages/detail/detail", |
|||
"pages/create_order/create_order", |
|||
"pages/mcenter/mcenter", |
|||
"pages/order/order", |
|||
"pages/pay/pay", |
|||
"pages/mypage/mypage", |
|||
"pages/remark/remark", |
|||
"pages/addr/addr", |
|||
"pages/login/login", |
|||
"pages/serviceDesc/serviceDesc", |
|||
"pages/two_code/two_code", |
|||
"pages/out/out", |
|||
"pages/agreement/agreement" |
|||
], |
|||
"window": { |
|||
"backgroundTextStyle": "light", |
|||
"navigationBarBackgroundColor": "#000", |
|||
"navigationBarTitleText": "白飞飞", |
|||
"navigationBarTextStyle": "white" |
|||
}, |
|||
"tabBar": { |
|||
"color": "#65646b", |
|||
"borderStyle": "#65646b", |
|||
"selectedColor": "#06c1ae", |
|||
"list": [ |
|||
{ |
|||
"pagePath": "pages/jz/jz", |
|||
"text": "首页", |
|||
"iconPath": "images/index_gray.png", |
|||
"selectedIconPath": "images/index_green.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/order/order", |
|||
"text": "订单", |
|||
"iconPath": "images/order_gray.png", |
|||
"selectedIconPath": "images/order_green.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/mcenter/mcenter", |
|||
"text": "我的", |
|||
"iconPath": "images/my_gray.png", |
|||
"selectedIconPath": "images/my_green.png" |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
/**app.wxss**/ |
|||
.container { |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
padding: 200rpx 0; |
|||
box-sizing: border-box; |
|||
} |
|||
page{ |
|||
background: #F3F3F3; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
"use strict";function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),BMapWX=function(){function t(a){_classCallCheck(this,t),this.ak=a.ak}return _createClass(t,[{key:"getWXLocation",value:function(t,a,e,i){t=t||"gcj02",a=a||function(){},e=e||function(){},i=i||function(){},wx.getLocation({type:t,success:a,fail:e,complete:i})}},{key:"search",value:function(t){var a=this;t=t||{};var e={query:t.query||"生活服务$美食&酒店",scope:t.scope||1,filter:t.filter||"",coord_type:t.coord_type||2,page_size:t.page_size||10,page_num:t.page_num||0,output:t.output||"json",ak:a.ak,sn:t.sn||"",timestamp:t.timestamp||"",radius:t.radius||2e3,ret_coordtype:"gcj02ll"},i={iconPath:t.iconPath,iconTapPath:t.iconTapPath,width:t.width,height:t.height,alpha:t.alpha||1,success:t.success||function(){},fail:t.fail||function(){}},n="gcj02",o=function(t){e.location=t.latitude+","+t.longitude,wx.request({url:"https://api.map.baidu.com/place/v2/search",data:e,header:{"content-type":"application/json"},method:"GET",success:function(t){var a=t.data;if(0===a.status){var e=a.results,n={};n.originalData=a,n.wxMarkerData=[];for(var o=0;o<e.length;o++)n.wxMarkerData[o]={id:o,latitude:e[o].location.lat,longitude:e[o].location.lng,title:e[o].name,iconPath:i.iconPath,iconTapPath:i.iconTapPath,address:e[o].address,telephone:e[o].telephone,alpha:i.alpha,width:i.width,height:i.height};i.success(n)}else i.fail({errMsg:a.message,statusCode:a.status})},fail:function(t){i.fail(t)}})},s=function(t){i.fail(t)},c=function(){};if(t.location){var u=t.location.split(",")[1],r=t.location.split(",")[0],l="input location",p={errMsg:l,latitude:r,longitude:u};o(p)}else a.getWXLocation(n,o,s,c)}},{key:"suggestion",value:function(t){var a=this;t=t||{};var e={query:t.query||"",region:t.region||"全国",city_limit:t.city_limit||!1,output:t.output||"json",ak:a.ak,sn:t.sn||"",timestamp:t.timestamp||"",ret_coordtype:"gcj02ll"},i={success:t.success||function(){},fail:t.fail||function(){}};wx.request({url:"https://api.map.baidu.com/place/v2/suggestion",data:e,header:{"content-type":"application/json"},method:"GET",success:function(t){var a=t.data;0===a.status?i.success(a):i.fail({errMsg:a.message,statusCode:a.status})},fail:function(t){i.fail(t)}})}},{key:"regeocoding",value:function(t){var a=this;t=t||{};var e={coordtype:t.coordtype||"gcj02ll",pois:t.pois||0,output:t.output||"json",ak:a.ak,sn:t.sn||"",timestamp:t.timestamp||"",ret_coordtype:"gcj02ll"},i={iconPath:t.iconPath,iconTapPath:t.iconTapPath,width:t.width,height:t.height,alpha:t.alpha||1,success:t.success||function(){},fail:t.fail||function(){}},n="gcj02",o=function(t){e.location=t.latitude+","+t.longitude,wx.request({url:"https://api.map.baidu.com/geocoder/v2/",data:e,header:{"content-type":"application/json"},method:"GET",success:function(a){var e=a.data;if(0===e.status){var n=e.result,o={};o.originalData=e,o.wxMarkerData=[],o.wxMarkerData[0]={id:0,latitude:t.latitude,longitude:t.longitude,address:n.formatted_address,iconPath:i.iconPath,iconTapPath:i.iconTapPath,desc:n.sematic_description,business:n.business,alpha:i.alpha,width:i.width,height:i.height},i.success(o)}else i.fail({errMsg:e.message,statusCode:e.status})},fail:function(t){i.fail(t)}})},s=function(t){i.fail(t)},c=function(){};if(t.location){var u=t.location.split(",")[1],r=t.location.split(",")[0],l="input location",p={errMsg:l,latitude:r,longitude:u};o(p)}else a.getWXLocation(n,o,s,c)}},{key:"weather",value:function(t){var a=this;t=t||{};var e={coord_type:t.coord_type||"gcj02",output:t.output||"json",ak:a.ak,sn:t.sn||"",timestamp:t.timestamp||""},i={success:t.success||function(){},fail:t.fail||function(){}},n="gcj02",o=function(t){e.location=t.longitude+","+t.latitude,wx.request({url:"https://api.map.baidu.com/telematics/v3/weather",data:e,header:{"content-type":"application/json"},method:"GET",success:function(t){var a=t.data;if(0===a.error&&"success"===a.status){var e=a.results,n={};n.originalData=a,n.currentWeather=[],n.currentWeather[0]={currentCity:e[0].currentCity,pm25:e[0].pm25,date:e[0].weather_data[0].date,temperature:e[0].weather_data[0].temperature,weatherDesc:e[0].weather_data[0].weather,wind:e[0].weather_data[0].wind},i.success(n)}else i.fail({errMsg:a.message,statusCode:a.status})},fail:function(t){i.fail(t)}})},s=function(t){i.fail(t)},c=function(){};if(t.location){var u=t.location.split(",")[0],r=t.location.split(",")[1],l="input location",p={errMsg:l,latitude:r,longitude:u};o(p)}else a.getWXLocation(n,o,s,c)}}]),t}();module.exports.BMapWX=BMapWX; |
|||
@ -0,0 +1,239 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
var bmap = require('../../libs/bmap-wx.min.js'); |
|||
Page({ |
|||
data: { |
|||
sugData: '', |
|||
items: [ |
|||
{ top: 58, title: '联系人', note:'您的姓名', page: 'Name' ,box:'',typeFlag:'text'}, |
|||
{ top: 1, title: '手机号码', note: '请填写手机号码', page: 'Mobile', box: '', typeFlag: 'number'}, |
|||
{ top: 1, title: '服务地址', note: '搜索您的小区/大厦/学校', page: 'Area', box: 'show', typeFlag: 'text'}, |
|||
{ top: 1, title: '详细地址', note: '填写街道门牌信息', page: 'Address', box: '', typeFlag: 'text'}, |
|||
{ top: 1, title: '服务面积', note: '选择您的服务面积', page: 'ServiceArea', box: '', typeFlag: 'text'} |
|||
], |
|||
addrItems:[], |
|||
img: '../../images/addr.png', |
|||
area:'', |
|||
name:'', |
|||
mobile:'', |
|||
addr:'', |
|||
serviceArea:'', |
|||
show:false |
|||
}, |
|||
// 绑定input输入
|
|||
inputArea: function (e) { |
|||
var that = this; |
|||
// 新建百度地图对象
|
|||
var BMap = new bmap.BMapWX({ |
|||
ak: '7nj5S5ZHqOaqcwom3m6zh1bWagseiSXD' |
|||
}); |
|||
var fail = function (data) { |
|||
console.log(data) |
|||
}; |
|||
var success = function (data) { |
|||
// var sugData = '';
|
|||
let addr=[]; |
|||
for (var i = 0; i < data.result.length; i++) { |
|||
// sugData = sugData + data.result[i].name + '\n';
|
|||
addr[i] = data.result[i].name; |
|||
} |
|||
// that.setData({
|
|||
// sugData: sugData
|
|||
// });
|
|||
that.setData({ |
|||
addrItems: addr, |
|||
show: true, |
|||
area: e.detail.value |
|||
}); |
|||
console.log(that.data.addrItems); |
|||
} |
|||
// 发起suggestion检索请求
|
|||
BMap.suggestion({ |
|||
query: e.detail.value, |
|||
region: '广州', |
|||
city_limit: true, |
|||
fail: fail, |
|||
success: success |
|||
}); |
|||
}, |
|||
inputName:function(e){ |
|||
this.setData({ |
|||
name: e.detail.value |
|||
}) |
|||
}, |
|||
inputMobile: function (e) { |
|||
this.setData({ |
|||
mobile: e.detail.value |
|||
}) |
|||
}, |
|||
inputAddr: function (e) { |
|||
this.setData({ |
|||
addr: e.detail.value |
|||
}) |
|||
}, |
|||
chooseAddr:function(e){ |
|||
var that=this; |
|||
let str = e.currentTarget.dataset.item; |
|||
console.log(str); |
|||
that.setData({ |
|||
addrItems:[], |
|||
area:str, |
|||
show:false |
|||
}) |
|||
console.log(that.data.addrItems); |
|||
}, |
|||
showClear: function (e) { |
|||
var that = this; |
|||
console.log(that.data.area); |
|||
if (that.data.area!=''){ |
|||
that.setData({ |
|||
show: true |
|||
}) |
|||
}else{ |
|||
that.setData({ |
|||
show: false |
|||
}) |
|||
} |
|||
}, |
|||
clear: function (e) { |
|||
var that = this; |
|||
that.setData({ |
|||
addrItems: [], |
|||
area:'' |
|||
}) |
|||
}, |
|||
hideAll: function (e) { |
|||
var that = this; |
|||
that.setData({ |
|||
addrItems: [], |
|||
show: false |
|||
}) |
|||
}, |
|||
save: function (e) { |
|||
let that = this; |
|||
let name = this.data.name; |
|||
let mobile = this.data.mobile; |
|||
let area = this.data.area; |
|||
let addr = this.data.addr; |
|||
let serviceArea = this.data.serviceArea; |
|||
let checkName = this.checkForm(name, '姓名','name'); |
|||
console.log(checkName); |
|||
if(checkName !=false){ |
|||
let checkMobile = this.checkForm(mobile, '手机号','mobile'); |
|||
if (checkMobile!=false){ |
|||
let checkArea = this.checkForm(area, '服务地址','area'); |
|||
if (checkArea != false) { |
|||
let checkAddr = this.checkForm(addr, '详细地址','area'); |
|||
if (checkAddr != false) { |
|||
this.checkForm(serviceArea, '服务面积','serviceArea'); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if (this.data.mobile_lock === 0) { |
|||
this.setData({ |
|||
mobile_lock: 1 |
|||
}); |
|||
let that = this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/sms/code', |
|||
data: { mobileNumber: that.data.mobile, codeType: 1, clientType: 10 }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
if (res.data.code == 0) { |
|||
that.setData({ |
|||
mobile_count: 60 |
|||
}); |
|||
wx.showToast({ |
|||
title: '验证码发送成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
that.btnCount(); |
|||
} else { |
|||
that.setData({ |
|||
mobile_lock: 0 |
|||
}); |
|||
that.setData( |
|||
{ popErrorMsg: res.data.msg } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return; |
|||
} |
|||
}, |
|||
fail: function (res) { }, |
|||
complete: function (res) { }, |
|||
}) |
|||
} |
|||
}, |
|||
checkForm: function (sign,title,flag){ |
|||
let that = this; |
|||
if (sign == '') { |
|||
that.setData( |
|||
{ popErrorMsg: title+"不能为空" } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return false; |
|||
}else if(flag=='mobile'){ |
|||
if (!(/^1[345678]\d{9}$/.test(sign))) { |
|||
that.setData( |
|||
{ popErrorMsg: title+"格式错误,请重填" } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return false; |
|||
} |
|||
} |
|||
}, |
|||
ohShitfadeOut() {//错误提示显示3秒后消失,清空计时器
|
|||
var fadeOutTimeout = setTimeout(() => { |
|||
this.setData({ popErrorMsg: '' }); |
|||
clearTimeout(fadeOutTimeout); |
|||
}, 3000); |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = JSON.parse(options.jsonStr); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
price: item.price, |
|||
title: item.name, |
|||
product: item, |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "地址信息" |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<view class="ad_popError" wx:if="{{popErrorMsg}}">{{popErrorMsg}}</view> |
|||
<view wx:for-items="{{items}}"> |
|||
<view class='box top{{item.top}}'> |
|||
<text class='text'>{{item.title}}</text> |
|||
<input class='inputBox' placeholder="{{item.note}}" bindfocus='show{{item.box?"Clear":""}}' bindblur='hide{{item.box?"All":""}}' type="{{item.typeFlag}}" bindinput="input{{item.page}}" value='{{item.page=="Area"?area:""}}'/> |
|||
<text wx:if="{{item.box&&show==true}}" class='text clear' bindtap='clear'>x</text> |
|||
<view wx:if="{{item.box}}" class="sug_info"> |
|||
<view wx:for='{{addrItems}}' class='smallBox' bindtap='chooseAddr' data-item='{{item}}'> |
|||
<image class="icon" src="{{img}}" mode='aspectFit'/> |
|||
<view class='detailAddr'> |
|||
{{item}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<button class='subBtn' bindtap='save'>保存 </button> |
|||
@ -0,0 +1,94 @@ |
|||
/* pages/addr/addr.wxss */ |
|||
.box{ |
|||
height:90rpx; |
|||
background:#fff; |
|||
padding:0 42rpx; |
|||
display:flex; |
|||
flex-direction:row; |
|||
line-height:90px; |
|||
align-items:baseline; |
|||
position: relative; |
|||
} |
|||
.text{ |
|||
height: 90rpx; |
|||
line-height: 90rpx; |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
width: 23%; |
|||
} |
|||
.inputBox{ |
|||
width:72%; |
|||
font-size: 30rpx; |
|||
} |
|||
.top58{ |
|||
margin-top: 58rpx; |
|||
} |
|||
.top1{ |
|||
margin-top: 1rpx; |
|||
} |
|||
.sug_info{ |
|||
position:absolute; |
|||
z-index:1000; |
|||
background:#fff; |
|||
top:90rpx; |
|||
width:100%; |
|||
margin:0px; |
|||
overflow: hidden; |
|||
overflow-y: scroll; |
|||
right:0rpx; |
|||
left:0rpx; |
|||
max-height: 540rpx; |
|||
} |
|||
.detailAddr{ |
|||
font-size:30rpx; |
|||
padding:0 25rpx; |
|||
line-height:90rpx; |
|||
height: 90rpx; |
|||
} |
|||
.icon{ |
|||
width: 50rpx; |
|||
height: 50rpx; |
|||
margin-left:42rpx; |
|||
} |
|||
.smallBox{ |
|||
height:90rpx; |
|||
background:#fff; |
|||
display:flex; |
|||
flex-direction:row; |
|||
line-height:90px; |
|||
align-items:center; |
|||
position: relative; |
|||
border-top: thin solid #eee; |
|||
} |
|||
.subBtn{ |
|||
width: 90%; |
|||
margin: 40rpx auto; |
|||
text-align: center; |
|||
color: #fff; |
|||
background: #1eba84; |
|||
border-radius:5px; |
|||
} |
|||
.ad_popError{ |
|||
background: #de352d; |
|||
color: #fff; |
|||
height: 58rpx; |
|||
line-height: 58rpx; |
|||
font-size: 24rpx; |
|||
text-align: center; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
width: 100%; |
|||
z-index:3; |
|||
} |
|||
.clear{ |
|||
font-size: 24rpx; |
|||
width:30rpx; |
|||
border: 2rpx solid #333; |
|||
border-radius:50%; |
|||
height: 30rpx; |
|||
line-height: 30rpx; |
|||
text-align: center; |
|||
background: #eee; |
|||
color: #333; |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
showImg:'../../images/agreement.png', |
|||
}, |
|||
//事件处理函数
|
|||
onLoad: function (options) { |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "订单确认" |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<view> |
|||
<image src='{{showImg}}' mode='widthFill'></image> |
|||
</view> |
|||
@ -0,0 +1,4 @@ |
|||
image{ |
|||
width: 100%; |
|||
height: 7000rpx; |
|||
} |
|||
@ -0,0 +1,224 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
items: [ |
|||
{ name: '陈晓旭', phone: '18775242654', address1: '广州市 天河区 东圃大马路时代TIT广场A栋423' } |
|||
], |
|||
read: true, |
|||
remark:'', |
|||
clock:300, |
|||
}, |
|||
imageOnload(ev) { |
|||
console.log('图片加载成功,width: ${ev.detail.width}; height: ${ev.detail.height}'); |
|||
}, |
|||
imageOnloadError() { |
|||
console.log('图片加载失败'); |
|||
}, |
|||
formSubmit: function (e) { |
|||
console.log('form发生了submit事件,携带数据为:', e.detail.value) |
|||
}, |
|||
formReset: function () { |
|||
console.log('form发生了reset事件') |
|||
}, |
|||
//事件处理函数
|
|||
loading: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
wx.navigateTo({ |
|||
url: '../detail/detail?jsonStr=' + str |
|||
}) |
|||
}, |
|||
changeAddr: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
wx.navigateTo({ |
|||
url: '../addr/addr?jsonStr=' + str |
|||
}) |
|||
}, |
|||
goRemark: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
wx.navigateTo({ |
|||
url: '../remark/remark?jsonStr=' + str+'&&remark='+this.data.remark |
|||
}) |
|||
}, |
|||
checkboxChange: function (e) { |
|||
this.setData({ |
|||
read: !this.data.read |
|||
}) |
|||
}, |
|||
goLook: function (e) { |
|||
wx.navigateTo({ |
|||
url: '../agreement/agreement' |
|||
}) |
|||
}, |
|||
pay: function (e) { |
|||
// let str = JSON.stringify(e.currentTarget.dataset.item);
|
|||
let str = e.currentTarget.dataset.item; |
|||
console.log(str.goodsNo); |
|||
let that=this; |
|||
wx.showToast({ |
|||
title: '正在调起支付', |
|||
icon: 'loading' |
|||
}) |
|||
wx.request({//获取orderNo
|
|||
url: app.gw.hostUrl + '/mall/wxa/order/new', |
|||
method: 'post', |
|||
data: { |
|||
addressId:'', |
|||
goodsNo:str.goodsNo, |
|||
sourceType: 0, |
|||
goodsNum: 1, |
|||
couponNo: '', |
|||
remark:that.data.remark |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
let data = res.data; |
|||
let status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
return; |
|||
} |
|||
that.setData({ |
|||
orderNo:data.response.orderNo |
|||
}) |
|||
|
|||
wx.request({//获取微信支付想要的数据
|
|||
url: app.gw.hostUrl + '/mall/wxa/order/pay', |
|||
method: 'put', |
|||
data: { |
|||
openid: app.globalData.openid, |
|||
orderNo: data.response.orderNo, |
|||
paymentType: 8 |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
let data = res.data; |
|||
let status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
return; |
|||
} |
|||
console.log(data.response); |
|||
let dr = data.response.weixinTransParameters; |
|||
console.log(dr); |
|||
wx.requestPayment({//微信支付
|
|||
"timeStamp": dr.timeStamp, |
|||
"nonceStr": dr.nonceStr, |
|||
"package": dr.package, |
|||
"signType": dr.signType, |
|||
"paySign": dr.paySign, |
|||
"success": function (res) { |
|||
console.log(res); |
|||
wx.showToast({ |
|||
title: '支付成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
wx.switchTab({//跳转到订单页面
|
|||
url: '../order/order' , |
|||
success: function (e) { |
|||
var page = getCurrentPages().pop(); |
|||
if (page == undefined || page == null) return; |
|||
console.log(page); |
|||
page.onShow(); |
|||
} |
|||
}) |
|||
}, |
|||
"fail": function (res) { |
|||
console.log(res); |
|||
if(res.errMsg=='requestPayment:fail cancel'){ |
|||
wx.showToast({ |
|||
title: '取消支付', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
}else{ |
|||
wx.showToast({ |
|||
title: '支付出错', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
}); |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
}); |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = JSON.parse(options.jsonStr); |
|||
console.log(item); |
|||
this.setData({ |
|||
product: item, |
|||
}) |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
product: item, |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "订单确认" |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
<view wx:for-item='{{product}}'> |
|||
<view class="price-box box"> |
|||
<view class="price-title">订单金额:</view> |
|||
<view class="blank"></view> |
|||
<view class="price">¥{{product.totalPrice/100}}</view> |
|||
</view> |
|||
<view class='person-msg box' data-item='{{product}}'> |
|||
<!-- <view class='msg' wx:for-items="{{items}}"> |
|||
<view class='name'>{{item.name}}</view> |
|||
<view class='phone'>{{item.phone}}</view> |
|||
<view class='changeAddr'>更换地址</view> |
|||
<view class='address'>{{item.address1}}</view> |
|||
</view> --> |
|||
<!-- <view class='msg'> |
|||
<view class='addrText'>添加服务地址</view> |
|||
<view class='addrNote'>还没有服务地址,点击添加服务地址</view> |
|||
</view> --> |
|||
<!-- <view class='icon icon-msg'>></view> --> |
|||
<view class='msg'> |
|||
<view style='font-size:30rpx'>{{product.serviceAreaStr}}</view> |
|||
</view> |
|||
</view> |
|||
<!-- <view class='box'> |
|||
<view class='text'>优惠券/码:</view> |
|||
<view class='icon-note'> |
|||
<view class='note'>未使用</view> |
|||
<view class='icon'>></view> |
|||
</view> |
|||
</view> --> |
|||
<view class='box'> |
|||
<view class='text'>订单备注:</view> |
|||
<view class='icon-note' bindtap='goRemark' data-item='{{product}}'> |
|||
<view class='note'> |
|||
<text>{{remark==""?'选填,可填写服务需求':remark}}</text> |
|||
</view> |
|||
<view class='icon'>></view> |
|||
</view> |
|||
</view> |
|||
<!-- <view class='box'> |
|||
<view class='lookDetail' bindtap='loading' data-item='{{product}}'>查看详情>></view> |
|||
</view> --> |
|||
<checkbox-group bindchange="checkboxChange" class='agreement-box'> |
|||
<checkbox checked='{{read}}'/>我已阅读并确认<view class='agreement' bindtap='goLook'>服务协议</view> |
|||
</checkbox-group> |
|||
<view class='footer box'> |
|||
<view class='pay-box'> |
|||
<view class='pay-text'>还需支付 |
|||
<view class='pay-price'>¥{{product.payPrice/100}}</view> |
|||
</view> |
|||
</view> |
|||
<view class='no-pay' wx:if="{{read==false}}"></view> |
|||
<view class='go-pay' bindtap='pay' data-item='{{product}}'>立即支付</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,162 @@ |
|||
/* 通用class */ |
|||
.box{ |
|||
margin-top: 20rpx; |
|||
background: #fff; |
|||
height: 100rpx; |
|||
line-height: 100rpx; |
|||
display:flex; |
|||
flex-direction:row; |
|||
justify-content:space-between; |
|||
} |
|||
.addrText{ |
|||
flex-direction: row; |
|||
color: #333; |
|||
font-size: 30rpx; |
|||
} |
|||
.addrNote{ |
|||
font-size: 28rpx; |
|||
width: 100%; |
|||
color: #999999; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
} |
|||
.text{ |
|||
flex-direction: row; |
|||
color: #333; |
|||
font-size: 30rpx; |
|||
width: 30%; |
|||
padding-left: 35rpx; |
|||
} |
|||
.icon-note{ |
|||
display:flex; |
|||
flex-direction: row; |
|||
justify-content:space-between; |
|||
margin-right: 35rpx; |
|||
width: 70%; |
|||
} |
|||
.note{ |
|||
margin-right: 10rpx; |
|||
font-size: 28rpx; |
|||
color: #999999; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
width: 90%; |
|||
text-align: right; |
|||
} |
|||
|
|||
/* 单独class */ |
|||
.price-box{ |
|||
margin-top: 10rpx; |
|||
} |
|||
.price-title{ |
|||
flex-direction:row; |
|||
font-size: 30rpx; |
|||
color:#666; |
|||
margin-left: 35rpx; |
|||
} |
|||
.price{ |
|||
flex-direction:row; |
|||
float: right; |
|||
font-size: 38rpx; |
|||
color:#333; |
|||
margin-right: 39rpx; |
|||
} |
|||
.msg{ |
|||
display: inline-block; |
|||
/* width: 75%; */ |
|||
width: 100%; |
|||
padding:20rpx 35rpx 0; |
|||
} |
|||
.person-msg{ |
|||
/* height: 160rpx; */ |
|||
height: 210rpx; |
|||
margin-top: 10rpx; |
|||
line-height: 60rpx; |
|||
} |
|||
.name{ |
|||
display: inline-block; |
|||
color: #333; |
|||
font-size: 36rpx; |
|||
} |
|||
.phone{ |
|||
display: inline-block; |
|||
color: #333; |
|||
font-size: 36rpx; |
|||
margin-left: 35rpx; |
|||
} |
|||
.changeAddr{ |
|||
display: inline-block; |
|||
color:#EE5050; |
|||
font-size: 28rpx; |
|||
margin-left: 35rpx; |
|||
} |
|||
.address{ |
|||
display: inline-block; |
|||
color: #666; |
|||
font-size: 30rpx; |
|||
height: 36rpx; |
|||
line-height: 36rpx; |
|||
width: 100%; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
} |
|||
.icon-msg{ |
|||
height: 160rpx; |
|||
line-height: 160rpx; |
|||
margin-right: 35rpx; |
|||
} |
|||
.agreement-box{ |
|||
margin: 25rpx 35rpx; |
|||
font-size: 28rpx; |
|||
color:#999999; |
|||
} |
|||
.agreement{ |
|||
display: inline-block; |
|||
color: #D61A1A; |
|||
} |
|||
.footer{ |
|||
position: fixed; |
|||
bottom: 0rpx; |
|||
width: 100%; |
|||
font-size:32rpx; |
|||
} |
|||
.pay-box{ |
|||
width: 50%; |
|||
display: inline-block; |
|||
color: #333; |
|||
text-align: center; |
|||
} |
|||
.go-pay{ |
|||
width: 50%; |
|||
display: inline-block; |
|||
background: #E32424; |
|||
color: #fff; |
|||
text-align: center; |
|||
} |
|||
.pay-text{ |
|||
display: inline-block; |
|||
} |
|||
.pay-price{ |
|||
display: inline-block; |
|||
color: #D61A1A; |
|||
font-weight: bold; |
|||
} |
|||
.no-pay{ |
|||
width: 50%; |
|||
float: right; |
|||
position:fixed; |
|||
bottom: 0px; |
|||
right: 0px; |
|||
z-index: 100; |
|||
height: 101rpx; |
|||
background: rgba(255,255,255,0.6); |
|||
} |
|||
.lookDetail{ |
|||
color:#666; |
|||
font-size:16px; |
|||
text-align:center; |
|||
margin:0 auto; |
|||
} |
|||
@ -0,0 +1,169 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
var WxParse = require('../../wxParse/wxParse.js');//主要为了能够显示获取的html代码
|
|||
|
|||
Page({ |
|||
data: { |
|||
items:[ |
|||
{name:'陈晓旭',phone:'18775242654',address1:'广州市 天河区 东圃大马路时代TIT广场A栋423'} |
|||
], |
|||
nowDate: new Date().getTime(), |
|||
serviceImg:'http://jz.qianniao56.com/attachs/editor/2017/08/01/thumb_59802a98d9fdb.png', |
|||
read:true |
|||
}, |
|||
imageOnload(ev) { |
|||
console.log('图片加载成功,width: ${ev.detail.width}; height: ${ev.detail.height}'); |
|||
}, |
|||
imageOnloadError() { |
|||
console.log('图片加载失败'); |
|||
}, |
|||
formSubmit: function (e) { |
|||
console.log('form发生了submit事件,携带数据为:', e.detail.value) |
|||
}, |
|||
formReset: function () { |
|||
console.log('form发生了reset事件') |
|||
}, |
|||
//事件处理函数
|
|||
loading: function (e) { |
|||
let str = e.currentTarget.dataset.item; |
|||
wx.navigateTo({ |
|||
url: '../serviceDesc/serviceDesc?jsonStr=' + str |
|||
}) |
|||
console.log(str); |
|||
}, |
|||
createOrder:function(e){ |
|||
if (wx.getStorageSync('sessionId')==''){ |
|||
wx.navigateTo({ |
|||
url: '../login/login' |
|||
}) |
|||
}else{ |
|||
var that = this; |
|||
var user = app.globalData.userInfo; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/wxa/order/prepare', |
|||
method: 'post', |
|||
data: { |
|||
goodsNo: that.data.product.goodsNo, |
|||
goodsNum: 1, |
|||
couponNo: '' |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
let data = res.data; |
|||
let status = data.code; |
|||
let str = JSON.stringify(data.response); |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
wx.navigateTo({ |
|||
url: '../create_order/create_order?jsonStr=' + str |
|||
}) |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = options.jsonStr; |
|||
var that = this; |
|||
console.log(options.jsonStr); |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/web/goods/detail', |
|||
method: 'get', |
|||
data: { |
|||
goodsNo: item |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded' |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
/** |
|||
* WxParse.wxParse(bindName , type, data, target,imagePadding) |
|||
* 1.bindName绑定的数据名(必填) |
|||
* 2.type可以为html或者md(必填) |
|||
* 3.data为传入的具体数据(必填) |
|||
* 4.target为Page对象,一般为this(必填) |
|||
* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选) |
|||
*/ |
|||
that.setData({ |
|||
product: data.response |
|||
}) |
|||
let notice = data.response.notice; |
|||
let serviceDesc = data.response.serviceDesc; |
|||
console.log(notice); |
|||
WxParse.wxParse('notice', 'html', notice, that); |
|||
WxParse.wxParse('serviceDesc', 'html', serviceDesc, that, 5); |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
goodsNo: item |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "商品详情" |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
<import src="../../wxParse/wxParse.wxml"/> |
|||
|
|||
|
|||
<view wx:for-item="{{product}}"> |
|||
<view class="tuan-detail"> |
|||
<view class="line banner"> |
|||
<view id="focus" class="focus"> |
|||
<view class="hd"> |
|||
<view></view> |
|||
</view> |
|||
<view class="bd"> |
|||
<view class="bd_banner"> |
|||
<view class='bd_banner_img'> |
|||
<image src="{{product.showImg}}" mode="widthFix"></image> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="item-detail"> |
|||
<view class="detail-row bb"> |
|||
<view class="item-price"> |
|||
<view class='pro-title'>{{product.name}}</view> |
|||
<view class="price">¥ {{product.price/100}}/套 |
|||
<!-- <del wx:if='{{product.price<product.originalPrice}}' class="txt_center fontcl1" style="color: #FFDED5;font-size: 14px;margin-left: 10px;position:absolute;margin-top: 3px;">¥{{product.originalPrice}}/套</del> --> |
|||
</view> |
|||
<view class="x12 price-tip"> |
|||
<text class="text-gray text-small" style="margin-left: 0px;">该套餐内含{{product.serviceCount}}次服务</text> |
|||
<text class="text-gray text-small margin-left">已售:{{product.soldNum}}套</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="blank-10 bg"></view> |
|||
|
|||
<view class="item-intro"> |
|||
<view class="intro-title">下单须知</view> |
|||
<view class="intro-bd notice-box"> |
|||
<template is="wxParse" data="{{wxParseData:notice.nodes}}"/> |
|||
</view> |
|||
</view> |
|||
<view class="blank-10 bg"></view> |
|||
|
|||
<view class='box'> |
|||
<view class='lookDetail' bindtap='loading' data-item='{{product.goodsNo}}'>查看详情>></view> |
|||
</view> |
|||
<view class="blank-50"></view> |
|||
<view data-spm="action" class="item-action"> |
|||
<view class="buy-now {{nowDate > product.endedAt||product.soldNum >= product.totalNum?'gray':''}}" style="position: relative"> |
|||
<view class='create-order' data-item='{{product}}' bindtap="{{nowDate > product.endedAt||product.soldNum >= product.totalNum?'':'createOrder'}}">立即下单</view> |
|||
<view class="buy-bg" style="{{nowDate > product.endedAt||product.soldNum >= product.totalNum?'display: block;':'display: none;'}}"> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,176 @@ |
|||
@import "../../wxParse/wxParse.wxss"; |
|||
|
|||
page{ |
|||
font-family: PingFang-SC-Bold; |
|||
background: #F3F3F3; |
|||
} |
|||
view{ |
|||
font-family: PingFang-SC-Bold; |
|||
border: 0; |
|||
font-size: 28rpx; |
|||
font: inherit; |
|||
vertical-align: baseline; |
|||
} |
|||
.tuan-detail { |
|||
overflow: hidden; |
|||
position: relative; |
|||
margin-top: -50px; |
|||
} |
|||
.tuan-detail .banner { |
|||
width: 100%; |
|||
position: relative; |
|||
} |
|||
.line { |
|||
overflow: hidden; |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
.focus { |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
.focus .bd { |
|||
position: relative; |
|||
z-index: 0; |
|||
} |
|||
.tempWrap{ |
|||
overflow: hidden; |
|||
position: relative; |
|||
} |
|||
.bd_banner{ |
|||
width: 100%; |
|||
position: relative; |
|||
overflow: hidden; |
|||
padding: 0px; |
|||
margin: 0px; |
|||
transition-duration: 200ms; |
|||
transform: translate(0px, 0px) translateZ(0px); |
|||
} |
|||
.bd_banner image{ |
|||
width: 100%; |
|||
} |
|||
/* 订单详情 */ |
|||
.item-detail { |
|||
background: #FFF; |
|||
} |
|||
.item-detail .detail-row { |
|||
overflow: hidden; |
|||
padding: 10px; |
|||
width: 100%; |
|||
border-bottom: thin solid #eee; |
|||
} |
|||
.pro-title{ |
|||
font-size: 48rpx; |
|||
} |
|||
.item-detail .item-price .price { |
|||
color: #F60; |
|||
font-size: 40rpx; |
|||
margin: 0; |
|||
font-family: tahoma,arial,"Hiragino Sans GB",sans-serif; |
|||
} |
|||
.item-detail .detail-row .price-tip { |
|||
margin-top: 20rpx; |
|||
} |
|||
.item-detail .detail-row .price-tip span.text-gray { |
|||
margin-right: 10rpx; |
|||
} |
|||
.attr-list, .text-gray { |
|||
float: left; |
|||
} |
|||
.text-gray{ |
|||
color: #999; |
|||
} |
|||
.text-small { |
|||
font-size: 24rpx; |
|||
} |
|||
.margin-left { |
|||
margin-left: 20rpx; |
|||
} |
|||
|
|||
/* 下单须知 、服务介绍*/ |
|||
.item-intro { |
|||
background: #FFF; |
|||
border-top: thin solid #eee; |
|||
} |
|||
.intro-title{ |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
font-size: 28rpx; |
|||
padding: 0 20rpx; |
|||
border-bottom: thin solid #eee; |
|||
} |
|||
.item-intro .intro-bd { |
|||
line-height: 50rpx; |
|||
font-size: 28rpx; |
|||
padding: 20rpx; |
|||
padding-bottom: 0px; |
|||
margin-left: 3%; |
|||
color: #F60; |
|||
} |
|||
.box{ |
|||
margin-top: 20rpx; |
|||
background: #fff; |
|||
height: 100rpx; |
|||
line-height: 100rpx; |
|||
display:flex; |
|||
flex-direction:row; |
|||
justify-content:space-between; |
|||
} |
|||
.lookDetail{ |
|||
color:#26AE76; |
|||
font-size:16px; |
|||
text-align:center; |
|||
margin:0 auto; |
|||
} |
|||
/* 立即下单 */ |
|||
.item-action { |
|||
width: 100%; |
|||
display: -webkit-box; |
|||
display: -webkit-flex; |
|||
display: -ms-flexbox; |
|||
display: flex; |
|||
position: fixed; |
|||
height: 48px; |
|||
bottom: 0; |
|||
left: 0; |
|||
text-align: center; |
|||
line-height: 48px; |
|||
z-index: 999; |
|||
background-color: #fff; |
|||
} |
|||
.item-action .buy-now, .item-action .gray { |
|||
-webkit-box-flex: 3; |
|||
width: 33.333%; |
|||
-webkit-flex: 3; |
|||
-ms-flex: 3; |
|||
flex: 3; |
|||
cursor: pointer; |
|||
} |
|||
.item-action .buy-now { |
|||
background-color: #ff5000; |
|||
display: inline-block; |
|||
} |
|||
.item-action .gray { |
|||
background-color:#eee; |
|||
display: inline-block; |
|||
} |
|||
.item-action .buy-now .create-order,.item-action .gray .create-order{ |
|||
color: #fff; |
|||
display: inline-block; |
|||
padding: 2rpx 200rpx; |
|||
font-size: 28rpx; |
|||
} |
|||
/* 按钮遮罩层 */ |
|||
.buy-bg{ |
|||
flex:3;position: absolute;width:100%;bottom: 0px;right: 0px;height: 50px; |
|||
} |
|||
.blank-10 { |
|||
height: 20rpx; |
|||
width: 100%; |
|||
} |
|||
.blank-50 { |
|||
height: 100rpx; |
|||
width: 100%; |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
// pages/jz/jz.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
data: { |
|||
imgUrls: [ |
|||
'/images/banner1.png' |
|||
], |
|||
indicatorDots: true, |
|||
autoplay: true, |
|||
interval: 5000, |
|||
duration: 1000, |
|||
price: '399', |
|||
img1: '/images/title-icon.png', |
|||
img2:'/images/banner2.png', |
|||
nowDate: new Date().getTime(), |
|||
cityId: 440100000, |
|||
_num: 1, |
|||
typeNum:10, |
|||
addrArray: { id: [440100000, 430426000],name:['广州', '深圳', '上海', '长沙', '武汉', '杭州', '北京']}, |
|||
addrIndex: 0, |
|||
items1: [ |
|||
{ goodsNo: "2", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月2次体验卡", serviceCount: 2, endedAt: 1596038400000}, |
|||
{ goodsNo: "2", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月2次体验卡", serviceCount: 2, endedAt: 1522742277010}, |
|||
], |
|||
items2: [ |
|||
{ goodsNo: "5", merchantNo: "2", name: "3A舒适家", originalPrice: 519900, price: 519900, shortDesc: "包年套餐,两周一次高端保洁服务", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/10/13/thumb_59e023b5423aa.png", soldNum: 2753, totalNum: 999739, type: 41, typeStr: "3A年卡", serviceCount: 26, endedAt: 1596038400000}, |
|||
{ goodsNo: "5", merchantNo: "2", name: "3A舒适家", originalPrice: 519900, price: 519900, shortDesc: "包年套餐,两周一次高端保洁服务", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/10/13/thumb_59e023b5423aa.png", soldNum: 2753, totalNum: 999739, type: 41, typeStr: "3A年卡", serviceCount: 26, endedAt: 1596038400000}, |
|||
], |
|||
items3: [ |
|||
{ goodsNo: "2", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月4次体验卡" }, |
|||
{ goodsNo: "2", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月4次体验卡" }, |
|||
], |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
getActive: function (e) { |
|||
this.setData({ |
|||
_num: e.target.dataset.num |
|||
}) |
|||
}, |
|||
bindAddrChange: function (e) { |
|||
this.setData({ |
|||
_num: e.detail.value+1, |
|||
addrIndex: e.detail.value |
|||
}) |
|||
wx.request({ |
|||
url: 'http://192.168.0.165:9999/mall/web/vgoods/list', |
|||
data: { selectedCityId: this.data.addrArray.id[e.detail.value] }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
console.log(res.response); |
|||
}, |
|||
fail: function (res) { }, |
|||
complete: function (res) { }, |
|||
}) |
|||
}, |
|||
loading: function (e) { |
|||
|
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
wx.navigateTo({ |
|||
url: '../detail/detail?jsonStr=' + str |
|||
}) |
|||
console.log(str); |
|||
}, |
|||
loadingClick: function () { |
|||
var price = event.currentTarget.dataset.price; |
|||
console.log(price); |
|||
|
|||
var pages = getCurrentPages(); |
|||
var currPage = pages[pages.length - 1]; //当前页面
|
|||
var prevPage = pages[pages.length]; //下一个页面
|
|||
|
|||
//直接调用上一个页面的setData()方法,把数据存到下一个页面中去
|
|||
prevPage.setData({ |
|||
price: price |
|||
}); |
|||
}, |
|||
onLoad: function () { |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,44 @@ |
|||
<view class='header'> |
|||
<view class='top-left'> |
|||
<picker class='address' bindchange="bindAddrChange" value="{{addrIndex1}}" range="{{addrArray.name}}"> |
|||
<view> |
|||
<text>{{addrArray.name[addrIndex]}}</text> |
|||
</view> |
|||
</picker> |
|||
</view> |
|||
<image class='title_img' src='{{img1}}' mode='widthFix'></image> |
|||
<view class='top-right'></view> |
|||
</view> |
|||
<!--banner广告--> |
|||
<!-- <swiper indicator-dots="{{indicatorDots}}" |
|||
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> |
|||
<block wx:for="{{imgUrls}}"> |
|||
<swiper-item> |
|||
<image src="{{item}}" class="slide-image" mode='widthFix'/> |
|||
</swiper-item> |
|||
</block> |
|||
</swiper> --> |
|||
<view> |
|||
<image src="{{imgUrls[0]}}" class="slide-image" mode='widthFix'/> |
|||
</view> |
|||
<!--广告栏--> |
|||
<navigator url="../detail/detail" hover-class="other-navigator-hover"> |
|||
<image class="ad1" style='width:100%;' src="{{img2}}" mode='widthFix'></image> |
|||
</navigator> |
|||
<view class="goods_limit_buy mb10"> |
|||
<view class="locatLabel_switch swiper-container5"> |
|||
<view class="swiper-wrapper main_box"> |
|||
<view class="box swiper-slide" wx:for-items="{{_num == 1?items1:items2}}"> |
|||
<view wx:if='{{nowDate<item.endedAt}}'> |
|||
<view bindtap='loading' data-item='{{item}}'> |
|||
<image src="{{item.showImg}}" mode="widthFix"/> |
|||
<text class="p1">{{item.name}}</text> |
|||
<view class="p4"> |
|||
<view class='p2'>¥</view>{{item.price/100}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,169 @@ |
|||
/* pages/jz/jz.wxss */ |
|||
page{ |
|||
font-family: PingFang-SC-Bold; |
|||
background: #F3F3F3; |
|||
} |
|||
view{ |
|||
font-family: PingFang-SC-Bold; |
|||
border: 0; |
|||
font-size: 28rpx; |
|||
font: inherit; |
|||
vertical-align: baseline; |
|||
} |
|||
swiper{ |
|||
height: 400rpx; |
|||
} |
|||
image{ |
|||
width: 100%; |
|||
} |
|||
.title_img{ |
|||
width: 24%; |
|||
margin: 10rpx 10%; |
|||
display: inline-block; |
|||
} |
|||
.header{ |
|||
width: 100%; |
|||
background-color: #26ae76; |
|||
} |
|||
.top-left,.top-right{ |
|||
width: 28%; |
|||
display: inline-block; |
|||
vertical-align:super; |
|||
} |
|||
.address{ |
|||
font-size: 30rpx; |
|||
color:#fff; |
|||
margin-left:44rpx; |
|||
} |
|||
.middle{ |
|||
background: #fff; |
|||
margin-bottom: 20rpx; |
|||
} |
|||
.middle_left,.middle_right{ |
|||
width: 27%; |
|||
display: inline-block; |
|||
font-size: 32rpx; |
|||
padding: 20rpx 0; |
|||
text-align: center; |
|||
margin: 10rpx 11% 0; |
|||
} |
|||
.active{ |
|||
color:#26AE76; |
|||
border-bottom: 4rpx solid #26AE76; |
|||
} |
|||
.col-line{ |
|||
display: inline-block; |
|||
width: 2rpx; |
|||
background: #D2D2D2; |
|||
height: 52rpx; |
|||
vertical-align: middle; |
|||
} |
|||
.detail-box{ |
|||
display: none; |
|||
background: #fff; |
|||
margin-top: 10rpx; |
|||
} |
|||
.visible{ |
|||
display: block; |
|||
} |
|||
.img-box{ |
|||
display: inline-block; |
|||
} |
|||
.detail-img{ |
|||
width: 140rpx; |
|||
height: 140rpx; |
|||
margin: 24rpx 28rpx 24rpx 21rpx; |
|||
} |
|||
.detail-msg{ |
|||
display: inline-block; |
|||
width: 50%; |
|||
font-size: 30rpx; |
|||
vertical-align: top; |
|||
padding-top: 24rpx; |
|||
} |
|||
.msg-title{ |
|||
font-size: 32rpx; |
|||
} |
|||
.msg-intro{ |
|||
font-size: 26rpx; |
|||
color:#999999; |
|||
margin:10rpx 0; |
|||
} |
|||
.msg-price{ |
|||
font-size: 36rpx; |
|||
color:#EE3030; |
|||
} |
|||
/* .line{ |
|||
height: 10rpx; |
|||
width: 100%; |
|||
background: #F3F3F3; |
|||
} */ |
|||
/* .line2{ |
|||
height: 10rpx; |
|||
width: 100%; |
|||
background: #F3F3F3; |
|||
} */ |
|||
.booking-btn{ |
|||
float: right; |
|||
width: 160rpx; |
|||
height: 60rpx; |
|||
margin-top: 64rpx; |
|||
margin-right: 30rpx; |
|||
background: #26AE76; |
|||
border-radius: 4rpx; |
|||
color: #fff; |
|||
line-height: 60rpx; |
|||
text-align: center; |
|||
font-size: 32rpx; |
|||
} |
|||
|
|||
/*优惠价格*/ |
|||
del{ |
|||
color: #c0c0c0;font-size: 28rpx;margin-left: 20rpx;position:absolute;margin-top: 6rpx;font-family: "微软雅黑 Light";font-weight: bold;text-decoration: line-through; |
|||
} |
|||
/*商品栏*/ |
|||
.goods_title{border-bottom: none;text-align: center;padding: 0.6rem 0.8rem;} |
|||
.goods_title span{font-weight: bold;} |
|||
/*常用服务*/ |
|||
.regularly_title{ width:22%; height:41px; line-height:41px; position:relative; margin-left:auto; margin-right:auto; text-align:center; color:#b2bab8;} |
|||
.regularly_title .border_top{ width:160%; top:20px;} |
|||
|
|||
/*商品详情*/ |
|||
.goods_limit_buy .swiper-wrapper .swiper-slide{display: inline-block;position: relative;} |
|||
.goods_limit_buy .swiper-slide image{width:90%;height: auto;margin: 20rpx auto 0px;} |
|||
.goods_limit_buy .swiper-slide .p1{ |
|||
font-size: 32rpx; |
|||
color: #666; |
|||
position: relative; |
|||
width: 90%; |
|||
margin: 0 auto; |
|||
} |
|||
.goods_limit_buy .swiper-slide .p2{ |
|||
font-size: 32rpx; |
|||
display: inline-block; |
|||
} |
|||
.goods_limit_buy .swiper-slide .p3{font-size: 24rpx;color: #999999;width: 32rpx;margin: 2rpx auto 4rpx} |
|||
.goods_limit_buy .swiper-slide .p4{ |
|||
color: #ff4040; |
|||
font-size: 40rpx; |
|||
font-family: '微软雅黑 Light'; |
|||
font-weight: bold; |
|||
margin: 20rpx 0; |
|||
} |
|||
.goods_limit_buy .swiper-slide .p5{text-decoration:line-through;color: #c0c0c0;font-size: 28rpx;margin-left: 20rpx;position:absolute;margin-top: 6rpx;font-weight: bold;} |
|||
.goods_limit_buy .locatLabel_switch{ width:100%; z-index:1; text-align:center; overflow:hidden; position:relative;} |
|||
.goods_limit_buy .locatLabel_switch .swiper-wrapper {position: relative;width: 100%;z-index: 1;display: -webkit-box;display: -moz-box;display: -ms-flexbox;display: -webkit-flex;display: flex;-webkit-transition-property: -webkit-transform;-moz-transition-property: -moz-transform;-o-transition-property: -o-transform;-ms-transition-property: -ms-transform;transition-property: transform;-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;-webkit-transform: translate3d(0,0,0);-moz-transform: translate3d(0,0,0);-o-transform: translate(0,0);-ms-transform: translate3d(0,0,0);transform: translate3d(0,0,0);} |
|||
.goods_limit_buy .locatLabel_switch .swiper-slide{-webkit-flex-shrink: 0;-ms-flex: 0 0 auto;flex-shrink: 0;height: 100%;position: relative;text-align: center; |
|||
display: -webkit-box;display: -ms-flexbox;display: -webkit-flex;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;-webkit-justify-content: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;-webkit-align-items: center;align-items: center;} |
|||
.goods_limit_buy .locatLabel_switch .box{display:inline-block;line-height:48rpx; font-size:28rpx;background-color: #fff;width: 48%;margin:0 1% 20rpx;box-shadow: 4rpx 6rpx 4rpx #eee;} |
|||
|
|||
.goods_limit_buy{padding: 0 12rpx;margin-top: 10rpx;} |
|||
.combo_type{position: absolute;display: inline-block;padding: 0px 10rpx;border-radius: 10rpx;font-size: 20rpx;line-height: 40rpx;margin-left: 20rpx;color: #fff;white-space: nowrap;} |
|||
.middle_banner{margin-bottom: 8rpx;} |
|||
.sell_out{position: absolute;width: 36%;z-index: 100;top:16rpx;right: 20rpx;height: auto;} |
|||
.main_box{ |
|||
display: inline-block;width: 100% |
|||
} |
|||
|
|||
/*广告栏*/ |
|||
.ad1{margin-bottom: 4rpx;} |
|||
@ -0,0 +1,160 @@ |
|||
// pages/jz/jz.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
data: { |
|||
imgUrls: [ |
|||
'/images/banner1.png' |
|||
], |
|||
indicatorDots: true, |
|||
autoplay: true, |
|||
interval: 5000, |
|||
duration: 1000, |
|||
price: '399', |
|||
img1: '/images/address.png', |
|||
img2: '/images/banner2.png', |
|||
nowDate: new Date().getTime(), |
|||
cityId: 440100000, |
|||
typeFlag: 30, |
|||
addrArray: { id: [440100000, 430426000], name: ['广州', '祁东'] }, |
|||
addrIndex: 0, |
|||
items1: [], |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
getActive: function (e) { |
|||
this.setData({ |
|||
typeFlag: e.target.dataset.num |
|||
}) |
|||
console.log(e.target.dataset.num); |
|||
}, |
|||
bindAddrChange: function (e) { |
|||
this.setData({ |
|||
addrIndex: e.detail.value |
|||
}) |
|||
let that=this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl +'/mall/web/vgoods/list', |
|||
data: { selectedCityId: this.data.addrArray.id[e.detail.value] }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
console.log(res.data.response.goodsList.list); |
|||
that.setData({ |
|||
items1: res.data.response.goodsList.list |
|||
}) |
|||
}, |
|||
fail: function (res) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
complete: function (res) { }, |
|||
}) |
|||
}, |
|||
loading: function (e) { |
|||
let str = e.currentTarget.dataset.item; |
|||
wx.navigateTo({ |
|||
url: '../detail/detail?jsonStr=' + str |
|||
}) |
|||
console.log(str); |
|||
}, |
|||
loadingClick: function () { |
|||
var price = event.currentTarget.dataset.price; |
|||
console.log(price); |
|||
|
|||
var pages = getCurrentPages(); |
|||
var currPage = pages[pages.length - 1]; //当前页面
|
|||
var prevPage = pages[pages.length]; //下一个页面
|
|||
|
|||
//直接调用上一个页面的setData()方法,把数据存到下一个页面中去
|
|||
prevPage.setData({ |
|||
price: price |
|||
}); |
|||
}, |
|||
onPullDownRefresh() { |
|||
console.log('--------下拉刷新-------') |
|||
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/web/vgoods/list', |
|||
data: { selectedCityId: '' }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
console.log(res.data.response.goodsList.list); |
|||
that.setData({ |
|||
items1: res.data.response.goodsList.list |
|||
}) |
|||
}, |
|||
fail: function (res) { }, |
|||
complete: function (res) { |
|||
// complete
|
|||
wx.hideNavigationBarLoading() //完成停止加载
|
|||
wx.stopPullDownRefresh() //停止下拉刷新
|
|||
}, |
|||
}) |
|||
}, |
|||
onLoad: function () { |
|||
let that = this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/web/vgoods/list', |
|||
data: { selectedCityId: '' }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
console.log(res.data.response.goodsList.list); |
|||
that.setData({ |
|||
items1: res.data.response.goodsList.list |
|||
}) |
|||
}, |
|||
fail: function (res) { }, |
|||
complete: function (res) { }, |
|||
}) |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
// wx.getUserInfo({
|
|||
// success: res => {
|
|||
// app.globalData.userInfo = res.userInfo
|
|||
// this.setData({
|
|||
// userInfo: res.userInfo,
|
|||
// hasUserInfo: true
|
|||
// })
|
|||
// }
|
|||
// })
|
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"navigationBarTitleText": "一号家政", |
|||
"enablePullDownRefresh": true, |
|||
"backgroundColor": "#26AE76" |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
<!--pages/jz/jz.wxml--> |
|||
<view class='header'> |
|||
<view class='top-left'> |
|||
<picker class='addressBox' bindchange="bindAddrChange" value="{{addrIndex1}}" range="{{addrArray.name}}"> |
|||
<image class='title_img' src='{{img1}}' mode='widthFill'></image> |
|||
<view class='address'> |
|||
<text>{{addrArray.name[addrIndex]}}</text> |
|||
</view> |
|||
</picker> |
|||
</view> |
|||
<!-- <image class='title_img' src='{{img1}}' mode='widthFill'></image> --> |
|||
<view class='top-right'></view> |
|||
</view> |
|||
<swiper indicator-dots="{{indicatorDots}}" |
|||
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> |
|||
<block wx:for="{{imgUrls}}"> |
|||
<swiper-item> |
|||
<image src="{{item}}" class="slide-image" mode='widthFill'/> |
|||
</swiper-item> |
|||
</block> |
|||
</swiper> |
|||
<view class='middle'> |
|||
<view class="{{typeFlag == 30?'middle_left active':'middle_left'}}" data-num='30' bindtap='getActive'>家庭保洁</view> |
|||
<view class='col-line'></view> |
|||
<view class="{{typeFlag == 40?'middle_right active':'middle_right'}}" data-num='40' bindtap='getActive'>包年保洁</view> |
|||
</view> |
|||
<view wx:for-items="{{items1}}"> |
|||
<view wx:if='{{typeFlag == 30}}'> |
|||
<view wx:if='{{item.type<=typeFlag}}'> |
|||
<!-- <view wx:if='{{nowDate<item.endedAt}}'> --> |
|||
<view class="detail-box visible" bindtap='loading' data-item='{{item.goodsNo}}'> |
|||
<view class='img-box'> |
|||
<image class='detail-img' src='{{item.showImg}}' mode='widthFill'></image> |
|||
</view> |
|||
<view class='detail-msg'> |
|||
<view class='msg-title {{item.type+10}}'>{{item.name}}</view> |
|||
<view class='msg-intro'>{{item.shortDesc}}</view> |
|||
<view class='msg-price'>¥{{item.price/100}}</view> |
|||
</view> |
|||
<button class='booking-btn'>预约</button> |
|||
</view> |
|||
<!-- </view> --> |
|||
</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view wx:if='{{item.type>=typeFlag}}'> |
|||
<!-- <view wx:if='{{nowDate<item.endedAt}}'> --> |
|||
<view class="detail-box visible" bindtap='loading' data-item='{{item.goodsNo}}'> |
|||
<view class='img-box'> |
|||
<image class='detail-img' src='{{item.showImg}}' mode='widthFill'></image> |
|||
</view> |
|||
<view class='detail-msg'> |
|||
<view class='msg-title {{item.type+10}}'>{{item.name}}</view> |
|||
<view class='msg-intro'>{{item.shortDesc}}</view> |
|||
<view class='msg-price'>¥{{item.price/100}}</view> |
|||
</view> |
|||
<button class='booking-btn'>预约</button> |
|||
</view> |
|||
<!-- </view> --> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,120 @@ |
|||
/* pages/jz/jz.wxss */ |
|||
swiper{ |
|||
height: 400rpx; |
|||
} |
|||
image{ |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
.title_img{ |
|||
width: 40rpx; |
|||
height: 40rpx; |
|||
margin: 10rpx 0; |
|||
display: inline-block; |
|||
color: #fff; |
|||
} |
|||
.header{ |
|||
width: 100%; |
|||
background: rgba(0,0,0,0.5); |
|||
position:absolute; |
|||
top:0px; |
|||
z-index:100; |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
} |
|||
.top-left,.top-right{ |
|||
width: 40%; |
|||
display: inline-block; |
|||
} |
|||
.addressBox{ |
|||
font-size: 30rpx; |
|||
color:#fff; |
|||
margin-left:30rpx; |
|||
} |
|||
.address{ |
|||
display: inline-table; |
|||
font-size: 30rpx; |
|||
color:#fff; |
|||
margin-left:20rpx; |
|||
vertical-align: super; |
|||
} |
|||
.middle{ |
|||
background: #fff; |
|||
margin-bottom: 20rpx; |
|||
} |
|||
.middle_left,.middle_right{ |
|||
width: 27%; |
|||
display: inline-block; |
|||
font-size: 32rpx; |
|||
padding: 20rpx 0; |
|||
text-align: center; |
|||
margin: 10rpx 11% 0; |
|||
} |
|||
.active{ |
|||
color:#26AE76; |
|||
border-bottom: 4rpx solid #26AE76; |
|||
} |
|||
.col-line{ |
|||
display: inline-block; |
|||
width: 2rpx; |
|||
background: #D2D2D2; |
|||
height: 52rpx; |
|||
vertical-align: middle; |
|||
} |
|||
.detail-box{ |
|||
display: none; |
|||
background: #fff; |
|||
margin-top: 10rpx; |
|||
} |
|||
.visible{ |
|||
display: flex; |
|||
flex-direction: row; |
|||
} |
|||
.detail-img{ |
|||
width: 140rpx; |
|||
height: 140rpx; |
|||
margin: 24rpx 28rpx 24rpx 21rpx; |
|||
} |
|||
.detail-msg{ |
|||
width: 45%; |
|||
font-size: 30rpx; |
|||
vertical-align: top; |
|||
padding-top: 24rpx; |
|||
} |
|||
.msg-title{ |
|||
font-size: 32rpx; |
|||
} |
|||
.msg-intro{ |
|||
font-size: 26rpx; |
|||
color:#999999; |
|||
margin:10rpx 0; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
} |
|||
.msg-price{ |
|||
font-size: 36rpx; |
|||
color:#EE3030; |
|||
} |
|||
/* .line{ |
|||
height: 10rpx; |
|||
width: 100%; |
|||
background: #F3F3F3; |
|||
} */ |
|||
/* .line2{ |
|||
height: 10rpx; |
|||
width: 100%; |
|||
background: #F3F3F3; |
|||
} */ |
|||
.booking-btn{ |
|||
width: 160rpx; |
|||
height: 60rpx; |
|||
margin-top: 64rpx; |
|||
margin-right: 30rpx; |
|||
background: #26AE76; |
|||
border-radius: 4rpx; |
|||
color: #fff; |
|||
line-height: 60rpx; |
|||
text-align: center; |
|||
font-size: 32rpx; |
|||
} |
|||
@ -0,0 +1,230 @@ |
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
mobile:'', |
|||
code:'', |
|||
text:'', |
|||
mobile_lock:0, |
|||
mobile_count:60, |
|||
isLogin:false |
|||
}, |
|||
//事件处理函数
|
|||
inputMobile:function(e){//输入手机号事件监听
|
|||
this.setData({ |
|||
mobile: e.detail.value |
|||
}) |
|||
console.log(e.detail.value); |
|||
}, |
|||
inputCode: function (e) {//输入短信动态码事件监听
|
|||
this.setData({ |
|||
code: e.detail.value |
|||
}) |
|||
}, |
|||
getCode:function(e){//获取动态码事件监听
|
|||
let mobile = this.data.mobile; |
|||
this.checkForm(mobile,'手机号','mobile'); |
|||
if (this.data.mobile_lock === 0) { |
|||
this.setData({ |
|||
mobile_lock:1, |
|||
}); |
|||
let that=this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/sms/code', |
|||
data: { mobileNumber: that.data.mobile,codeType:1,clientType:10 }, |
|||
header: { "Content-Type": "application/json" }, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
if (res.data.code == 0) { |
|||
that.setData({ |
|||
mobile_count: 60 |
|||
}); |
|||
wx.showToast({ |
|||
title: '验证码发送成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
that.btnCount(); |
|||
} else { |
|||
that.setData({ |
|||
mobile_lock: 0 |
|||
}); |
|||
that.setData( |
|||
{ popErrorMsg: res.data.msg } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return; |
|||
} |
|||
}, |
|||
fail: function (res) { }, |
|||
complete: function (res) { }, |
|||
}) |
|||
} |
|||
}, |
|||
ohShitfadeOut() {//错误提示显示3秒后消失,清空计时器
|
|||
var fadeOutTimeout = setTimeout(() => { |
|||
this.setData({ popErrorMsg: '' }); |
|||
clearTimeout(fadeOutTimeout); |
|||
}, 3000); |
|||
}, |
|||
btnCount() { |
|||
let that=this; |
|||
if (this.data.mobile_count == 0) { |
|||
that.setData( |
|||
{ text: "重新获取" } |
|||
); |
|||
that.setData({ |
|||
mobile_lock: 0 |
|||
}); |
|||
clearTimeout(that.mobile_timeout); |
|||
} |
|||
else { |
|||
let count = this.data.mobile_count; |
|||
count--; |
|||
that.setData({ |
|||
mobile_count: count |
|||
}); |
|||
that.setData( |
|||
{ text: "重新发送(" + count.toString() + ")秒" } |
|||
); |
|||
that.mobile_timeout = setTimeout(that.btnCount, 1000); |
|||
} |
|||
}, |
|||
checkForm: function (sign, title,flag) { |
|||
let that = this; |
|||
if (sign == '') { |
|||
that.setData( |
|||
{ popErrorMsg: title + "不能为空" } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return false; |
|||
} else if (flag == 'mobile') { |
|||
if (!(/^1[345678]\d{9}$/.test(sign))) { |
|||
that.setData( |
|||
{ popErrorMsg: title + "格式错误,请重填" } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return false; |
|||
} |
|||
} |
|||
}, |
|||
bindFormSubmit: function (e) {//点击登录事件监听
|
|||
let that = this; |
|||
let mobile = e.detail.value.mobile; |
|||
let code = e.detail.value.code; |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
var pages = getCurrentPages(); |
|||
var currPage = pages[pages.length - 1]; //当前页面
|
|||
var prevPage = pages[pages.length - 2]; //上一个页面
|
|||
console.log(mobile); |
|||
let checkMobile = that.checkForm(mobile,'手机号','mobile'); |
|||
if(checkMobile!=false){ |
|||
let checkCode = that.checkForm(code,'验证码','code'); |
|||
if(checkCode!=false){ |
|||
if(that.data.isLogin==false){ |
|||
that.setData({ |
|||
isLogin: true |
|||
}) |
|||
// 获取用户信息
|
|||
wx.getSetting({ |
|||
success: res => { |
|||
if (res.authSetting['scope.userInfo']) { |
|||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
// 可以将 res 发送给后台解码出 unionId
|
|||
app.globalData.userInfo = res.userInfo |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
if (app.userInfoReadyCallback) { |
|||
app.userInfoReadyCallback(res) |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
let user = app.globalData.userInfo; |
|||
wx.request({//获取sessionId
|
|||
url: app.gw.hostUrl + '/mall/wxa/auth/mobile/bind', |
|||
method: 'post', |
|||
data: { |
|||
mobile: mobile, |
|||
verifyCode: code, |
|||
openid: app.globalData.openid |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded' |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
let data = res.data; |
|||
let status = data.code; |
|||
if (status != 0) { |
|||
that.setData( |
|||
{ popErrorMsg: data.msg } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
return; |
|||
} |
|||
app.globalData.sessionId = data.response.sessionId; |
|||
wx.setStorageSync('sessionId', data.response.sessionId); |
|||
console.log('sessionId : ' + data.response.sessionId); |
|||
wx.showToast({ |
|||
title: '登录成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
wx.navigateBack({ |
|||
success: function (e) { |
|||
var page = getCurrentPages().pop(); |
|||
if (page == undefined || page == null) return; |
|||
console.log(page); |
|||
page.onLoad(); |
|||
} |
|||
});//返回到之前页面
|
|||
}, |
|||
fail: function (e) { |
|||
that.setData( |
|||
{ popErrorMsg: '网络异常!err:authlogin' } |
|||
); |
|||
that.ohShitfadeOut(); |
|||
}, |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
onLoad: function (options) { |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "手机登录" |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<view class="ad_popError" wx:if="{{popErrorMsg}}">{{popErrorMsg}}</view> |
|||
<form bindsubmit="bindFormSubmit" data-item='{{product}}'> |
|||
<!-- <textarea placeholder="请在此写下您的其他需求......" name="textarea" value='{{remark}}'/> --> |
|||
<view class='detailBox'> |
|||
<view class='box'> |
|||
<view class='text'>手机号:</view> |
|||
<view class='icon-note'> |
|||
<input class='note' name="mobile" placeholder='注册或绑定手机号' bindinput='inputMobile'/> |
|||
</view> |
|||
</view> |
|||
<view class='line'></view> |
|||
<view class='box'> |
|||
<view class='text'>动态码:</view> |
|||
<view class='icon-note'> |
|||
<view class='note code-note'> |
|||
<input class='note' name="code" placeholder='短信动态码' bindinput='inputCode'/> |
|||
</view> |
|||
<button class='getCode' bindtap='getCode' data-item=''>{{text==''?'获取动态码':text}} </button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<button class='subBtn' form-type="submit"> 登录 </button> |
|||
</form> |
|||
@ -0,0 +1,90 @@ |
|||
page{ |
|||
font-family: PingFang-SC-Bold; |
|||
background: #F3F3F3; |
|||
box-sizing:border-box; |
|||
} |
|||
view{ |
|||
font-family: PingFang-SC-Bold; |
|||
border: 0; |
|||
font-size: 28rpx; |
|||
font: inherit; |
|||
vertical-align: baseline; |
|||
box-sizing:border-box; |
|||
} |
|||
button::after{ |
|||
border: none; |
|||
} |
|||
.ad_popError{ |
|||
background: #de352d; |
|||
color: #fff; |
|||
height: 58rpx; |
|||
line-height: 58rpx; |
|||
font-size: 24rpx; |
|||
text-align: center; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
width: 100%; |
|||
z-index:3; |
|||
} |
|||
.detailBox{ |
|||
margin-top: 58rpx; |
|||
background:#fff; |
|||
} |
|||
.box{ |
|||
background: #fff; |
|||
height: 100rpx; |
|||
line-height: 100rpx; |
|||
display:flex; |
|||
justify-content:space-between; |
|||
align-items:center; |
|||
} |
|||
.line{ |
|||
height: 1px; |
|||
background: #eee; |
|||
margin-left:35rpx; |
|||
} |
|||
.text{ |
|||
flex-direction: row; |
|||
color: #666; |
|||
font-size: 30rpx; |
|||
width: 22%; |
|||
padding-left: 35rpx; |
|||
} |
|||
.icon-note{ |
|||
flex-direction: row; |
|||
float: right; |
|||
margin-right: 35rpx; |
|||
width: 78%; |
|||
display: flex; |
|||
justify-content:space-between; |
|||
align-items:center; |
|||
} |
|||
.note{ |
|||
margin-right: 10rpx; |
|||
font-size: 28rpx; |
|||
color: #999999; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
width: 100%; |
|||
} |
|||
.code-note{ |
|||
width: 58%; |
|||
} |
|||
.getCode{ |
|||
border: 2rpx solid #1eba84; |
|||
border-radius: 10rpx; |
|||
color:#1eba84; |
|||
font-size: 24rpx; |
|||
width: 42%; |
|||
background: #fff; |
|||
} |
|||
.subBtn{ |
|||
width: 90%; |
|||
margin: 40rpx auto; |
|||
text-align: center; |
|||
color: #fff; |
|||
background: #1eba84; |
|||
border-radius:5px; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
//logs.js
|
|||
const util = require('../../utils/util.js') |
|||
|
|||
Page({ |
|||
data: { |
|||
logs: [] |
|||
}, |
|||
onLoad: function () { |
|||
this.setData({ |
|||
logs: (wx.getStorageSync('logs') || []).map(log => { |
|||
return util.formatTime(new Date(log)) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "查看启动日志" |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
<!--logs.wxml--> |
|||
<view class="container log-list"> |
|||
<block wx:for="{{logs}}" wx:for-item="log"> |
|||
<text class="log-item">{{index + 1}}. {{log}}</text> |
|||
</block> |
|||
</view> |
|||
@ -0,0 +1,8 @@ |
|||
.log-list { |
|||
display: flex; |
|||
flex-direction: column; |
|||
padding: 40rpx; |
|||
} |
|||
.log-item { |
|||
margin: 10rpx; |
|||
} |
|||
@ -0,0 +1,118 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
data: { |
|||
items:[ |
|||
{ top: 20, title: '我的订单', img:'../../images/order.png',page:'Order'}, |
|||
// { top: 1, title: '我的地址', img: '../../images/addr.png', page:'Address'},
|
|||
{ top: 20, title: '联系客服', img: '../../images/service.png', page:'Transition'} |
|||
], |
|||
sessionId: '' |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
bindFocus: function () { |
|||
wx.navigateTo({ |
|||
title: "goback", |
|||
url: '../jz/jz' |
|||
}) |
|||
}, |
|||
goLogin: function (e) { |
|||
wx.navigateTo({ |
|||
url: '../login/login' |
|||
}) |
|||
}, |
|||
goOrder: function (e) { |
|||
wx.switchTab({ |
|||
url: '../order/order' |
|||
}) |
|||
}, |
|||
goTransition: function (e) { |
|||
wx.makePhoneCall({ |
|||
phoneNumber: '400-6080100' |
|||
}) |
|||
}, |
|||
onLoad: function () { |
|||
console.log(wx.getStorageSync('sessionId')); |
|||
console.log(app.globalData.sessionId); |
|||
this.setData({ |
|||
sessionId: wx.getStorageSync('sessionId') |
|||
}) |
|||
let that = this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/wxa/user/baseinfo', |
|||
data: {}, |
|||
header: { |
|||
"Content-Type": "application/json", |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
that.setData({ |
|||
items2: res.data.response |
|||
}) |
|||
console.log(res.data.response) |
|||
}, |
|||
fail: function (res) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
complete: function (res) { }, |
|||
}) |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "个人中心" |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<view class='user-msg' wx:if='{{sessionId}}'> |
|||
<view class="userinfo"> |
|||
<image wx:if="{{imgUrl!=null}}" class="userinfo-avatar" src="{{imgUrl}}" background-size="cover"></image> |
|||
<image wx:else class="userinfo-avatar" src="{{userInfo.avatarUrl!=undefined?userInfo.avatarUrl:items2.headUrl}}" background-size="cover"></image> |
|||
<view class='detail-msg'> |
|||
<view class='title'>{{userInfo.nickName!=undefined?userInfo.nickName:items2.nickName}}</view> |
|||
<view></view> |
|||
<view></view> |
|||
<!-- <view class="userinfo-nickname">微信号:zgq9577</view> --> |
|||
<view class='userinfo-phone'>绑定手机:{{items2.mobile}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class='user-msg' wx:else> |
|||
<view class="userinfo"> |
|||
<view class='loginText'>登录一号家政,实现高端保洁</view> |
|||
<button class='loginBtn' bindtap='goLogin'>登录/注册</button> |
|||
</view> |
|||
</view> |
|||
<view wx:for-items="{{items}}"> |
|||
<view class='box top{{item.top}}' bindtap='go{{item.page}}'> |
|||
<image class="icon" src="{{item.img}}" mode='aspectFit'/> |
|||
<text class='text'>{{item.title}}</text> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,68 @@ |
|||
/* pages/mcenter/mcenter.wxss */ |
|||
.user-msg{ |
|||
background: #fff; |
|||
height: 130rpx; |
|||
margin-top: 10rpx; |
|||
padding: 45rpx 42rpx; |
|||
} |
|||
.userinfo-avatar { |
|||
width: 130rpx; |
|||
height: 130rpx; |
|||
border-radius: 50%; |
|||
} |
|||
.detail-msg{ |
|||
display: inline-block; |
|||
margin-left: 30rpx; |
|||
margin-top: 10px; |
|||
font-size: 26rpx; |
|||
color: #999999; |
|||
line-height: 40rpx; |
|||
vertical-align: top; |
|||
} |
|||
.title{ |
|||
font-size: 32rpx; |
|||
color:#333; |
|||
} |
|||
.loginText{ |
|||
width: 60%; |
|||
margin: 0 auto; |
|||
font-size: 28rpx; |
|||
margin-bottom: 36rpx; |
|||
text-align: center; |
|||
} |
|||
.loginBtn{ |
|||
color:#fff; |
|||
background: #1eba84; |
|||
border-radius: 5px; |
|||
text-align: center; |
|||
font-size: 24rpx; |
|||
height: 60rpx; |
|||
line-height: 60rpx; |
|||
width: 34%; |
|||
margin: 0 auto; |
|||
} |
|||
.box{ |
|||
height: 76rpx; |
|||
background: #fff; |
|||
padding: 34rpx 0 0 42rpx; |
|||
margin-top: 20rpx; |
|||
display: flex; |
|||
flex-direction: row; |
|||
} |
|||
.icon{ |
|||
width: 50rpx; |
|||
height: 50rpx; |
|||
margin-right: 21rpx; |
|||
} |
|||
.text{ |
|||
height: 50rpx; |
|||
line-height: 50rpx; |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.top20{ |
|||
margin-top: 20rpx; |
|||
} |
|||
.top1{ |
|||
margin-top: 1rpx; |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
data: { |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
goBack: function () { |
|||
wx.navigateBack() |
|||
}, |
|||
onLoad: function (option) { |
|||
let item = JSON.parse(option.jsonStr); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
item: item, |
|||
}) |
|||
console.log(item); |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "订单详情" |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
<!--pages/message/message.wxml--> |
|||
<view> |
|||
<view class='order-msg box'> |
|||
<view class='text'>订单编号:201700406115</view> |
|||
<view class='text'>下单时间:{{item.time}}</view> |
|||
<view wx:if="{{item.status==3}}" class='error-msg'> |
|||
<view class='error-title'>交易关闭</view> |
|||
<view class='error-text'>关闭原因:支付超时</view> |
|||
</view> |
|||
</view> |
|||
<view class='person-msg box'> |
|||
<image class="person-img" src="{{userInfo.avatarUrl}}" background-size="cover"></image> |
|||
<view class='person-detail'> |
|||
<view class='name'>方先生<text class='phone'>13557891546</text></view> |
|||
<view class='address'>广州市天河区东圃大马路时代TIT广场</view> |
|||
</view> |
|||
</view> |
|||
<view class='product-msg box'> |
|||
<view class='middle-msg' bindtap='lookDetail' data-item='{{item}}'> |
|||
<image class="product-img" src="{{item.img}}" background-size="cover"></image> |
|||
<view class='product-detail'> |
|||
<view class='title'>{{item.title}}</view> |
|||
<view class='intro'>{{item.intro}}</view> |
|||
</view> |
|||
</view> |
|||
<view class='line'></view> |
|||
<view class='alert'>订单备注:<text>无</text></view> |
|||
</view> |
|||
<view class='price-msg box'> |
|||
<view class='price-text'>订单价格:<text class='price'>¥{{item.price}}</text></view> |
|||
<view class='clear'></view> |
|||
<view class='line'></view> |
|||
<view class='price-text top'>实付款:<text class='price big'>¥{{item.price}}</text></view> |
|||
</view> |
|||
<button class='goBack' bindtap='goBack'>确认</button> |
|||
</view> |
|||
@ -0,0 +1,128 @@ |
|||
/* pages/message/message.wxss */ |
|||
.box{ |
|||
width: 100%; |
|||
background: #fff; |
|||
margin-top: 20rpx; |
|||
} |
|||
.order-msg{ |
|||
padding: 29rpx 0; |
|||
} |
|||
.text{ |
|||
color:#999; |
|||
font-size: 26rpx; |
|||
margin-bottom: 13rpx; |
|||
margin-left: 31rpx; |
|||
} |
|||
.error-msg{ |
|||
width: 682rpx; |
|||
height: 107rpx; |
|||
margin:0 31rpx; |
|||
background: #FFEEEE; |
|||
padding: 26rpx 0 0 30rpx; |
|||
} |
|||
.error-title{ |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.error-text{ |
|||
font-size: 28rpx; |
|||
color: #999; |
|||
margin-top: 14rpx; |
|||
} |
|||
.person-msg{ |
|||
height: 75rpx; |
|||
padding: 41rpx 0 38rpx 32rpx; |
|||
} |
|||
.person-img{ |
|||
width: 75rpx; |
|||
height: 75rpx; |
|||
border-radius: 50%; |
|||
overflow: hidden; |
|||
margin-right: 18rpx; |
|||
vertical-align: top; |
|||
} |
|||
.person-detail{ |
|||
display: inline-block; |
|||
} |
|||
.name{ |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.phone{ |
|||
margin-left:10rpx; |
|||
} |
|||
.address{ |
|||
font-size: 26rpx; |
|||
color:#999999; |
|||
margin-top: 5rpx; |
|||
} |
|||
.product-msg{ |
|||
height: 247rpx; |
|||
padding: 32rpx 0 0 30rpx; |
|||
} |
|||
.line{ |
|||
height: 1px; |
|||
background: #E5E5E5; |
|||
} |
|||
.product-img{ |
|||
width: 130rpx; |
|||
height: 130rpx; |
|||
margin-right: 27rpx; |
|||
margin-bottom: 20rpx; |
|||
border: 1px solid #E5E5E5; |
|||
} |
|||
.product-detail{ |
|||
display: inline-block; |
|||
vertical-align: top; |
|||
margin-top: 26rpx; |
|||
} |
|||
.title{ |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.intro{ |
|||
font-size: 28rpx; |
|||
color: #999; |
|||
margin-top: 14rpx; |
|||
} |
|||
.alert{ |
|||
font-size: 30rpx; |
|||
color: #999; |
|||
display: inline-block; |
|||
margin-top: 25rpx; |
|||
width: 90%; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
} |
|||
.price-msg{ |
|||
height: 201rpx; |
|||
padding: 47rpx 0 0 33rpx; |
|||
} |
|||
.price-text{ |
|||
color:#999; |
|||
font-size: 30rpx; |
|||
margin-bottom: 34rpx; |
|||
width: 682rpx; |
|||
} |
|||
.price{ |
|||
float: right; |
|||
font-size: 34rpx; |
|||
} |
|||
.clear{ |
|||
clear:both; |
|||
} |
|||
.big{ |
|||
font-size: 40rpx; |
|||
color:#E72D2D; |
|||
} |
|||
.top{ |
|||
margin-top: 35rpx; |
|||
} |
|||
.goBack{ |
|||
position: fixed; |
|||
bottom: 0rpx; |
|||
width: 100%; |
|||
color: #fff; |
|||
background: #E32424; |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
// pages/mypage/mypage.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1 @@ |
|||
{} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pages/mypage/mypage.wxml--> |
|||
<text>pages/mypage/mypage.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pages/mypage/mypage.wxss */ |
|||
@ -0,0 +1,270 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
data: { |
|||
items: [], |
|||
sessionId:'' |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
bindFocus: function () { |
|||
wx.navigateTo({ |
|||
title: "goback", |
|||
url: '../mcenter/mcenter' |
|||
}) |
|||
}, |
|||
lookDetail: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
// wx.navigateTo({
|
|||
// url: '../message/message?jsonStr=' + str
|
|||
// })
|
|||
console.log(str); |
|||
}, |
|||
goPay: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
// wx.navigateTo({
|
|||
// url: '../pay/pay?jsonStr=' + str
|
|||
// })
|
|||
console.log(str); |
|||
}, |
|||
goBooking: function (e) { |
|||
wx.navigateTo({ |
|||
url: '../two_code/two_code' |
|||
}) |
|||
}, |
|||
goCancel: function (e) { |
|||
let str = e.currentTarget.dataset.item; |
|||
let that = this; |
|||
wx.request({//取消订单
|
|||
url: app.gw.hostUrl + '/mall/wxa/order/cancel', |
|||
method: 'put', |
|||
data: { |
|||
orderNo: str.orderNo, |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
success: function (res) { |
|||
let data = res.data; |
|||
let status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
return; |
|||
} |
|||
wx.switchTab({ |
|||
url: '../order/order', |
|||
success: function (e) { |
|||
var page = getCurrentPages().pop(); |
|||
if (page == undefined || page == null) return; |
|||
console.log(page); |
|||
page.onLoad(); |
|||
} |
|||
}) |
|||
that.onPullDownRefresh() ; |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
}); |
|||
}, |
|||
goRefund: function (e) { |
|||
let str = e.currentTarget.dataset.item; |
|||
let that = this; |
|||
wx.request({//取消订单
|
|||
url: app.gw.hostUrl + '/mall/wxa/order/refund', |
|||
method: 'put', |
|||
data: { |
|||
orderNo: str.orderNo, |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded', |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
success: function (res) { |
|||
let data = res.data; |
|||
let status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
return; |
|||
} |
|||
wx.switchTab({ |
|||
url: '../order/order', |
|||
success: function (e) { |
|||
var page = getCurrentPages().pop(); |
|||
if (page == undefined || page == null) return; |
|||
console.log(page); |
|||
page.onShow(); |
|||
} |
|||
}) |
|||
that.onPullDownRefresh(); |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
}); |
|||
}, |
|||
onPullDownRefresh() { |
|||
console.log('--------下拉刷新-------') |
|||
let that = this; |
|||
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/wxa/order/list', |
|||
data: { status: '' }, |
|||
header: { |
|||
"Content-Type": "application/json", |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
that.setData({ |
|||
items: res.data.response |
|||
}) |
|||
}, |
|||
fail: function (res) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
complete: function (res) { |
|||
// complete
|
|||
wx.hideNavigationBarLoading() //完成停止加载
|
|||
wx.stopPullDownRefresh() //停止下拉刷新
|
|||
}, |
|||
}) |
|||
}, |
|||
rePay: function (e) { |
|||
let str = e.currentTarget.dataset.item; |
|||
wx.navigateTo({ |
|||
url: '../detail/detail?jsonStr=' + str |
|||
}) |
|||
console.log(str); |
|||
}, |
|||
goLogin: function (e) { |
|||
if (wx.getStorageSync('sessionId') == '') { |
|||
wx.navigateTo({ |
|||
url: '../login/login' |
|||
}) |
|||
}else{ |
|||
wx.switchTab({ |
|||
url: '../jz/jz' |
|||
}) |
|||
} |
|||
}, |
|||
onLoad: function () { |
|||
if(wx.getStorageSync('sessionId')==''){ |
|||
wx.navigateTo({ |
|||
url: '../login/login' |
|||
}) |
|||
}else{ |
|||
let that = this; |
|||
that.setData({ |
|||
sessionId: wx.getStorageSync('sessionId') |
|||
}) |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/wxa/order/list', |
|||
data: { status: '' }, |
|||
header: { |
|||
"Content-Type": "application/json", |
|||
'sessionId': wx.getStorageSync('sessionId') |
|||
}, |
|||
method: 'GET', |
|||
dataType: 'json', |
|||
responseType: 'text', |
|||
success: function (res) { |
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
that.setData({ |
|||
items: res.data.response |
|||
}) |
|||
}, |
|||
fail: function (res) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon:'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
complete: function (res) { }, |
|||
}) |
|||
} |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
console.log(app.globalData.userInfo); |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"navigationBarTitleText": "我的订单", |
|||
"enablePullDownRefresh": true, |
|||
"backgroundColor": "#26AE76" |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
<view wx:if="{{sessionId}}"> |
|||
<view wx:if="{{items!=[]}}"> |
|||
<view wx:for-items="{{items}}" > |
|||
<view class='box'> |
|||
<text class='time'>{{item.createAtStr}}</text> |
|||
<text class='price'>¥{{item.payPrice/100}}</text> |
|||
<view class='clear'></view> |
|||
<view class='line'></view> |
|||
<view class='middle-msg' bindtap='lookDetail' data-item='{{item}}'> |
|||
<image class="product-img" src="{{item.goodsImgUrl}}" background-size="cover"></image> |
|||
<view class='product-msg'> |
|||
<view class='title'>{{item.goodsName}}</view> |
|||
<!-- <view class='intro'>{{item.intro}}</view> --> |
|||
</view> |
|||
</view> |
|||
<view class='line'></view> |
|||
<view class='go-box' wx:if="{{item.status==0}}"> |
|||
<text class='status'>未付款</text> |
|||
<button class='booking' bindtap='goPay' data-item='{{item}}'>去付款</button> |
|||
<button class='booking gray' bindtap='goCancel' data-item='{{item}}'>取消订单</button> |
|||
</view> |
|||
<view class='go-box' wx:elif="{{item.status==10}}"> |
|||
<text class='status'>已付款</text> |
|||
<button class='booking' bindtap='goBooking'>去预约</button> |
|||
<button class='booking gray' bindtap='goRefund' data-item='{{item}}'>申请退款</button> |
|||
</view> |
|||
<view class='go-box' wx:elif="{{item.status==30||item.status==20}}"> |
|||
<text class='status'>{{item.status==30?'订单取消':'交易取消'}}</text> |
|||
<button class='booking' bindtap='rePay' data-item='{{item.goodsNo}}'>重新下单</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view class='user-msg'> |
|||
<view class="userinfo"> |
|||
<view class='loginText'>亲,您还没有下单呢!</view> |
|||
<button class='loginBtn' bindtap='goLogin'>立即下单</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view class='user-msg'> |
|||
<view class="userinfo"> |
|||
<view class='loginText'>亲,无法获取您的订单!</view> |
|||
<button class='loginBtn' bindtap='goLogin'>重新登录</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,123 @@ |
|||
/* pages/order/order.wxss */ |
|||
.box{ |
|||
height: 314rpx; |
|||
background: #fff; |
|||
margin-top: 20rpx; |
|||
padding: 29rpx 0 0 32rpx; |
|||
} |
|||
button::after{ |
|||
border: none; |
|||
} |
|||
.time{ |
|||
float: left; |
|||
font-size: 26rpx; |
|||
color: #999; |
|||
} |
|||
.price{ |
|||
float: right; |
|||
margin-right: 38rpx; |
|||
font-size: 34rpx; |
|||
color: #333; |
|||
margin-bottom: 10rpx; |
|||
vertical-align: middle; |
|||
} |
|||
.clear{ |
|||
clear:both; |
|||
} |
|||
.line{ |
|||
height: 1px; |
|||
background: #E5E5E5; |
|||
} |
|||
.middle-msg{ |
|||
padding: 15rpx 0 10rpx 0; |
|||
} |
|||
.product-img{ |
|||
width: 130rpx; |
|||
height: 130rpx; |
|||
margin-right: 27rpx; |
|||
border: 1px solid #E5E5E5; |
|||
} |
|||
.product-msg{ |
|||
display: inline-block; |
|||
vertical-align: top; |
|||
margin-top: 26rpx; |
|||
} |
|||
.title{ |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.intro{ |
|||
font-size: 28rpx; |
|||
color: #999; |
|||
margin-top: 14rpx; |
|||
} |
|||
.go-box{ |
|||
margin-top: 15rpx; |
|||
} |
|||
.status{ |
|||
font-size: 30rpx; |
|||
color: #999; |
|||
display: inline-block; |
|||
vertical-align: middle; |
|||
} |
|||
.booking{ |
|||
width: 200rpx; |
|||
height: 60rpx; |
|||
border:2rpx solid #26AE76; |
|||
border-radius: 4px; |
|||
text-align: center; |
|||
line-height: 56rpx; |
|||
display: inline-block; |
|||
color: #26AE76; |
|||
font-size: 32rpx; |
|||
background: #fff; |
|||
float: right; |
|||
margin-right: 36rpx; |
|||
} |
|||
.gray{ |
|||
border:2rpx solid #999; |
|||
color: #999; |
|||
} |
|||
/* 没有sessionId的时候登录 */ |
|||
.user-msg{ |
|||
background: #fff; |
|||
height: 130rpx; |
|||
margin-top: 10rpx; |
|||
padding: 45rpx 42rpx; |
|||
} |
|||
.userinfo-avatar { |
|||
width: 130rpx; |
|||
height: 130rpx; |
|||
border-radius: 50%; |
|||
} |
|||
.detail-msg{ |
|||
display: inline-block; |
|||
margin-left: 30rpx; |
|||
margin-top: 10px; |
|||
font-size: 26rpx; |
|||
color: #999999; |
|||
line-height: 40rpx; |
|||
vertical-align: top; |
|||
} |
|||
.title{ |
|||
font-size: 32rpx; |
|||
color:#333; |
|||
} |
|||
.loginText{ |
|||
width: 60%; |
|||
margin: 0 auto; |
|||
font-size: 28rpx; |
|||
margin-bottom: 36rpx; |
|||
text-align: center; |
|||
} |
|||
.loginBtn{ |
|||
color:#fff; |
|||
background: #1eba84; |
|||
border-radius: 5px; |
|||
text-align: center; |
|||
font-size: 24rpx; |
|||
height: 60rpx; |
|||
line-height: 60rpx; |
|||
width: 34%; |
|||
margin: 0 auto; |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
goUrl: app.gw.hostUrl +'/mall/mobile/#' |
|||
}, |
|||
onLoad: function (options) { |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1 @@ |
|||
{} |
|||
@ -0,0 +1 @@ |
|||
<web-view src="{{goUrl}}"></web-view> |
|||
@ -0,0 +1 @@ |
|||
/* pages/out/out.wxss */ |
|||
@ -0,0 +1,101 @@ |
|||
//index.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
// var total_micro_second = 30*60*1000;
|
|||
// var total_micro_second = 10 * 1000;
|
|||
function countdown(that) { |
|||
// 渲染倒计时时钟
|
|||
let clock = that.data.clock*1000; |
|||
that.setData({ |
|||
clockTime: dateformat(clock) |
|||
}); |
|||
|
|||
if (clock <= 1) { |
|||
that.setData({ |
|||
reminder: "支付时间已结束" |
|||
}); |
|||
// timeout则跳出递归
|
|||
clearTimeout(c); |
|||
return; |
|||
} |
|||
var c=setTimeout(function () { |
|||
clock -= 1000; |
|||
that.setData({ |
|||
clock: clock / 1000 |
|||
}); |
|||
console.log(clock); |
|||
countdown(that) |
|||
}, 1000); |
|||
} |
|||
|
|||
// 时间格式化输出,如3:25:19 86。每10ms都会调用一次
|
|||
function dateformat(micro_second) { |
|||
// 秒数
|
|||
var second = Math.floor(micro_second / 1000); |
|||
// 小时位
|
|||
var hr = Math.floor(second / 3600); |
|||
// 分钟位
|
|||
var min = Math.floor((second - hr * 3600) / 60); |
|||
// 秒位
|
|||
var sec = (second - hr * 3600 - min * 60);// equal to => var sec = second % 60;
|
|||
// 毫秒位,保留2位
|
|||
// var micro_sec = Math.floor((micro_second % 1000) / 10);
|
|||
return min + ":" + sec; |
|||
} |
|||
|
|||
Page({ |
|||
data: { |
|||
reminder:'确认支付' |
|||
}, |
|||
//事件处理函数
|
|||
pay: function (e) { |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
wx.navigateTo({ |
|||
url: '../pay/pay?jsonStr=' + str |
|||
}) |
|||
console.log(str); |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = JSON.parse(options.jsonStr); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
price: item.price, |
|||
title: item.name, |
|||
product: item, |
|||
clock: options.clock, |
|||
clockTime: dateformat(options.clock * 1000) |
|||
}) |
|||
countdown(this); |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "确认支付" |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
<view class="detail-msg"> |
|||
<view class='title'>{{product.name}}</view> |
|||
<view class='price'>¥{{product.price/100}}</view> |
|||
<view class='line'></view> |
|||
<view class='time-title'>剩余支付时间</view> |
|||
<view class='time-box'>{{clockTime}}</view> |
|||
</view> |
|||
<view class='btn-bg' wx:if="{{reminder=='支付时间已结束'}}"></view> |
|||
<button class='pay-btn'>{{reminder}}</button> |
|||
@ -0,0 +1,56 @@ |
|||
/* pages/pay/pay.wxss */ |
|||
.detail-msg{ |
|||
background: #fff; |
|||
margin-top: 10rpx; |
|||
width: 100%; |
|||
height: 436rpx; |
|||
text-align: center; |
|||
padding-top: 51rpx; |
|||
} |
|||
.title{ |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
} |
|||
.price{ |
|||
margin: 45rpx 0 29rpx; |
|||
font-size: 50rpx; |
|||
color: #E32424; |
|||
} |
|||
.line{ |
|||
height: 1px; |
|||
width: 70%; |
|||
background: #BFBFBF; |
|||
margin: 0 auto 45rpx; |
|||
} |
|||
.time-title{ |
|||
font-size: 28rpx; |
|||
color: #999999; |
|||
} |
|||
.time-box{ |
|||
width: 389rpx; |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
border: 1px solid #A0A0A0; |
|||
border-radius: 4px; |
|||
margin: 24rpx auto 0; |
|||
color:#333; |
|||
} |
|||
.pay-btn{ |
|||
width: 520rpx; |
|||
height: 90rpx; |
|||
border-radius:4px; |
|||
background: #E32424; |
|||
color: #fff; |
|||
margin: 60rpx auto 0; |
|||
} |
|||
.btn-bg{ |
|||
width: 520rpx; |
|||
height: 90rpx; |
|||
border-radius:4px; |
|||
background: rgba(255,255,255,0.6); |
|||
position: absolute; |
|||
margin-top: 60rpx; |
|||
z-index: 100; |
|||
margin-left:50%; |
|||
left:-258rpx; |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
}, |
|||
//事件处理函数
|
|||
bindFormSubmit: function (e) { |
|||
console.log(e.detail.value.textarea); |
|||
let str = JSON.stringify(e.currentTarget.dataset.item); |
|||
var pages = getCurrentPages(); |
|||
var currPage = pages[pages.length - 1]; //当前页面
|
|||
var prevPage = pages[pages.length - 2]; //上一个页面
|
|||
if (/[@#\$%\^&\*]+/g.test(e.detail.value.textarea)) { |
|||
wx.showToast({ |
|||
title: '备注中含有非法字符!', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
return; |
|||
} |
|||
prevPage.setData({ |
|||
remark: e.detail.value.textarea |
|||
}) |
|||
wx.navigateBack({ |
|||
url: '../create_order/create_order?jsonStr=' + str |
|||
}) |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = JSON.parse(options.jsonStr); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true, |
|||
product: item, |
|||
remark: options.remark, |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "服务需求备注" |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
<rich-text class='title'>填写服务需求</rich-text> |
|||
<form bindsubmit="bindFormSubmit" data-item='{{product}}'> |
|||
<textarea placeholder="请在此写下您的其他需求......" name="textarea" value='{{remark}}'/> |
|||
<button class='subBtn' form-type="submit"> 确定 </button> |
|||
</form> |
|||
@ -0,0 +1,40 @@ |
|||
page{ |
|||
font-family: PingFang-SC-Bold; |
|||
background: #F3F3F3; |
|||
box-sizing:border-box; |
|||
} |
|||
view{ |
|||
font-family: PingFang-SC-Bold; |
|||
border: 0; |
|||
font-size: 28rpx; |
|||
font: inherit; |
|||
vertical-align: baseline; |
|||
box-sizing:border-box; |
|||
} |
|||
textarea{ |
|||
font-family: PingFang-SC-Bold; |
|||
} |
|||
.title{ |
|||
color:#666; |
|||
font-size:30rpx; |
|||
padding-left: 20rpx; |
|||
margin: 40rpx 0; |
|||
display: inline-block; |
|||
} |
|||
textarea{ |
|||
background: #fff; |
|||
padding: 20rpx; |
|||
width: 100%; |
|||
margin: 0 auto 60rpx; |
|||
color: #333; |
|||
font-size:34rpx; |
|||
border:thin solid #eee; |
|||
} |
|||
.subBtn{ |
|||
width: 90%; |
|||
margin: 0 auto; |
|||
text-align: center; |
|||
color: #fff; |
|||
background: #1eba84; |
|||
border-radius:10rpx; |
|||
} |
|||
@ -0,0 +1,98 @@ |
|||
// pages/jz/jz.js
|
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
var WxParse = require('../../wxParse/wxParse.js');//主要为了能够显示获取的html代码
|
|||
|
|||
Page({ |
|||
data: { |
|||
items1: [], |
|||
}, |
|||
//事件处理函数
|
|||
bindViewTap: function () { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
onLoad: function (options) { |
|||
let item = options.jsonStr; |
|||
var that = this; |
|||
wx.request({ |
|||
url: app.gw.hostUrl + '/mall/web/goods/detail', |
|||
method: 'get', |
|||
data: { |
|||
goodsNo: item |
|||
}, |
|||
header: { |
|||
'Content-Type': 'application/x-www-form-urlencoded' |
|||
}, |
|||
success: function (res) { |
|||
//--init data
|
|||
var data = res.data; |
|||
var status = data.code; |
|||
if (status != 0) { |
|||
wx.showToast({ |
|||
title: data.msg, |
|||
icon: 'none', |
|||
duration: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
/** |
|||
* WxParse.wxParse(bindName , type, data, target,imagePadding) |
|||
* 1.bindName绑定的数据名(必填) |
|||
* 2.type可以为html或者md(必填) |
|||
* 3.data为传入的具体数据(必填) |
|||
* 4.target为Page对象,一般为this(必填) |
|||
* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选) |
|||
*/ |
|||
that.setData({ |
|||
product: data.response |
|||
}) |
|||
let serviceDesc = data.response.serviceDesc; |
|||
WxParse.wxParse('serviceDesc', 'html', serviceDesc, that, 5); |
|||
}, |
|||
fail: function (e) { |
|||
wx.showToast({ |
|||
title: '网络异常!err:authlogin', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
}, |
|||
}); |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
getUserInfo: function (e) { |
|||
console.log(e) |
|||
app.globalData.userInfo = e.detail.userInfo |
|||
this.setData({ |
|||
userInfo: e.detail.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "服务介绍" |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<import src="../../wxParse/wxParse.wxml"/> |
|||
|
|||
<view class="item-intro"> |
|||
<view class="intro-title">服务介绍</view> |
|||
<view class="global_focus intro-box"> |
|||
<template is="wxParse" data="{{wxParseData:serviceDesc.nodes}}"/> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,22 @@ |
|||
@import "../../wxParse/wxParse.wxss"; |
|||
|
|||
/*服务介绍*/ |
|||
.item-intro { |
|||
background: #FFF; |
|||
border-top: thin solid #eee; |
|||
} |
|||
.intro-title{ |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
font-size: 28rpx; |
|||
padding: 0 20rpx; |
|||
border-bottom: thin solid #eee; |
|||
} |
|||
.item-intro .intro-bd { |
|||
line-height: 50rpx; |
|||
font-size: 28rpx; |
|||
padding: 20rpx; |
|||
padding-bottom: 0px; |
|||
margin-left: 3%; |
|||
color: #F60; |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
//获取应用实例
|
|||
const app = getApp() |
|||
|
|||
|
|||
Page({ |
|||
data: { |
|||
showImg:'../../images/two_code.jpg' |
|||
}, |
|||
onLoad: function (options) { |
|||
if (app.globalData.userInfo) { |
|||
this.setData({ |
|||
userInfo: app.globalData.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} else if (this.data.canIUse) { |
|||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|||
// 所以此处加入 callback 以防止这种情况
|
|||
app.userInfoReadyCallback = res => { |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
} else { |
|||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|||
wx.getUserInfo({ |
|||
success: res => { |
|||
app.globalData.userInfo = res.userInfo |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
// goUrl: function (e) {
|
|||
// wx.navigateTo({
|
|||
// url: '../out/out'
|
|||
// })
|
|||
// },
|
|||
click: function () { |
|||
var that = this; |
|||
var show; |
|||
wx.scanCode({ |
|||
success: (res) => { |
|||
this.show = "--result:" + res.result + "--scanType:" + res.scanType + "--charSet:" + res.charSet + "--path:" + res.path; |
|||
that.setData({ |
|||
show: this.show |
|||
}) |
|||
wx.showToast({ |
|||
title: '成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
fail: (res) => { |
|||
wx.showToast({ |
|||
title: '失败', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
}, |
|||
complete: (res) => { |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "扫码预约" |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
<view class='container'> |
|||
<image src="{{showImg}}" mode='widthFill' bindtap="goUrl"></image> |
|||
</view> |
|||
<text class='text' selectable='true'>请关注"一号家政服务号"预约</text> |
|||
<view class='text'>若有疑问,请拨打4006080100联系客服</view> |
|||
@ -0,0 +1,18 @@ |
|||
page{ |
|||
background: #fff; |
|||
} |
|||
.container{ |
|||
padding: 80rpx 20% 0; |
|||
background: #fff; |
|||
} |
|||
.container image{ |
|||
width: 100%; |
|||
} |
|||
.text{ |
|||
margin-top:10rpx; |
|||
font-size:32rpx; |
|||
font-family: PingFang-SC-Bold; |
|||
text-align: center; |
|||
line-height: 60rpx; |
|||
display: block; |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
{ |
|||
"description": "项目配置文件。", |
|||
"setting": { |
|||
"urlCheck": true, |
|||
"es6": true, |
|||
"postcss": true, |
|||
"minified": true, |
|||
"newFeature": true |
|||
}, |
|||
"compileType": "miniprogram", |
|||
"libVersion": "1.9.94", |
|||
"appid": "wx2c28390f4f2c0888", |
|||
"projectname": "%E5%AE%B6%E6%94%BF%E5%B0%8F%E7%A8%8B%E5%BA%8F", |
|||
"condition": { |
|||
"search": { |
|||
"current": -1, |
|||
"list": [] |
|||
}, |
|||
"conversation": { |
|||
"current": -1, |
|||
"list": [] |
|||
}, |
|||
"game": { |
|||
"currentL": -1, |
|||
"list": [] |
|||
}, |
|||
"miniprogram": { |
|||
"current": -1, |
|||
"list": [] |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
const formatTime = date => { |
|||
const year = date.getFullYear() |
|||
const month = date.getMonth() + 1 |
|||
const day = date.getDate() |
|||
const hour = date.getHours() |
|||
const minute = date.getMinutes() |
|||
const second = date.getSeconds() |
|||
|
|||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') |
|||
} |
|||
|
|||
const formatNumber = n => { |
|||
n = n.toString() |
|||
return n[1] ? n : '0' + n |
|||
} |
|||
|
|||
module.exports = { |
|||
formatTime: formatTime |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save