| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <template>
- <view class="container" v-if="info">
- <view class="title">成员基本信息</view>
- <view class="box">
- 手机
- <view class="box_input">
- <input type="number" maxlength="11" placeholder="请输入手机号码" v-model="info.userPhone" />
- </view>
- </view>
- <view class="box">
- 状态
- <picker @change="bindPickerChange" :value="index" range-key="name" :range="array">
- <view class="box_input">
- {{ array[index].name }}
- <img src="../../static/images/repairsImg/bottom.png" />
- </view>
- </picker>
- </view>
- <view class="box">
- 工种
- <picker @change="bindPickerChange2" :value="index2" range-key="name" :range="array2">
- <view class="box_input">
- {{ array2[index2].name }}
- <img src="../../static/images/repairsImg/bottom.png" />
- </view>
- </picker>
- </view>
- <view class="title">接单考核时间</view>
- <view class="box_time">
- <view class="time">
- <input type="text" v-model="info.acceptanceTime" />
- <img src="../../static/images/repairsImg/clock.png" />
- </view>
- 分钟
- </view>
- <view class="title">维修考核时间</view>
- <view class="box_time">
- <view class="time">
- <input type="text" v-model="info.maintenanceTime" />
- <img src="../../static/images/repairsImg/clock.png" />
- </view>
- 分钟
- </view>
- <!-- 提交按钮区域 -->
- <view class="btn" @click="handleSub">确认提交</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 状态数组
- array: [],
- // 状态数组当前索引
- index: 0,
- // 工种数组
- array2: [],
- // 工种数组当前索引
- index2: 0,
- info: null
- }
- },
- onLoad(options) {
- this.getStateList()
- this.getTypeList()
- this.info = JSON.parse(options.info)
- this.index = this.info.state - 1
- this.index2 = this.info.workType - 1
- },
- methods: {
- async getStateList() {
- const res = await this.$myRequest_repairs({
- url: '/repairWorkType/getReceivingState'
- })
- // console.log(res)
- if (res.code === '200') {
- this.array = res.data
- }
- },
- async getTypeList() {
- const res = await this.$myRequest_repairs({
- url: '/repairWorkType/getRepairWorkTypes'
- })
- // console.log(res)
- if (res.code === '200') {
- this.array2 = res.data
- }
- },
- // 确认提交按钮回调
- handleSub() {
- if (!this.info.userPhone) {
- uni.showToast({
- title: '请输入手机号码',
- icon: 'none'
- })
- return
- }
- const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/
- if (!rePhone.test(this.info.userPhone)) {
- uni.showToast({
- title: '手机号码格式有误',
- icon: 'none'
- })
- return
- }
- if (!this.info.acceptanceTime) {
- uni.showToast({
- title: '请输入接单考核时间',
- icon: 'none'
- })
- return
- }
- if (!this.info.maintenanceTime) {
- uni.showToast({
- title: '请输入维修考核时间',
- icon: 'none'
- })
- return
- }
- uni.showModal({
- title: '提示',
- content: '确认提交吗?',
- success: (res) => {
- if (res.confirm) {
- this.handleEdit()
- }
- }
- })
- },
- async handleEdit() {
- const res = await this.$myRequest_repairs({
- url: '/repairUser/updateAddressBook',
- method: 'post',
- data: {
- id: this.info.id,
- state: this.array[this.index].id,
- workType: this.array2[this.index2].id,
- acceptanceTime: this.info.acceptanceTime,
- maintenanceTime: this.info.maintenanceTime,
- phone: this.info.userPhone
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '编辑成功',
- icon: 'success'
- })
- setTimeout(() => {
- uni.redirectTo({
- url: '/pagesRepairs/box/box'
- })
- }, 1500)
- }
- },
- // 状态选择框选择回调
- bindPickerChange(e) {
- this.index = e.detail.value
- },
- // 工种选择框选择回调
- bindPickerChange2(e) {
- this.index2 = e.detail.value
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- box-sizing: border-box;
- padding: 0 30rpx;
- width: 100vw;
- height: 100vh;
- .title {
- display: flex;
- align-items: center;
- height: 112rpx;
- font-size: 36rpx;
- font-weight: bold;
- }
- .box {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
- height: 94rpx;
- color: #808080;
- font-size: 32rpx;
- .box_input {
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- margin-left: 33rpx;
- padding: 0 33rpx;
- width: 542rpx;
- height: 94rpx;
- color: #000000;
- border-radius: 10rpx;
- border: 1rpx solid #cccccc;
- input {
- width: 100%;
- height: 100%;
- }
- img {
- width: 54rpx;
- height: 54rpx;
- }
- }
- }
- .box_time {
- display: flex;
- align-items: center;
- height: 100rpx;
- font-size: 32rpx;
- font-weight: bold;
- .time {
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- padding: 0 23rpx;
- margin-right: 25rpx;
- width: 237rpx;
- height: 68rpx;
- font-weight: 400;
- border-radius: 4rpx;
- border: 1rpx solid #a6a6a6;
- input {
- flex: 1;
- }
- img {
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- .btn {
- position: absolute;
- bottom: 66rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- margin: auto;
- width: 690rpx;
- height: 100rpx;
- color: #fff;
- font-size: 32rpx;
- border-radius: 12rpx;
- background-color: #6fb6b8;
- }
- }
- </style>
|