订单管理功能

This commit is contained in:
hongchao 2025-02-24 18:19:30 +08:00
parent 69655e9455
commit 82866ebd3a
5 changed files with 232 additions and 188 deletions

140
package-lock.json generated
View File

@ -24,8 +24,6 @@
"@dcloudio/uni-mp-xhs": "3.0.0-4020420240722002",
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002",
"@vant/area-data": "^2.0.0",
"@vue-office/docx": "^1.6.3",
"@vue-office/pdf": "^2.0.10",
"less": "^4.2.1",
"less-loader": "^12.2.0",
"lodash-es": "^4.17.21",
@ -33,9 +31,8 @@
"moment": "^2.30.1",
"pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^4.1.3",
"vant": "^4.9.10",
"vant": "^4.9.17",
"vue": "^3.4.21",
"vue-doc-preview": "^0.3.2",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
@ -4961,40 +4958,6 @@
"vue": "^3.0.0"
}
},
"node_modules/@vue-office/docx": {
"version": "1.6.3",
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue-office/docx/-/docx-1.6.3.tgz",
"integrity": "sha512-Cs+3CAaRBOWOiW4XAhTwwxJ0dy8cPIf6DqfNvYcD3YACiLwO4kuawLF2IAXxyijhbuOeoFsfvoVbOc16A/4bZA==",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
"@vue/composition-api": "^1.7.1",
"vue": "^2.0.0 || >=3.0.0",
"vue-demi": "^0.14.6"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vue-office/pdf": {
"version": "2.0.10",
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue-office/pdf/-/pdf-2.0.10.tgz",
"integrity": "sha512-yHVLrMAKpMPBkhBwofFyGEtEeJF0Zd7oGmf56Pe5aj/xObdRq3E1CIZqTqhWJNgHV8oLQqaX0vs4p5T1zq+GIA==",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
"@vue/composition-api": "^1.7.1",
"vue": "^2.0.0 || >=3.0.0",
"vue-demi": "^0.14.6"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vue/babel-helper-vue-transform-on": {
"version": "1.2.5",
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.2.5.tgz",
@ -5554,44 +5517,6 @@
"postcss": "^8.1.0"
}
},
"node_modules/axios": {
"version": "0.18.1",
"resolved": "https://repo.huaweicloud.com/repository/npm/axios/-/axios-0.18.1.tgz",
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
"deprecated": "Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410",
"license": "MIT",
"dependencies": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"node_modules/axios/node_modules/debug": {
"version": "3.1.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/axios/node_modules/follow-redirects": {
"version": "1.5.10",
"resolved": "https://repo.huaweicloud.com/repository/npm/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"license": "MIT",
"dependencies": {
"debug": "=3.1.0"
},
"engines": {
"node": ">=4.0"
}
},
"node_modules/axios/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/babel-jest": {
"version": "27.5.1",
"resolved": "https://repo.huaweicloud.com/repository/npm/babel-jest/-/babel-jest-27.5.1.tgz",
@ -7933,17 +7858,6 @@
"node": ">= 0.4"
}
},
"node_modules/highlight.js": {
"version": "9.18.5",
"resolved": "https://repo.huaweicloud.com/repository/npm/highlight.js/-/highlight.js-9.18.5.tgz",
"integrity": "sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA==",
"deprecated": "Support has ended for 9.x series. Upgrade to @latest",
"hasInstallScript": true,
"license": "BSD-3-Clause",
"engines": {
"node": "*"
}
},
"node_modules/hookable": {
"version": "5.5.3",
"resolved": "https://repo.huaweicloud.com/repository/npm/hookable/-/hookable-5.5.3.tgz",
@ -8231,29 +8145,6 @@
"node": ">=8"
}
},
"node_modules/is-buffer": {
"version": "2.0.5",
"resolved": "https://repo.huaweicloud.com/repository/npm/is-buffer/-/is-buffer-2.0.5.tgz",
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/is-core-module": {
"version": "2.16.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.16.0.tgz",
@ -9822,18 +9713,6 @@
"node": ">=4.0"
}
},
"node_modules/marked": {
"version": "0.4.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/marked/-/marked-0.4.0.tgz",
"integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==",
"license": "MIT",
"bin": {
"marked": "bin/marked"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/math-intrinsics": {
"version": "1.0.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/math-intrinsics/-/math-intrinsics-1.0.0.tgz",
@ -13006,9 +12885,9 @@
}
},
"node_modules/vant": {
"version": "4.9.10",
"resolved": "https://repo.huaweicloud.com/repository/npm/vant/-/vant-4.9.10.tgz",
"integrity": "sha512-N+QwOuhDxrH2f6+kN05ot6DHBvaM0e1lcoXVvf12rad2KnlybPQ9gjm0d+R+Nz/zydZbe3Fz6bwTssHItri0sw==",
"version": "4.9.17",
"resolved": "https://registry.npmmirror.com/vant/-/vant-4.9.17.tgz",
"integrity": "sha512-so/plH9G4au9rUrqy7yLB1slmZqY2Ub3Gq8ckMSQXbUEwTzmViVjEDqh/hNck/XELxwL+gIy2hLXiSgVcf2EBQ==",
"license": "MIT",
"dependencies": {
"@vant/popperjs": "^1.3.0",
@ -13196,17 +13075,6 @@
}
}
},
"node_modules/vue-doc-preview": {
"version": "0.3.2",
"resolved": "https://repo.huaweicloud.com/repository/npm/vue-doc-preview/-/vue-doc-preview-0.3.2.tgz",
"integrity": "sha512-1zRW/LOLpgtt+bdb4jRzsKfOngkJYzFJsKT0uH4/KqdUMVo7W8jhYUuVcllnw5mHVL/l4v3JESsqX+i8v3uhRw==",
"license": "MIT",
"dependencies": {
"axios": "^0.18.0",
"highlight.js": "^9.12.0",
"marked": "^0.4.0"
}
},
"node_modules/vue-eslint-parser": {
"version": "9.4.3",
"resolved": "https://repo.huaweicloud.com/repository/npm/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz",

View File

@ -65,7 +65,7 @@
"moment": "^2.30.1",
"pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^4.1.3",
"vant": "^4.9.10",
"vant": "^4.9.17",
"vue": "^3.4.21",
"vue-i18n": "^9.1.9"
},

View File

@ -59,13 +59,13 @@
</van-row>
</view>
</view>
<van-steps :active="currentActive" active-color="#07c160">
<van-step v-for="(item, index) in stepList" :key="index" :title="item.title" :desc="item.description" />
<!-- <van-step :title="getStepTitle(1)" :desc="getDescription(1)" />
<van-step :title="getStepTitle(2)" :desc="getDescription(2)" />
<van-step :title="getStepTitle(3)" :desc="getDescription(3)" />
<van-step :title="getStepTitle(4)" />
<van-step :title="getStepTitle(5)" /> -->
<van-steps :active="currentActive" active-color="#07c160" style="margin-bottom: 20rpx">
<van-step
v-for="(step, index) in stepList"
:key="index"
:title="step.title"
:desc="step.description"
/>
</van-steps>
<van-cell-group inset>
<TitleTip :title="`订单信息`" />
@ -89,7 +89,7 @@ import companyBg from '@/static/goods/company-bg.png'
import TitleTip from '@/components/TitleTip/index'
import { ref } from 'vue'
import { editOrderDetailsAPI, getOverhaulAPI } from '@/services/order/index.js'
import { showImagePreview, } from 'vant'
import { showImagePreview,Steps, Step } from 'vant'
import { onLoad } from '@dcloudio/uni-app'
const orderDetailsList = ref([])
const orderDetails = ref({})
@ -280,42 +280,22 @@ const getDescription = (desId) => {
onLoad(async (options) => {
const { data: res } = await editOrderDetailsAPI({ orderId: options?.orderId })
orderStatus.value = options?.orderStatus
if (orderStatus.value == 1) {
currentActive.value = 0
}
if (orderStatus.value == 2) {
currentActive.value = 1
stepList.value[0].title = '已接单'
}
if (orderStatus.value == 3) {
stepList.value[0].title = '已接单'
stepList.value[1].title = '已出库'
currentActive.value = 2
}
if (orderStatus.value == 4) {
stepList.value[0].title = '已接单'
stepList.value[1].title = '已出库'
stepList.value[2].title = '已收货'
currentActive.value = 3
}
if (orderStatus.value == 5) {
stepList.value[0].title = '已接单'
stepList.value[1].title = '已出库'
stepList.value[2].title = '已收货'
currentActive.value = 4
}
if (orderStatus.value == 20) {
stepList.value[0].title = '已接单'
stepList.value[1].title = '已出库'
stepList.value[2].title = '已收货'
stepList.value[3].title = '租赁结束'
currentActive.value = 5
}
console.log('xxxxxxxxxxx',orderStatus.value)
if (orderStatus.value == 99) {
currentActive.value = 6
stepList.value[6].title = '订单取消'
}
// if (orderStatus.value == 1) {
// currentActive.value = 0
// stepList.value = [
// {
// title: '',
// description: '',
// },
// {
// title: '',
// description: '',
// }
// ]
// }
console.log('xxxxxxxxxxx',stepList.value)
orderDetails.value = res
orderDetailsList.value = res.detailsList
@ -330,6 +310,7 @@ onLoad(async (options) => {
</script>
<style lang="scss" scoped>
/* 使用深度选择器确保样式生效 */
.order-details {
padding: 10px 0;
color: #333;
@ -417,4 +398,12 @@ onLoad(async (options) => {
margin-right: 8px;
}
}
.van-step__title {
color: #333 ; /* 设置文字颜色 */
display: block; /* 确保元素显示 */
}
.van-step__desc {
color: #333; /* 设置文字颜色 */
display: block; /* 确保元素显示 */
}
</style>

View File

@ -146,10 +146,10 @@
class="primary-lease"
style="margin-right: 6px"
v-if="
(item.orderStatus == 1 || item.orderStatus == 2) &&
(item.orderStatus == 1 ) &&
orderQueryParams.flag
"
@click.stop="onEditOrderStatus(item, parseInt(item.orderStatus))"
@click.stop="onEditOrderStatusTwo(item, parseInt(item.orderStatus))"
>
{{ initBtnText(item.orderStatus) }}
</van-button>
@ -159,7 +159,32 @@
class="primary-lease"
style="margin-right: 6px"
v-if="
(item.orderStatus == 3 || item.orderStatus == 4) &&
(item.orderStatus == 3)
"
@click.stop="onViewCode(item, parseInt(item.orderStatus))"
>
{{ "查看取件码" }}
</van-button>
<van-button
type="primary"
size="small"
class="primary-lease"
style="margin-right: 6px"
v-if="
(item.orderStatus == 3) &&
!orderQueryParams.flag
"
@click.stop="onSubmitCode(item, parseInt(item.orderStatus))"
>
{{ "确认收货" }}
</van-button>
<van-button
type="primary"
size="small"
class="primary-lease"
style="margin-right: 6px"
v-if="
(item.orderStatus == 4) &&
!orderQueryParams.flag
"
@click.stop="onEditOrderStatus(item, parseInt(item.orderStatus))"
@ -544,11 +569,45 @@
</van-button>
</view> -->
</van-popup>
<!-- 新增弹窗部分 -->
<van-popup v-model:show="showPickUpCode" position="center">
<div style="padding: 20px;">
<van-field
v-model="pickUpCode"
label="取件码"
placeholder="请输入取件码"
/>
<div style="display: flex; justify-content: flex-end; margin-top: 20px;">
<!-- <van-button type="primary" size="mini" @click="submitPickupCode(item)" style="margin-right: 10px;">提交</van-button> -->
<van-button size="mini" @click="showPickUpCode = false">关闭</van-button>
</div>
</div>
</van-popup>
<!-- 新增弹窗部分 -->
<van-popup v-model:show="showPickUpCodeTwo" position="center">
<div style="padding: 20px;">
<van-field
v-model="pickUpCodeForm.pickUpCode"
label="取件码"
placeholder="请输入取件码"
required
/>
<div style="display: flex; justify-content: flex-end; margin-top: 20px;">
<van-button type="primary" size="mini" @click="submitPickupCode" style="margin-right: 10px;">提交</van-button>
<van-button size="mini" @click="showPickUpCodeTwo = false">关闭</van-button>
</div>
</div>
</van-popup>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { ref,reactive } from 'vue'
import companyImg from '@/static/goods/company-img.png'
import companyBg from '@/static/goods/company-bg.png'
import UploadFile from '@/components/UploadFile'
@ -560,6 +619,7 @@ import {
editOrderDetailsAPI,
setAddLeaseRepairAPI,
getLeaseAgreementAPI,
getPickupCodeAPI,
} from '@/services/order/index.js'
import { showImagePreview } from 'vant'
const showBottom = ref(false)
@ -577,6 +637,53 @@ const orderQueryParams = ref({
code: '',
keyWord: '',
})
const pickUpCodeRef = ref(null);
const submitPickupCode = async () => {
try {
console.log("222222222222",pickUpCodeForm.value.pickUpCode)
if(pickUpCodeForm.value.pickUpCode==null || pickUpCodeForm.value.pickUpCode==''){
console.log('cvssssssssssssss')
showPickUpCodeTwo.value = false
setTimeout(() => {
uni.showToast({
title: '请输入取件码',
icon: 'none'
});
}, 100);
}else{
console.log("vvvvvvvvvvvvv",itemTemp)
const editParamsOne = {
orderId:itemTemp.value.orderId,
orderStatus: 4,
pickupCode:pickUpCodeForm.value.pickUpCode
}
const res = editOrderStatusAPI(editParamsOne)
showPickUpCodeTwo.value = false
console.log("bbbbbbbbbbbbb")
if (res.code === 200) {
showPickUpCodeTwo.value = false
console.log("yyyyyyyyyyy")
uni.showToast({
title: '收货成功',
icon: 'none'
});
getOrderListData()
}else{
console.log("cxxxxxxxcxxxxxxxxx")
showPickUpCodeTwo.value = false
uni.showToast({
title: res.msg,
icon: 'none'
});
}
}
//
// submitPickupCode(item);
} catch (error) {
console.log("gggggggggggg")
console.error('editOrderStatusAPI 报错:', error);
}
}
const submitParams = ref({
code: '',
@ -613,7 +720,7 @@ const tabList = ref([
{ tab_name: '已退租', order_status: 5 },
{ tab_name: '已完成', order_status: 20 },
{ tab_name: '已取消', order_status: 99 },
{ tab_name: '待出库', order_status: 2 },
// { tab_name: '', order_status: 2 },
{ tab_name: '待收货', order_status: 3 },
])
@ -749,10 +856,10 @@ const onReturnRepair = (item) => {
const initBtnText = (status) => {
if (status == 1) return '接单'
if (status == 2) return '出库'
// if (status == 2) return ''
}
const initLesseeBtnText = (status) => {
if (status == 3) return '确认收货'
// if (status == 3) return ''
if (status == 4) return '全部退租'
}
@ -782,6 +889,7 @@ const onEditOrderStatus = (item, status) => {
break
}
showConfirmDialog({
title: '提示',
message: `是否确定${tipText}`,
@ -796,6 +904,74 @@ const onEditOrderStatus = (item, status) => {
.catch(() => {})
}
const onEditOrderStatusTwo = (item, status) => {
const editParamsOne = {
orderId: item.orderId,
orderStatus: '2',
}
const editParamsTwo = {
orderId: item.orderId,
orderStatus: '3',
}
showConfirmDialog({
title: '提示',
message: `是否确定接单`,
})
.then(async () => {
const res = await editOrderStatusAPI(editParamsOne)
if (res.code === 200) {
const resTwo = await editOrderStatusAPI(editParamsTwo)
if(resTwo.code ===200){
showToast(`接单成功`)
getOrderListData()
}
}
})
.catch(() => {})
}
//
const showPickUpCode = ref(false);
//
const pickUpCode = ref('');
const onViewCode = async (item, status) => {
try {
pickUpCode.value = ''
//
const res = await getPickupCodeAPI({ orderId: item.orderId });
//
pickUpCode.value = res.data;
//
showPickUpCode.value = true;
} catch (error) {
console.error('获取取件码失败:', error);
}
};
const pickUpCodeForm = ref({ pickUpCode: '' }); // pickUpCodeForm
const showPickUpCodeTwo = ref(false);
const itemTemp = ref()
const statusTemp = ref()
const onSubmitCode = (item, status) => {
itemTemp.value = item
statusTemp.value = status
pickUpCodeForm.value.pickUpCode = ''
//
showPickUpCodeTwo.value = true;
};
//
const pickUpCodeRules = ref(
[
{
required: true,
message: '请输入取件码',
trigger: 'blur',
},
]
)
// 退
const onReturnGoods = (items, goods) => {
showConfirmDialog({

View File

@ -80,3 +80,14 @@ export const getLeaseAgreementAPI = (data) => {
data,
})
}
/**
* 订单 获取取件码
*/
export const getPickupCodeAPI = (data) => {
return http({
method: 'GET',
url: '/material-mall/order/getOrderCode',
data,
})
}