first commit
This commit is contained in:
141
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.js
Normal file
141
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.js
Normal file
@@ -0,0 +1,141 @@
|
||||
// user/address/address.js
|
||||
const app = getApp();
|
||||
const util = app.loadUtils("util");
|
||||
const regeneratorRuntime = app.loadAsync();
|
||||
const model = app.loadModel("index");
|
||||
const http = app.loadHttp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "门店地址选择", //头部标题
|
||||
isBack: true,//显示返回
|
||||
name: "",//收货人姓名
|
||||
tel: "",//收货人手机号
|
||||
store: {},//门店信息
|
||||
},
|
||||
// 选择门店地址的方法
|
||||
async add() {
|
||||
wx.navigateTo({
|
||||
url: "/mall/chooseStores/storesAdd/storesAdd"
|
||||
})
|
||||
},
|
||||
//
|
||||
async getUserTelNum(){
|
||||
let res = await http.http.request2({url:`${http.api.getUserTelNum}`, method:"POST"})
|
||||
this.setData({
|
||||
tel:res.data.data.telnum
|
||||
})
|
||||
},
|
||||
// 获取缓存中的门店信息
|
||||
async getStore() {
|
||||
let res = await model.storage.getSetting("store")
|
||||
if (!!res) {
|
||||
model.storage.deleteStorage('store')
|
||||
this.setData({
|
||||
store: res
|
||||
})
|
||||
}
|
||||
},
|
||||
// 选择并填写门店后返回上一页
|
||||
async subAdd(e) {
|
||||
let value = e.detail.value
|
||||
// if (value.name == "") {
|
||||
// model.msg.dataMsg({
|
||||
// content: "请输入联系人",
|
||||
// type: "warning"
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
if (value.tel == "") {
|
||||
model.msg.dataMsg({
|
||||
content: "请输入手机号",
|
||||
type: "warning"
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!(/^1[3456789]\d{9}$/.test(value.tel))) {
|
||||
model.msg.dataMsg({
|
||||
content: "请输入正确的手机号",
|
||||
type: "warning"
|
||||
})
|
||||
return false;
|
||||
}
|
||||
// if (!this.data.store.address) {
|
||||
// model.msg.dataMsg({
|
||||
// content: "请选择门店地址",
|
||||
// type: "warning"
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
let storeChange = {
|
||||
tel: value.tel,
|
||||
store: this.data.store
|
||||
}
|
||||
await model.storage.setStorage("storeChange", storeChange)
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
modify: options.modify
|
||||
})
|
||||
this.getUserTelNum()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
this.getStore()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user