From 73c3507d82c06066d592d626ccd1a9a0961e0c5f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 19 七月 2024 20:10:26 +0800
Subject: [PATCH] ''
---
wechat_jiaxuan/pages/design/design.js | 70 +++++++++++++++++++++++-----------
1 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/wechat_jiaxuan/pages/design/design.js b/wechat_jiaxuan/pages/design/design.js
index 0679de0..7ac7dd8 100644
--- a/wechat_jiaxuan/pages/design/design.js
+++ b/wechat_jiaxuan/pages/design/design.js
@@ -11,10 +11,15 @@
data: {
name: '',
phone: '',
- city: '',
showAreaList: false,
areaList: [],
+ addr: {},
+ fieldNames: {
+ text: 'name',
+ value: 'id',
+ children: 'children',
+ },
cascaderValue: '',
DESIGN_BANNER: '',
@@ -27,7 +32,8 @@
onSubmit() {
const {
name,
- phone
+ phone,
+ addr
} = this.data
if (!name) return wx.showToast({
title: '璇疯緭鍏ュ鍚�',
@@ -37,40 +43,58 @@
title: '璇疯緭鍏ヨ仈绯荤數璇�',
icon: 'none'
})
+ if (phone.length !== 11) return wx.showToast({
+ title: '璇疯緭鍏ユ纭殑鑱旂郴鐢佃瘽',
+ icon: 'none'
+ })
+ if (!addr.areaCode || !addr.cityCode) return wx.showToast({
+ title: '璇烽�夋嫨鍩庡競',
+ icon: 'none'
+ })
saveFreeCustomizationApply({
name,
- phone
+ phone,
+ ...addr
}).then(res => {
wx.showToast({
title: '鎶ュ悕鎴愬姛'
})
-
})
},
- // 鏄剧ず鍒囨崲鍩庡競寮圭獥
+ // 鏄剧ず鍩庡競寮圭獥
chooseCity () {
this.setData({ showAreaList: !this.data.showAreaList })
- console.log('chooseCity', chooseCity);
+ console.log('chooseCity', this.data.showAreaList);
},
- // 鍒囨崲鍩庡競
- confirmChange(e) {
- let {
- values
- } = e.detail
- let region = []
- for (let i in values) {
- region.push(values[i].name)
+ onFinish(e) {
+ const { selectedOptions, value } = e.detail;
+ const addr = {
+ provinceCode: selectedOptions[0].id,
+ provinceName: selectedOptions[0].name,
+ cityCode: selectedOptions[1].id,
+ cityName: selectedOptions[1].name,
+ areaCode: selectedOptions[2].id,
+ areaName: selectedOptions[2].name,
}
- this.setData({
- region,
- cityCode: values[1].code
- })
- this.getShopList()
- this.chooseCity()
+ this.setData({ addr, showAreaList: false })
+ console.log('selectedOptions', addr);
},
- onFinish() {
-
- },
+ // 鍒囨崲鍩庡競
+ // confirmChange(e) {
+ // let {
+ // values
+ // } = e.detail
+ // let region = []
+ // for (let i in values) {
+ // region.push(values[i].name)
+ // }
+ // this.setData({
+ // region,
+ // cityCode: values[1].code
+ // })
+ // this.getShopList()
+ // this.chooseCity()
+ // },
onClose() {
this.setData({ showAreaList: false })
},
--
Gitblit v1.9.3