Commit f9f5c36928ff29b692f1fc5f1dc3570ac884b855
1 parent
8a1c8e6dca
Exists in
master
and in
2 other branches
建档增加户籍地址
Showing 4 changed files with 248 additions and 0 deletions
littleApp_child/packageA/pages/editAddress/editAddress.js
View file @
f9f5c36
| 1 | +// packageA/pages/editAddress/editAddress.js | |
| 2 | +import { AreaPicker } from "../../../utils/areaSelector/selector.js" | |
| 3 | +import api from "../../../utils/apiFile.js"; | |
| 4 | +var networkUtil = require('../../../utils/network_util.js') | |
| 5 | +Page(Object.assign({}, AreaPicker,{ | |
| 6 | + data: { | |
| 7 | + currentAddress: {}, | |
| 8 | + babyAddress: '' | |
| 9 | + }, | |
| 10 | + onLoad: function (options) { | |
| 11 | + if (options.id) { | |
| 12 | + this.setData({ | |
| 13 | + id: options.id | |
| 14 | + }) | |
| 15 | + } | |
| 16 | + }, | |
| 17 | + onAreaCommit(locationList, e) {//当用户更换地区 | |
| 18 | + console.log('选择地址后', locationList) | |
| 19 | + var self = this; | |
| 20 | + self.addrInfo = { | |
| 21 | + province: locationList[0] || {}, | |
| 22 | + city: locationList[1] || {}, | |
| 23 | + area: locationList[2] || {}, | |
| 24 | + street: locationList[3] || {}, | |
| 25 | + } | |
| 26 | + var address = {} | |
| 27 | + address.details = '' | |
| 28 | + for (var i in locationList){ | |
| 29 | + address.details += locationList[i].name | |
| 30 | + } | |
| 31 | + address.addEntry = locationList | |
| 32 | + self.setData({ | |
| 33 | + isShow: 0, | |
| 34 | + currentAddress: address | |
| 35 | + }); | |
| 36 | + }, | |
| 37 | + bindKeyInput: function (e) { | |
| 38 | + console.log(e.detail.value) | |
| 39 | + this.data.babyAddress = e.detail.value | |
| 40 | + this.setData({ | |
| 41 | + babyAddress: this.data.babyAddress | |
| 42 | + }) | |
| 43 | + }, | |
| 44 | + onShow: function () {}, | |
| 45 | + submitData: function () { | |
| 46 | + if(!this.data.currentAddress.addEntry) { | |
| 47 | + wx.showToast({ | |
| 48 | + title: '请选择户籍地址', | |
| 49 | + icon: 'none', | |
| 50 | + duration: 2000 | |
| 51 | + }) | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + if(!this.data.babyAddress) { | |
| 55 | + wx.showToast({ | |
| 56 | + title: '请输入街道门牌', | |
| 57 | + icon: 'none', | |
| 58 | + duration: 2000 | |
| 59 | + }) | |
| 60 | + return; | |
| 61 | + } | |
| 62 | + let data = {}; | |
| 63 | + data.id = this.data.id; | |
| 64 | + if (this.data.currentAddress.addEntry) { | |
| 65 | + data.babyProvinceId = this.data.currentAddress.addEntry[0].id; | |
| 66 | + data.babyCityId = this.data.currentAddress.addEntry[1].id; | |
| 67 | + data.babyAreaId = this.data.currentAddress.addEntry[2].id; | |
| 68 | + data.babyStreetId = this.data.currentAddress.addEntry[3].id; | |
| 69 | + } | |
| 70 | + data.babyAddress = this.data.babyAddress; | |
| 71 | + networkUtil._get(api.editAddress,data, function(res) { | |
| 72 | + if(0 == res.data.errorcode){ | |
| 73 | + wx.showModal({ | |
| 74 | + title: '提示', | |
| 75 | + content: '修改成功!', | |
| 76 | + showCancel: false, | |
| 77 | + success (res) { | |
| 78 | + if (res.confirm) { | |
| 79 | + wx.reLaunch({url: '/pages/home/home'}) | |
| 80 | + } else if (res.cancel) { | |
| 81 | + console.log('用户点击取消') | |
| 82 | + } | |
| 83 | + } | |
| 84 | + }) | |
| 85 | + } | |
| 86 | + }, function(res) { | |
| 87 | + networkUtil.showErrorToast(res.errormsg) | |
| 88 | + }) | |
| 89 | + } | |
| 90 | +})) |
littleApp_child/packageA/pages/editAddress/editAddress.json
View file @
f9f5c36
littleApp_child/packageA/pages/editAddress/editAddress.wxml
View file @
f9f5c36
| 1 | +<!--packageA/pages/editAddress/editAddress.wxml--> | |
| 2 | +<view class="card"> | |
| 3 | + <view class="page-back"> | |
| 4 | + <view class="weui-cells"> | |
| 5 | + <view class="weui-cell"> | |
| 6 | + <view class="weui-cell__hd"> | |
| 7 | + <view class="weui-label line-tt"><text style="color:red">*</text>户籍地址</view> | |
| 8 | + </view> | |
| 9 | + <view class="weui-cell__bd"> | |
| 10 | + <view wx:if="{{!currentAddress.details}}" class="add_picker__text" style="font-size:14px;" bindtap="showAreaSelector" id="currentAddress" | |
| 11 | + data-name="currentAddress">请选择省市区(县)</view> | |
| 12 | + <view name="provinceCityArea" wx:if="{{currentAddress.details}}" style="font-size:14px;" class="add_picker__text" bindtap="showAreaSelector" | |
| 13 | + data-name="currentAddress">{{currentAddress.details}}</view> | |
| 14 | + </view> | |
| 15 | + </view> | |
| 16 | + <view class="weui-cell"> | |
| 17 | + <view class="weui-cell__hd"> | |
| 18 | + <view class="weui-label line-tt"><text style="color:red">*</text>街道门牌</view> | |
| 19 | + </view> | |
| 20 | + <view class="weui-cell__bd"> | |
| 21 | + <input bindinput="bindKeyInput" value="{{babyAddress}}" type="text" placeholder="输入街道门牌" /> | |
| 22 | + </view> | |
| 23 | + </view> | |
| 24 | + <view> | |
| 25 | + <button class="we_button archives" disabled="{{submiting}}" bindtap="submitData">提交</button> | |
| 26 | + </view> | |
| 27 | + </view> | |
| 28 | + </view> | |
| 29 | +</view> | |
| 30 | + <!--引入选择器布局--> | |
| 31 | +<include src="../../../utils/areaSelector/selector.wxml" /> |
littleApp_child/packageA/pages/editAddress/editAddress.wxss
View file @
f9f5c36
| 1 | +/* packageA/pages/editAddress/editAddress.wxss */ | |
| 2 | +/* pages/quickArchives /quickArchives .wxss */ | |
| 3 | +@import "../../../utils/areaSelector/selector.wxss"; | |
| 4 | +.page-back{ | |
| 5 | + height: 100vh; | |
| 6 | + width: 100%; | |
| 7 | + background: white; | |
| 8 | +} | |
| 9 | +.Warning{ | |
| 10 | + font-size: 14px; | |
| 11 | + padding-left: 10px; | |
| 12 | + color: #fff; | |
| 13 | + background-color: #ffc862; | |
| 14 | +} | |
| 15 | +.weui-cells{ | |
| 16 | + padding-right:15px; | |
| 17 | +} | |
| 18 | +.weui-cell{ | |
| 19 | + padding: 10px 0 10px 10px; | |
| 20 | +} | |
| 21 | +.page-tt{ | |
| 22 | + font-size: 18px; | |
| 23 | +} | |
| 24 | +.weui-cells{ | |
| 25 | + margin-top:0; | |
| 26 | +} | |
| 27 | +.weui-cell__ft{ | |
| 28 | + font-size: 14px; | |
| 29 | + color: #333; | |
| 30 | +} | |
| 31 | +.weui-label{ | |
| 32 | + display: block; | |
| 33 | + width: 120px!important; | |
| 34 | +} | |
| 35 | +.line-tt{ | |
| 36 | + padding-left: 5px; | |
| 37 | + color: #505050; | |
| 38 | + font-size: 14px; | |
| 39 | +} | |
| 40 | +.select-placeholder{ | |
| 41 | + color: #c0c0c0; | |
| 42 | + font-size: 14px; | |
| 43 | +} | |
| 44 | +.query-cell{ | |
| 45 | + background-color: #fff; | |
| 46 | + margin: 5px 0px 10px 0px; | |
| 47 | +} | |
| 48 | +.query_button { | |
| 49 | + margin-top:10px; | |
| 50 | + font: medium; | |
| 51 | + font-size: 16px; | |
| 52 | + color: #fff; | |
| 53 | + width: 30%; | |
| 54 | + height: 38px; | |
| 55 | + line-height: 38px; | |
| 56 | + border-radius: 9rpx; | |
| 57 | + background-color: #48C17B; | |
| 58 | + display: inline-block; | |
| 59 | + text-align: center; | |
| 60 | + margin-top: 3px; | |
| 61 | + align-items: center; | |
| 62 | + margin-left:3%; | |
| 63 | +} | |
| 64 | +.we_button { | |
| 65 | + margin-top:20px; | |
| 66 | + font: medium; | |
| 67 | + font-size: 16px; | |
| 68 | + color: white; | |
| 69 | + width: 60%; | |
| 70 | + margin-left:20%; | |
| 71 | + height: 38px; | |
| 72 | + line-height: 38px; | |
| 73 | + border-radius: 19px; | |
| 74 | + background-color: #48C17B; | |
| 75 | + display: inline-block; | |
| 76 | + text-align: center; | |
| 77 | + /* position: fixed; */ | |
| 78 | + position: fixed; | |
| 79 | + bottom: 20px; | |
| 80 | +} | |
| 81 | +.picker-view{ | |
| 82 | + font-size: 14px; | |
| 83 | +} | |
| 84 | +.radio-group{ | |
| 85 | + font-size: 14px; | |
| 86 | +} | |
| 87 | +.radio{ | |
| 88 | + width: 90px; | |
| 89 | + display: inline-block; | |
| 90 | +} | |
| 91 | +radio{ | |
| 92 | + transform:scale(0.8); | |
| 93 | +} | |
| 94 | +.pickerBox{ | |
| 95 | + position: fixed; | |
| 96 | + bottom: 0; | |
| 97 | + width: 100%; | |
| 98 | + z-index: 10; | |
| 99 | + background: #fff; | |
| 100 | +} | |
| 101 | +.pickerButBox{ | |
| 102 | + height: 38px; | |
| 103 | + line-height: 38px; | |
| 104 | + border-bottom: 1px solid #e7e7e7; | |
| 105 | + width: 100%; | |
| 106 | + background-color: #fff; | |
| 107 | +} | |
| 108 | +.pickerButText{ | |
| 109 | + font-size: 16px; | |
| 110 | + margin: 0 10px | |
| 111 | +} | |
| 112 | +.pickerButCencle{ | |
| 113 | + float: left; | |
| 114 | + color: #333; | |
| 115 | +} | |
| 116 | +.pickerButSub{ | |
| 117 | + float: right; | |
| 118 | + color: #48C17B; | |
| 119 | +} |