From 4eaf6d8835d4e9b204f13d012f13bbd8a94a21cc Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期日, 21 七月 2024 22:52:37 +0800
Subject: [PATCH] lll
---
wechat_jiaxuan/pages/design/design.js | 78 +++++++++++++++++++++++++++++---------
1 files changed, 59 insertions(+), 19 deletions(-)
diff --git a/wechat_jiaxuan/pages/design/design.js b/wechat_jiaxuan/pages/design/design.js
index 8b24073..7ac7dd8 100644
--- a/wechat_jiaxuan/pages/design/design.js
+++ b/wechat_jiaxuan/pages/design/design.js
@@ -1,5 +1,6 @@
import {
getDictData,
+ getArea,
saveFreeCustomizationApply
} from '../../api/index'
Page({
@@ -10,10 +11,17 @@
data: {
name: '',
phone: '',
- city: '',
showAreaList: false,
areaList: [],
+ addr: {},
+ fieldNames: {
+ text: 'name',
+ value: 'id',
+ children: 'children',
+ },
+ cascaderValue: '',
+
DESIGN_BANNER: '',
WechatIMG558: '',
},
@@ -24,7 +32,8 @@
onSubmit() {
const {
name,
- phone
+ phone,
+ addr
} = this.data
if (!name) return wx.showToast({
title: '璇疯緭鍏ュ鍚�',
@@ -34,37 +43,68 @@
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', 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);
+ },
+ // 鍒囨崲鍩庡競
+ // 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 })
},
initData() {
+ getArea({
+ "level": "",
+ "pid": ""
+ }).then(res => {
+ this.setData({areaList: res.data})
+ })
getDictData({
code: 'WEIXIN_DEFAULT_IMGS',
label: 'DESIGN_BANNER'
--
Gitblit v1.9.3