first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/mall/chooseStores/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/mall/chooseStores/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
55e994aa-3e6e-4e57-add6-b95c5f4c3e24
|
||||
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 () {
|
||||
|
||||
}
|
||||
})
|
||||
4
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.json
Normal file
4
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {}
|
||||
}
|
||||
35
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.wxml
Normal file
35
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.wxml
Normal file
@@ -0,0 +1,35 @@
|
||||
<!-- 头部 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- user/address/address.wxml -->
|
||||
<view class="address">
|
||||
<form bindsubmit="subAdd">
|
||||
<view class="list_text pd30 mt20">
|
||||
<!-- <view class="text_row">
|
||||
<view class="text_row1 flex-con2">联系人</view>
|
||||
<view class="text_row2 flex-con2">
|
||||
<input name="name" type="text" value="" placeholder="请输入姓名" />
|
||||
</view>
|
||||
<view class="text_row3 flex-con3"></view>
|
||||
</view> -->
|
||||
<view class="text_row">
|
||||
<view class="text_row1 flex-con2">电话</view>
|
||||
<view class="text_row2 flex-con2">
|
||||
<input name="tel" type="text" value="{{tel}}" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view class="text_row3 flex-con3"></view>
|
||||
</view>
|
||||
<view class="text_row">
|
||||
<view class="text_row1 flex-con2">门店</view>
|
||||
<view class="text_row2 flex-con2" bind:tap="add">
|
||||
<span>{{store.address ||'请选择门店地址'}}</span>
|
||||
</view>
|
||||
<view class="text_row3 flex-con3" bind:tap="add">
|
||||
<image src="/static/img/icon/rthyrthertherth.png" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="sub" form-type="submit">确定</button>
|
||||
</form>
|
||||
</view>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
107
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.wxss
Normal file
107
衣莎项目/源码/YiShaXiYi/mall/chooseStores/chooseStores.wxss
Normal file
@@ -0,0 +1,107 @@
|
||||
/* user/address/address.wxss */
|
||||
.list_text{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.text_row{
|
||||
display: flex;
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
border-bottom: 2rpx solid #ebebeb;
|
||||
}
|
||||
.text_row1{
|
||||
flex: 2;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #333333;
|
||||
}
|
||||
.text_row2{
|
||||
padding-left: 15rpx;
|
||||
flex: 7;
|
||||
font-size: 32rpx;
|
||||
font-weight: normal;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #666666;
|
||||
}
|
||||
.text_row2 span{
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 32rpx;
|
||||
font-weight: normal;
|
||||
font-stretch: normal;
|
||||
letter-spacing: 0px;
|
||||
color: #cccccc;
|
||||
display: -webkit-box !important;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
.text_row3{
|
||||
flex: 1;
|
||||
}
|
||||
.text_row3 image{
|
||||
width: 15rpx;
|
||||
height: 33rpx;
|
||||
}
|
||||
.text_row:last-child{
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.label-1__text, .label-2__text {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
|
||||
}
|
||||
|
||||
.label-1__icon {
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background: #fcfff4;
|
||||
}
|
||||
|
||||
.label-1__icon-checked {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: #1aad19;
|
||||
}
|
||||
|
||||
.label-2__icon {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border:#ebebeb solid 2rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.label-2__icon-checked {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -6px 0 0 -6px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: #1aad19;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.label-4_text{
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
}
|
||||
1
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
553c5cd2-49fb-4a7f-8900-7368d4b6fe78
|
||||
220
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.js
Normal file
220
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.js
Normal file
@@ -0,0 +1,220 @@
|
||||
// mall/chooseStores/storesAdd/storesAdd.js
|
||||
const app = getApp();
|
||||
const regeneratorRuntime = app.loadAsync();
|
||||
const model = app.loadModel("index");
|
||||
const http = app.loadHttp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "选择门店", //头部标题
|
||||
isBack: true,//显示返回
|
||||
items: [{
|
||||
type: 'radio',
|
||||
label: '省',
|
||||
value: '省',
|
||||
checked: true,
|
||||
children: [],
|
||||
groups: ['001']
|
||||
}, {
|
||||
type: 'radio',
|
||||
label: '市',
|
||||
value: '市',
|
||||
checked: true,
|
||||
children: [],
|
||||
groups: ['002']
|
||||
}, {
|
||||
type: 'radio',
|
||||
label: '区',
|
||||
value: '区',
|
||||
checked: true,
|
||||
children: [],
|
||||
groups: ['003']
|
||||
}],
|
||||
storeList: [],//门店列表
|
||||
add: {
|
||||
provice: "",
|
||||
city: "",
|
||||
country: ""
|
||||
}
|
||||
},
|
||||
// 顶部选择
|
||||
onChange(e) {
|
||||
let that = this
|
||||
const { checkedItems, items, checkedValues } = e.detail
|
||||
console.log(checkedValues);
|
||||
|
||||
let params = {}
|
||||
checkedItems.forEach((n) => {
|
||||
if (n.checked) {
|
||||
if (n.value === '省') {
|
||||
that.setData({
|
||||
add: {
|
||||
provice: "",
|
||||
city: "",
|
||||
country: ""
|
||||
}
|
||||
})
|
||||
const selected = n.children.filter((n) => n.checked).map((n) => n.id).join(' ')
|
||||
params = {
|
||||
pid: selected,
|
||||
level: "city"
|
||||
}
|
||||
that.setData({
|
||||
"items[0].label": checkedValues[0],
|
||||
"items[1].label": "市",
|
||||
"items[2].label": "区",
|
||||
"add.provice": selected
|
||||
})
|
||||
} else if (n.value === '市') {
|
||||
const selected = n.children.filter((n) => n.checked).map((n) => n.id).join(' ')
|
||||
params = {
|
||||
pid: selected,
|
||||
level: "district",
|
||||
}
|
||||
that.setData({
|
||||
"items[1].label": checkedValues[1],
|
||||
"items[2].label": "区",
|
||||
"add.city": selected
|
||||
})
|
||||
} else if (n.value === '区') {
|
||||
const selected = n.children.filter((n) => n.checked).map((n) => n.id).join(' ')
|
||||
params = selected
|
||||
that.setData({
|
||||
"add.country": selected
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
if (!!params.pid) {
|
||||
this.getAdd(params)
|
||||
}
|
||||
this.getRepos(this.data.add)
|
||||
},
|
||||
// 获取列表
|
||||
async getRepos(data = {}) {
|
||||
let res = await http.http.request2({ url: `${http.api.shopAllList}`, method: "POST", data: data })
|
||||
let storeList = res.data.data
|
||||
storeList.map((v, i) => {
|
||||
storeList[i].show = false
|
||||
})
|
||||
this.setData({
|
||||
storeList: storeList
|
||||
})
|
||||
},
|
||||
// 点击选中
|
||||
async storeChange(e) {
|
||||
let index = e.currentTarget.dataset.index
|
||||
let storeList = this.data.storeList
|
||||
storeList.map((v, i) => {
|
||||
if (v.show) {
|
||||
storeList[i].show = false
|
||||
}
|
||||
if (i == index) {
|
||||
storeList[i].show = true
|
||||
}
|
||||
})
|
||||
this.setData({
|
||||
storeList: storeList
|
||||
})
|
||||
await model.storage.setStorage("store", storeList[index])
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
// 获取省市区
|
||||
async getAdd(params = { pid: 1, level: "province" }) {
|
||||
let res = await http.http.request2({ url: `${http.api.getDistrict}`, method: "POST", data: params })
|
||||
let rel = res.data.data
|
||||
let children = []
|
||||
|
||||
rel.map((v, i) => {
|
||||
let data = {}
|
||||
data.label = v.name
|
||||
data.value = v.name
|
||||
data.id = v.id
|
||||
children[i] = data
|
||||
})
|
||||
if (params.level == "province") {
|
||||
this.setData({
|
||||
'items[0].children': children
|
||||
})
|
||||
} else if (params.level == "city") {
|
||||
this.setData({
|
||||
'items[1].children': children
|
||||
})
|
||||
} else if (params.level == "district") {
|
||||
this.setData({
|
||||
'items[2].children': children
|
||||
})
|
||||
}
|
||||
},
|
||||
onOpen(e) {
|
||||
this.setData({ opened: true })
|
||||
},
|
||||
onClose(e) {
|
||||
this.setData({ opened: false })
|
||||
},
|
||||
/**
|
||||
* 阻止触摸移动
|
||||
*/
|
||||
noop() { },
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.getRepos()
|
||||
this.getAdd()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-filterbar":"../../../extend/wux/dist/filterbar/index"
|
||||
}
|
||||
}
|
||||
24
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.wxml
Normal file
24
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.wxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!-- 头部 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- mall/chooseStores/storesAdd/storesAdd.wxml -->
|
||||
<view class="storesAdd">
|
||||
<wux-filterbar items="{{ items }}" bindchange="onChange" bind:open="onOpen" bind:close="onClose" />
|
||||
<view class="addList">
|
||||
<view wx:for="{{ storeList }}" wx:key="{{index}}" class="flex-con2 add_row" data-index="{{index}}" bind:tap="storeChange">
|
||||
<view class="dis-flex flex1">
|
||||
<view class="flex1 dis-flex1">
|
||||
<view class="flex1 add_row_ts flex-con2">
|
||||
<image src="/static/img/icon/md.png" />
|
||||
<span>{{item.name}} {{item.telnum}}</span>
|
||||
</view>
|
||||
<view class="mt10 add_text">{{item.address}}</view>
|
||||
</view>
|
||||
<view class="add_row_img flex-con2 ml20">
|
||||
<image src="{{ item.show ? '/static/img/icon/smd1.png' : '/static/img/icon/smd.png' }}" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
33
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.wxss
Normal file
33
衣莎项目/源码/YiShaXiYi/mall/chooseStores/storesAdd/storesAdd.wxss
Normal file
@@ -0,0 +1,33 @@
|
||||
/* mall/chooseStores/storesAdd/storesAdd.wxss */
|
||||
.addList{
|
||||
margin-top: 20rpx;
|
||||
background-color: #ffffff;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.add_row{
|
||||
height: 165rpx;
|
||||
border-bottom: 2rpx solid #ebebeb;
|
||||
}
|
||||
.add_row:last-child{
|
||||
border-bottom:0;
|
||||
}
|
||||
.add_row_ts image{
|
||||
width: 32rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
.add_row_ts span{
|
||||
margin-left: 10rpx;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
.add_text{
|
||||
font-family: PingFang-SC-Regular;
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.add_row_img image{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user