first commit
This commit is contained in:
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