From c234dffcd3adaf7b8d87a5a8301871493c0cadbd Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期四, 21 九月 2023 14:20:35 +0800
Subject: [PATCH] 修改皮重异常弹窗不正确弹出
---
pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue | 210 +++++++++++++++++++++++++++++-----------------------
1 files changed, 116 insertions(+), 94 deletions(-)
diff --git a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
index ab4c21c..e80422a 100644
--- a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
+++ b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
@@ -2,115 +2,137 @@
<!-- 娣诲姞璐т唬鎴栧徃鏈� -->
<view class="addTo-freightForwarder-drvier">
<view class="addForm">
- <u--form labelPosition="top" ref="form1">
- <u-form-item labelWidth="20%" label="濮撳悕" ref="item1"><u--input v-model="name" :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
- <u-form-item labelWidth="25%" label="鎵嬫満鍙�" ref="item1"><u--input v-model="phone" :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
- <u-form-item labelWidth="25%" label="姹借溅杞︾墝鍙�" ref="item1" v-if="role == 2">
- <u--input v-model="carNo" :customStyle="{ border: '1px solid #dddddd' }"></u--input>
+ <u--form labelPosition="top"
+ ref="form1">
+ <u-form-item labelWidth="20%"
+ label="濮撳悕"
+ ref="item1"><u--input v-model="name"
+ :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
+ <u-form-item labelWidth="25%"
+ label="鎵嬫満鍙�"
+ ref="item1"><u--input v-model="phone"
+ :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
+ <u-form-item labelWidth="25%"
+ label="姹借溅杞︾墝鍙�"
+ ref="item1"
+ v-if="role == 2">
+ <u--input v-model="carNo"
+ :customStyle="{ border: '1px solid #dddddd' }"></u--input>
</u-form-item>
</u--form>
</view>
- <view class="addBtn"><u-button text="閭�璇�" type="primary" @click="addToHuoDaiOrDriver"></u-button></view>
+ <view class="addBtn"><u-button text="閭�璇�"
+ type="primary"
+ @click="addToHuoDaiOrDriver"></u-button></view>
</view>
</template>
<script>
-import { customerId } from '@/utils/status.js';
-export default {
- onLoad(params) {
- this.role = params.role;
- if (params.fleetId) {
- this.fleetId = params.fleetId;
- }
- },
- data() {
- return {
- role: null, // 鍐冲畾娣诲姞璐т唬鍙告満锛岃繕鏄溅闃熷徃鏈�
- fleetId: null,
- name: '',
- phone: '',
- carNo: '',
- customerId
- };
- },
- methods: {
- init() {},
- addToHuoDaiOrDriver() {
- switch (this.role) {
- case '1':
- if (this.name == '' || this.phone == '') {
- uni.showToast({
- title: '璇疯鑼冭緭鍏ワ紒',
- icon: 'error',
- duration: 2000
- });
- } else {
- this.bindHuoDai();
- }
- break;
- case '2':
- if (this.name == '' || this.phone == '' || this.carNo == '') {
- uni.showToast({
- title: '璇疯鑼冭緭鍏ワ紒',
- icon: 'error',
- duration: 2000
- });
- } else {
- this.bindUserFleet();
- }
- default:
- break;
+ import { customerId } from '@/utils/status.js';
+ import { mapMutations } from 'vuex';
+ export default {
+ onLoad(params) {
+ this.role = params.role;
+ if (params.fleetId) {
+ this.fleetId = params.fleetId;
}
},
- // 閭�璇疯揣浠�
- bindHuoDai() {
- // this.$reqPost('bindHuoDai', { customerId: this.customerId, name: this.name, phone: this.phone }, 'params').then(res => {
- this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }).then(res => {
- if (res.code == 0) {
- this.$u.toast(res.msg ? res.msg : res.data);
- setTimeout(() => {
+ data() {
+ return {
+ role: null, // 鍐冲畾娣诲姞璐т唬鍙告満锛岃繕鏄溅闃熷徃鏈�
+ fleetId: null,
+ name: '',
+ phone: '',
+ carNo: '',
+ customerId
+ };
+ },
+ methods: {
+ ...mapMutations(['lengthchange']),
+ init() {},
+ addToHuoDaiOrDriver() {
+ switch (this.role) {
+ case '1':
+ if (this.name == '' || this.phone == '') {
+ uni.showToast({
+ title: '璇疯鑼冭緭鍏ワ紒',
+ icon: 'error',
+ duration: 2000
+ });
+ } else {
+ this.bindHuoDai();
+ }
+ break;
+ case '2':
+ if (this.name == '' || this.phone == '' || this.carNo == '') {
+ uni.showToast({
+ title: '璇疯鑼冭緭鍏ワ紒',
+ icon: 'error',
+ duration: 2000
+ });
+ } else {
+ this.bindUserFleet();
+ }
+ default:
+ break;
+ }
+ },
+ // 閭�璇疯揣浠�
+ bindHuoDai() {
+ // this.$reqPost('bindHuoDai', { customerId: this.customerId, name: this.name, phone: this.phone }, 'params').then(res => {
+ this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }, 'params').then(res => {
+ if (res.code == 0) {
+ this.$u.toast('娣诲姞鎴愬姛');
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 1000);
+ } else {
+ this.$u.toast(res.msg ? res.msg : '鏈垚鍔熸坊鍔�');
+ }
+ });
+ },
+ // 閭�璇峰徃鏈�
+ bindUserFleet() {
+ this.$reqPost('bindUserFleet', { fleetId: this.fleetId, name: this.name, phone: this.phone, carNo: this
+ .carNo }, 'params').then(res => {
+ console.log('閭�璇峰徃鏈�', res);
+ if (res.code == 0) {
+ this.$u.toast(res.msg ? res.msg : '鎿嶄綔鎴愬姛');
+ this.$reqGet('GetUserFleet', { fleetId: this.fleetId }).then(response => {
+ this.lengthchange(response.data.length);
+ });
uni.navigateBack({
delta: 1
});
- }, 1000);
- }
- console.log('閭�璇疯揣浠�', res);
- });
- },
- // 閭�璇峰徃鏈�
- bindUserFleet() {
- this.$reqPost('bindUserFleet', { fleetId: this.fleetId, name: this.name, phone: this.phone, carNo: this.carNo }, 'params').then(res => {
- console.log('閭�璇峰徃鏈�', res);
- if (res.code == 0) {
- this.$u.toast(res.data?res.data:'鎿嶄綔鎴愬姛');
- uni.navigateBack({
- delta: 1
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'null',
- duration: 2000
- });
- }
- });
+ } else {
+ uni.showToast({
+ title: res.msg ? res.msg : '鎿嶄綔澶辫触',
+ duration: 2000
+ });
+ }
+ });
+ }
}
- }
-};
+ };
</script>
-<style lang="scss" scoped>
-::v-deep.addTo-freightForwarder-drvier {
- width: 90%;
- margin: 0 auto;
- .addForm {
- margin: 0 auto;
- }
- .addBtn {
+<style lang="scss"
+ scoped>
+ ::v-deep.addTo-freightForwarder-drvier {
width: 90%;
- position: fixed;
- bottom: vww(48);
margin: 0 auto;
+
+ .addForm {
+ margin: 0 auto;
+ }
+
+ .addBtn {
+ width: 90%;
+ position: fixed;
+ bottom: vww(48);
+ margin: 0 auto;
+ }
}
-}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.1