From 9b1a32a3df7d54d19373551a3df34970d1a6a34f Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期六, 19 七月 2025 10:29:47 +0800 Subject: [PATCH] 调接口 --- small-program/pages/using-workers/using-workers.vue | 70 ++++++++++++++++++++++++++-------- 1 files changed, 53 insertions(+), 17 deletions(-) diff --git a/small-program/pages/using-workers/using-workers.vue b/small-program/pages/using-workers/using-workers.vue index 712b0e2..4be22fe 100644 --- a/small-program/pages/using-workers/using-workers.vue +++ b/small-program/pages/using-workers/using-workers.vue @@ -56,7 +56,7 @@ <view class="list-item-row-label">鍥剧墖</view> <view class="list-item-row-upload"> <view class="upload-item" v-for="(item, index) in form.multifileList" :key="index"> - <image :src="item.url" mode="widthFix"></image> + <image :src="item.url || item.fileurlFull" mode="widthFix"></image> <image class="upload-item-dele" @click="form.multifileList.splice(index, 1)" src="/static/icon/ic_delete1@2x.png" mode="widthFix"></image> </view> <view class="upload-item" @click="uploadImg"> @@ -155,6 +155,7 @@ show: false, show1: false, form: { + id: null, days: '', startDate: '', endDate: '', @@ -175,19 +176,34 @@ estimatedAccount: '', type: 0 }, + modify: false, cateList: [], viewStatus: false }; }, onLoad(option) { - this.form.linkPhone = this.userInfo.telephone - this.form.days = option.days - this.form.startDate = option.startDate - this.form.endDate = option.endDate - this.form.lat = option.latitude - this.form.lgt = option.longitude - this.form.location = option.address - this.form.workType = option.workType + // 缂栬緫 + if (option.id) { + this.form.id = option.id + this.$u.api.getDetail({ + orderId: option.id + }).then(res => { + for (const key in this.form) { + this.form[key] = res.data[key] + } + this.form.days = res.data.totalDays + this.form.price = Number(this.form.price) / 100 + }) + } else { + this.form.linkPhone = this.userInfo.telephone + this.form.days = option.days + this.form.startDate = option.startDate + this.form.endDate = option.endDate + this.form.lat = option.latitude + this.form.lgt = option.longitude + this.form.location = option.address + this.form.workType = option.workType + } this.getCateList() }, methods: { @@ -205,14 +221,33 @@ if (!this.form.linkPhone) { return uni.showToast({ title: '璇疯緭鍏ヨ仈绯荤數璇�', icon: 'none' }) } - this.$u.api.release({ ...this.form, price: Number(this.form.price) * 100 }) - .then(res => { - if (res.code == 200) { - uni.navigateTo({ - url: `/pages/success/success?orderId=${res.data.id}` - }) - } - }) + if (!this.form.id) { + this.$u.api.release({ ...this.form, price: Number(this.form.price) * 100 }) + .then(res => { + if (res.code == 200) { + uni.navigateTo({ + url: `/pages/success/success?orderId=${res.data.id}` + }) + } + }) + } else { + this.$u.api.updateOrder({ ...this.form, price: Number(this.form.price) * 100 }) + .then(res => { + if (res.code == 200) { + uni.showToast({ + title: '缂栬緫鎴愬姛', + icon: 'success', + mask: true, + duration: 2000 + }) + setTimeout(() => { + uni.navigateBack({ delta: 1 }); + uni.$emit('refresh') + }, 1500) + + } + }) + } }, // 璁$畻閲戦 getPrice() { @@ -225,6 +260,7 @@ type: this.form.type, workType: this.form.workType }).then(res => { + this.modify = true this.form.estimatedAccount = res.data }) } -- Gitblit v1.9.3