123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <view class="detail-view">
- <u-form label-width="150" :model="add_form" ref="uForm">
- <view class="form-model-view">
- <u-form-item required label="选择司机" prop="shopName">
- <u-input @click="goPage('/pagesT/driver/driver')" class="dis-input" disabled
- v-model="add_form.driverName" placeholder="请选择" />
- <u-icon name="arrow-right" size="24" color="#6c6c6c"></u-icon>
- </u-form-item>
- <u-form-item required label="货车车牌">
- <u-input input-align="right" v-model="add_form.plateNumber" />
- </u-icon>
- </u-form-item>
- <u-form-item required label="货车电话">
- <u-input input-align="right" v-model="add_form.phone" />
- </u-icon>
- </u-form-item>
- <u-form-item label="备注" label-position="top">
- <u-input type="textarea" v-model="add_form.remark" />
- </u-form-item>
- </view>
- </u-form>
- <view class="submit-btn">
- <view class="btn-min" @click="submit">确定</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- add_form: {
- id: '',
- driverName: '',
- plateNumber: '',
- phone: '',
- remark: ''
- },
- driverData: '',
- sourceId: '',
- type: ''
- };
- },
- onLoad(options) {
- this.sourceId = options.sourceId
- this.type = options.type
- this.outId = options.outId
- this.getOrderInfoById()
- },
- watch: {
- driverData(val) {
- if (val) {
- this.add_form.driverName = val.driverName
- this.add_form.plateNumber = val.plateNumber
- this.add_form.phone = val.phone
- this.add_form.remark = val.remark
- this.add_form.id = val.id
- }
- }
- },
- methods: {
- getOrderInfoById() {
- this.$u.api.getOrderInfoById(1, {
- orderId: this.sourceId
- }).then(res => {
- if (res.data.logisticsData) {
- this.add_form.id = res.data.logisticsData.id
- this.add_form.plateNumber = res.data.logisticsData.truckName
- this.add_form.phone = res.data.logisticsData.truckTel
- this.add_form.driverName = res.data.logisticsData.name
- this.add_form.remark = res.data.logisticsData.remark
- }
- });
- },
- submit() {
- if (!this.add_form.driverName) {
- this.$u.toast('请选择司机');
- return;
- }
- if (this.type !== "5") {
- this.$u.api.inventoryOutAddLogistics({
- id: this.outId,
- driverId: this.add_form.id,
- driverName: this.add_form.driverName,
- truckName: this.add_form.plateNumber,
- truckTel: this.add_form.phone,
- remark: this.add_form.remark
- }).then(res => {
- this.$u.toast('添加成功');
- setTimeout(() => {
- uni.navigateBack();
- }, 500);
- })
- } else {
- this.$u.api.addLogistics({
- deliveryType: 3,
- logisticsData: {
- id: this.add_form.id,
- truckName: this.add_form.plateNumber,
- truckTel: this.add_form.phone,
- remark: this.add_form.remark,
- name: this.add_form.driverName,
- },
- deliveryNo: "",
- expressName: "",
- expressId: "",
- no: "",
- orderId: this.sourceId,
- }).then(res => {
- this.$u.toast('添加成功');
- setTimeout(() => {
- uni.navigateBack();
- }, 500);
- });
- }
- }
- }
- }
- </script>
- <style lang="scss">
- </style>
|