From cfca75f6816e49a29571abe2386fe28fdf3d05d2 Mon Sep 17 00:00:00 2001 From: "geng.tang@qq.com" Date: Wed, 3 Jan 2024 12:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A1=AE=E8=AE=A4=E6=94=B6?= =?UTF-8?q?=E8=B4=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/captcha.js | 4 ++-- pages/order/delivery.vue | 45 ++++++++++++++++++++++++++-------------- websoft/api/captcha.js | 8 +++++++ 3 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 websoft/api/captcha.js diff --git a/api/captcha.js b/api/captcha.js index bd8659a..6d4c496 100755 --- a/api/captcha.js +++ b/api/captcha.js @@ -12,6 +12,6 @@ export function image() { } // 发送短信验证码 -export const sendSmsCaptcha = (data) => { - return request.post(api.sendSmsCaptcha, data) +export function sendSmsCaptcha(data) { + return request.post(api.sendSmsCaptcha, data, { load: false }) } \ No newline at end of file diff --git a/pages/order/delivery.vue b/pages/order/delivery.vue index ca3a714..16dda19 100755 --- a/pages/order/delivery.vue +++ b/pages/order/delivery.vue @@ -67,13 +67,16 @@ import { uploadFile } from '@/api/upload' + import { + http + } from '@/websoft/api/index.js' import { pageOrder, removeOrder, - receipt, + receiptOrder, getOrder } from '@/websoft/api/order.js' - import { sendSmsCaptcha } from '@/api/captcha.js' + import { sendSmsCaptcha } from '@/websoft/api/captcha.js' import { fileUrl } from '@/config.js' import { isMobile } from '@/utils/verify' @@ -181,10 +184,11 @@ }) return } + sendSmsCaptcha({ phone: that.receiptPhone, type: 'RECEIPT' - }).then(result => { + }).then(function (result) { console.log(result) if(result){ if(result.code == 0) { @@ -199,12 +203,9 @@ that.$toast(result.message) } } - }).catch(err => { - console.log('e2: ',err); + console.log('err: ',err); that.$toast(err.message) - }).finally(e => { - console.log('e3: ',e); }) }, @@ -247,20 +248,34 @@ }, */ // 表单提交 handleSubmit() { + // if(orderSourceData.length < 5) { + // return + // } + const that = this const app = this const { orderId,orderSourceData,captcha,receiptPhone,emergentUser,officeAddress, homeAddress } = app - if(orderSourceData.length < 5) { - return - } - receipt(app).then(result => { + + + receiptOrder({ + orderId: orderId, + orderSourceData: JSON.stringify(orderSourceData), + captcha: captcha, + receiptPhone: receiptPhone, + emergentUser: emergentUser, + officeAddress: officeAddress, + homeAddress: homeAddress + }).then(result => { if(result.code == 0) { - app.$success("上传成功") - uni.navigateBack() + that.$success("确认收货成功!") + // uni.navigateBack() + setTimeout(()=>{ + that.$navTo('pages/order/index',{}, 'redirectTo') + }, 1000) } else { - app.$toast(result.message) + that.$toast(result.message) } }).catch(err => { - app.$toast(err.message) + that.$toast(err.message) }) }, diff --git a/websoft/api/captcha.js b/websoft/api/captcha.js new file mode 100644 index 0000000..30ea45c --- /dev/null +++ b/websoft/api/captcha.js @@ -0,0 +1,8 @@ +import http from './index.js' + +// 发送短信验证码 +export const sendSmsCaptcha = (params) => http.post('sendSmsCaptcha', params) + +export default { + sendSmsCaptcha +} \ No newline at end of file