feat: 预售订单接口对接

This commit is contained in:
lzhizhao 2025-06-05 16:10:10 +08:00
parent 63dc65eafb
commit 1314bdb200
2 changed files with 486 additions and 346 deletions

View File

@ -81,7 +81,7 @@
v-for="item in [ v-for="item in [
{ label: '全部', value: '0' }, { label: '全部', value: '0' },
{ label: '快递', value: '1' }, { label: '快递', value: '1' },
{ label: '自提', value: '2' }, { label: '自提', value: '2' }
]" ]"
:key="item.marketId" :key="item.marketId"
:label="item.marketName" :label="item.marketName"
@ -121,389 +121,260 @@
</template> </template>
<script> <script>
import { mapState } from "vuex"; import { mapState } from 'vuex'
import viewDetails from "./popup/view-details.vue"; import viewDetails from './popup/view-details.vue'
export default { export default {
components: { viewDetails }, components: { viewDetails },
data() { data() {
return { return {
value1: "", value1: '',
activeName: "5", activeName: '5',
advanceSellStatus: "", advanceSellStatus: '',
dataList: [], dataList: [],
formInline: { formInline: {
name: "", name: '',
marketId: "", marketId: '',
shopId: "", shopId: ''
}, },
tableProp: { tableProp: {
"auto-resize": true, 'auto-resize': true,
border: true, border: true,
height: "auto", height: 'auto',
"row-id": "id", 'row-id': 'advanceSellId',
"show-overflow": false, 'show-overflow': false
}, },
statusList: [ statusList: [
{ {
label: "全部", label: '全部',
value: "5", value: '5'
}, },
{ {
label: "代付定金", label: '代付定金',
value: "0", value: '0'
}, },
{ {
label: "代付尾款", label: '代付尾款',
value: "1", value: '1'
}, },
{ {
label: "待发货", label: '待发货',
value: "2", value: '2'
}, },
{ {
label: "待收货", label: '待收货',
value: "3", value: '3'
}, },
{ {
label: "待评价", label: '待评价',
value: "4", value: '4'
}, },
{ {
label: "已完成", label: '已完成',
value: "6", value: '6'
}, },
{ {
label: "已取消", label: '已取消',
value: "7", value: '7'
}, },
{ {
label: "交易关闭", label: '交易关闭',
value: "8", value: '8'
}, }
], ],
productFilterType: "SALE", productFilterType: 'SALE',
selectList: [], selectList: []
}; }
}, },
created() { created() {
this.formInline = { this.formInline = {
marketId: this.marketId, marketId: this.marketId,
shopId: this.shopId, shopId: this.shopId
}; }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.oTable.reload(); this.$refs.oTable.reload()
}); })
}, },
methods: { methods: {
addProduct() { addProduct() {
this.$refs.addOrUpdate.toggle().add(); this.$refs.addOrUpdate.toggle().add()
}, },
queryList(pageNo, pageSize) { queryList(pageNo, pageSize) {
let res = { // let res = {
data: [ // data: [],
{ // total: 0
advanceSellId: "1870015398464876544", // }
advanceSellStatus: 1, // setTimeout(() => {
balancePaymentEndTime: "2024-12-28 00:00:00", // this.$refs.oTable.complete(res.data, Number(res.total))
balancePaymentStartTime: "2024-12-25 00:00:00", // }, 1000)
brandId: null, this.$api.preSale
collectionNum: null, .preSaleProducts({
description: "好吃的苹果", pageNumber: pageNo,
discountActivity: null, pageSize: pageSize,
endTime: "2024-12-25 00:00:00", ...this.formInline,
estimatedEndDeliveryTime: "2025-01-03 00:00:00", advanceSellStatus: this.advanceSellStatus,
estimatedStartDeliveryTime: "2024-12-31 00:00:00", merchantId: JSON.parse(sessionStorage.getItem('userInfo')).merchantId,
favoriteNum: null, productQuerySortParam: []
id: "1869660245152923648", })
isAdvanceSell: 1, .then(res => {
isDiscount: null, console.log(res)
isRefundEarnestMoney: 1, this.$refs.oTable.complete(
keywords: null, res.data.data.data,
marketId: "1844393110392221696", Number(res.data.data.total)
maxCostPrice: 10, )
maxMarketPrice: 20, })
maxSalePrice: 20, .catch(err => {
merchantId: "1844397348581253120", this.$refs.oTable.complete(false)
minCostPrice: 5, })
minMarketPrice: 10,
minSalePrice: 10,
name: "苹果",
otherAttribute: "[]",
productAttributeList: [
{
attributeName: "重量",
attributeValue: "10斤,20斤",
id: "1869660245454913536",
productId: "1869660245152923648",
},
],
productCategoryId: "31",
productIntroducePhoto: "",
productPhotoList: [
{
id: "1869660245391998976",
isMain: 1,
productId: "1869660245152923648",
sort: null,
url: "https://dmjs.obs.cn-east-3.myhuaweicloud.com/hhsh/20241219/90cb416e636b4e1f99f47e458d0a0fc8.jpg",
},
],
productPlace: "山西省-太原市-小店区",
productSpecificationList: [
{
advanceSellStockNum: 40,
attributeJson:
'[{"attributeName":"重量","attributeValue":"10斤"}]',
attributeList: [
{
attributeName: "重量",
attributeValue: "10斤",
},
],
attributeValue: "10斤",
balancePayment: 3,
costPrice: 5,
earnestMoney: 6,
id: "1869660245517828096",
isAdvanceSell: 1,
isDiscount: null,
isRecommend: 0,
isRecommendIndex: null,
limitCount: 2147483647,
marketPrice: 10,
presalePrice: 9,
productId: "1869660245152923648",
saleNum: 0,
salePrice: 10,
stockNum: 234,
virtualSaleNum: null,
volume: 2,
warnAdvanceSellStockNum: null,
warnStockNum: 50,
weight: 5,
},
{
advanceSellStockNum: 40,
attributeJson:
'[{"attributeName":"重量","attributeValue":"20斤"}]',
attributeList: [
{
attributeName: "重量",
attributeValue: "20斤",
},
],
attributeValue: "20斤",
balancePayment: 7,
costPrice: 10,
earnestMoney: 8,
id: "1869660245517828097",
isAdvanceSell: 1,
isDiscount: null,
isRecommend: 0,
isRecommendIndex: null,
limitCount: 2147483647,
marketPrice: 20,
presalePrice: 15,
productId: "1869660245152923648",
saleNum: 0,
salePrice: 20,
stockNum: 324,
virtualSaleNum: null,
volume: 4,
warnAdvanceSellStockNum: null,
warnStockNum: 50,
weight: 10,
},
],
productUnit: "盒",
productVideo: "",
saleNum: 0,
salePrice: 10,
shelfLife: 60,
shopId: "1844397348614807552",
sort: 999,
specType: 1,
startTime: "2024-12-20 00:00:00",
status: "UP",
stockNum: 558,
tags: null,
volume: 3,
weight: 7.5,
},
],
total: "1",
};
setTimeout(() => {
this.$refs.oTable.complete(res.data, Number(res.total));
}, 1000);
// this.$api.preSale
// .preSaleProducts({
// pageNumber: pageNo,
// pageSize: pageSize,
// ...this.formInline,
// advanceSellStatus: this.advanceSellStatus,
// merchantId: JSON.parse(sessionStorage.getItem("userInfo")).merchantId,
// productQuerySortParam: [],
// })
// .then((res) => {
// console.log(res);
// this.$refs.oTable.complete(
// res.data.data.data,
// Number(res.data.data.total)
// );
// })
// .catch((err) => {
// this.$refs.oTable.complete(false);
// });
}, },
Reset() { Reset() {
this.formInline = { this.formInline = {
name: "", name: '',
marketId: this.marketId, marketId: this.marketId,
shopId: this.shopId, shopId: this.shopId
}; }
this.$refs.oTable.reload(); this.$refs.oTable.reload()
}, },
handleClick(e) { handleClick(e) {
console.log(e.name); console.log(e.name)
if (e.name == "5") { if (e.name == '5') {
this.advanceSellStatus = ""; this.advanceSellStatus = ''
} else { } else {
this.advanceSellStatus = e.name; this.advanceSellStatus = e.name
} }
this.$refs.oTable.reload(); this.$refs.oTable.reload()
}, }
}, },
computed: { computed: {
tableCols() { tableCols() {
return [ return [
// { type: "checkbox", width: "60px", fixed: "left" }, // { type: "checkbox", width: "60px", fixed: "left" },
{ {
type: "seq", type: 'seq',
fixed: "left", fixed: 'left',
width: "60px", width: '60px',
align: "center", align: 'center',
title: "序号", title: '序号'
}, },
{ {
title: "订单号", title: '订单号',
align: "center", align: 'center',
field: "id", field: 'id'
}, },
{ {
title: "订单商品", title: '订单商品',
field: "productPhotoList", field: 'productPhotoList',
align: "center", align: 'center',
width: "80px", width: '80px',
type: "jsx", type: 'jsx',
render: ({ row }) => { render: ({ row }) => {
if (row.productPhotoList.length > 0) { if (row.productPhotoList.length > 0) {
return ( return (
<el-image <el-image
preview-src-list={row.productPhotoList.map((item) => { preview-src-list={row.productPhotoList.map(item => {
return item.url; return item.url
})} })}
src={row.productPhotoList[0].url} src={row.productPhotoList[0].url}
></el-image> ></el-image>
); )
} else { } else {
return <span>暂无商品图</span>; return <span>暂无商品图</span>
} }
}, }
}, },
{ {
title: "商品名称", title: '商品名称',
align: "center", align: 'center',
field: "name", field: 'name'
}, },
{ {
title: "规格/数量", title: '规格/数量',
align: "center", align: 'center',
field: "name", field: 'name'
}, },
{ {
title: "定金支付时间", title: '定金支付时间',
align: "center", align: 'center',
field: "startTime", field: 'startTime',
type: "jsx", type: 'jsx',
render: ({ row }) => { render: ({ row }) => {
return ( return (
<span> <span>
{row.startTime}{row.endTime} {row.startTime}{row.endTime}
</span> </span>
); )
}, }
}, },
{ {
title: "尾款支付时间", title: '尾款支付时间',
align: "center", align: 'center',
field: "minSalePrice", field: 'minSalePrice',
type: "jsx", type: 'jsx',
render: ({ row }) => { render: ({ row }) => {
return ( return (
<span> <span>
{row.balancePaymentStartTime}{row.balancePaymentEndTime} {row.balancePaymentStartTime}{row.balancePaymentEndTime}
</span> </span>
); )
}, }
}, },
{ {
title: "状态", title: '状态',
align: "center", align: 'center',
field: "status", field: 'status',
type: "jsx", type: 'jsx',
render: ({ row }) => { render: ({ row }) => {
if (row.advanceSellStatus == "0") { if (row.advanceSellStatus == '0') {
return <span>未开始</span>; return <span>未开始</span>
} else if (row.advanceSellStatus == "1") { } else if (row.advanceSellStatus == '1') {
return <span>进行中</span>; return <span>进行中</span>
} else if (row.advanceSellStatus == "2") { } else if (row.advanceSellStatus == '2') {
return <span>已结束</span>; return <span>已结束</span>
} else if (row.advanceSellStatus == "3") { } else if (row.advanceSellStatus == '3') {
return <span>已关闭</span>; return <span>已关闭</span>
} }
}, }
}, },
{ {
title: "操作", title: '操作',
fixed: "right", fixed: 'right',
type: "jsx", type: 'jsx',
align: "center", align: 'center',
width: "100px", width: '100px',
render: ({ row }) => { render: ({ row }) => {
let details = () => { let details = () => {
this.$refs.viewDetails.toggle(row).update(); this.$refs.viewDetails.toggle(row).update()
}; }
return ( return (
<div> <div>
<el-button size="mini" type="primary" onClick={details}> <el-button size="mini" type="primary" onClick={details}>
查看 查看
</el-button> </el-button>
</div> </div>
); )
}, }
}, }
]; ]
}, },
tableEvent() { tableEvent() {
return { return {
"checkbox-all": ({ records, reserves }) => { 'checkbox-all': ({ records, reserves }) => {
this.selectList = [...records, ...reserves]; this.selectList = [...records, ...reserves]
}, },
"checkbox-change": ({ records, reserves }) => { 'checkbox-change': ({ records, reserves }) => {
this.selectList = [...records, ...reserves]; this.selectList = [...records, ...reserves]
}, }
}; }
}, },
...mapState("userData", [ ...mapState('userData', [
"isMerchant", 'isMerchant',
"marketList", 'marketList',
"storeList", 'storeList',
"marketId", 'marketId',
"shopId", 'shopId'
]), ])
}, }
}; }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -10,114 +10,383 @@
<div slot="dialog__content"> <div slot="dialog__content">
<el-form <el-form
:model="ruleForm" :model="ruleForm"
:rules="rules"
ref="ruleForm" ref="ruleForm"
label-width="150px" label-width="150px"
class="demo-ruleForm" class="demo-ruleForm"
> >
<!-- <el-form-item label="预售剩余库存:" prop="name"> <el-row>
<span style="font-size: 20px; margin-right: 20px"></span> <el-col :span="12">
<el-input-number <el-form-item label="订金支付时间:" prop="startTime">
v-model="ruleForm.name" <el-date-picker
:min="1" @change="getOrderTime"
:max="9999" format="yyyy-MM-dd HH:mm"
:precision="0" data-format="yyyy-MM-dd HH:mm"
:step="1" :disabled="true"
label="请输入数量" value-format="yyyy-MM-dd HH:mm:ss"
></el-input-number> v-model="orderTime"
<span style="font-size: 20px; margin-left: 14px">时通知我</span> type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:editable="false"
>
</el-date-picker> </el-form-item
></el-col>
<el-col :span="12">
<el-form-item
label="尾款支付时间:"
prop="balancePaymentStartTime"
>
<el-date-picker
@change="getArrearsTime"
format="yyyy-MM-dd HH:mm"
data-format="yyyy-MM-dd HH:mm"
:disabled="true"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="arrears"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
>
</el-date-picker> </el-form-item
></el-col>
</el-row>
<el-form-item
label="预计发货时间:"
prop="estimatedStartDeliveryTime"
>
<el-date-picker
format="yyyy-MM-dd HH:mm"
data-format="yyyy-MM-dd HH:mm"
:disabled="true"
value-format="yyyy-MM-dd HH:mm:ss"
@change="deliveryTime"
v-model="delivery"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="通知方式:" prop="value"> <el-form-item label="定金可退:" prop="isRefundEarnestMoney">
<el-radio v-model="ruleForm.value" label="1">系统通知</el-radio> <el-radio
<el-radio v-model="ruleForm.value" label="2">短信通知</el-radio> v-model="ruleForm.isRefundEarnestMoney"
</el-form-item> --> :label="1"
:disabled="true"
></el-radio
>
<el-radio
v-model="ruleForm.isRefundEarnestMoney"
:label="0"
:disabled="true"
></el-radio
>
<span>
选择是用户可在付尾款前申请退定金申请后自动退无需审核或付尾款时间结束后系统自动退定金
</span>
</el-form-item>
<div style="padding: 0 0 0 20px; font-size: 16px; font-weight: 600">
已选择商品
</div>
<div style="padding: 20px">
<div style="border-top: 1px solid #ccc; padding: 10px 0 0 0">
<div style="font-size: 16px; margin-bottom: 20px">
<span>商品ID:{{ ruleForm.productId }}</span>
<span style="margin-left: 20px"
>商品名称:{{ ruleForm.name }}</span
>
</div>
<el-table
border
ref="multipleTable"
:data="ruleForm.productSpecificationList"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<el-table-column align="center" label="是否预售" width="80">
<template slot-scope="scope">
<span>{{
scope.row.isAdvanceSell == 1 ? '是' : '否'
}}</span>
<!-- <el-checkbox
:true-label="1"
:false-label="0"
v-model="scope.row.isAdvanceSell"
></el-checkbox> -->
</template>
</el-table-column>
<el-table-column align="center" label="SKU-ID" prop="id" />
<el-table-column
align="center"
label="规格"
prop="attributeList"
>
<template slot-scope="scope">
<span>{{ scope.row.attributeValue }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="属性" prop="address">
<template slot-scope="scope">
<span>{{
scope.row.attributeList
? scope.row.attributeList[0].attributeName
: '无'
}}</span>
</template>
</el-table-column>
<el-table-column
align="center"
label="销售价"
prop="marketPrice"
width="120"
/>
<el-table-column
prop="presalePrice"
align="center"
label="*预售价"
width="200"
>
<template slot-scope="scope">
<span v-if="scope.row.isAdvanceSell">{{
scope.row.presalePrice
}}</span>
</template>
</el-table-column>
<el-table-column
prop="earnestMoney"
align="center"
label="*定金"
width="200"
>
<template slot-scope="scope">
<span v-if="scope.row.isAdvanceSell">{{
scope.row.earnestMoney
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="尾款" width="200">
<template slot-scope="scope">
<span v-if="scope.row.isAdvanceSell">{{
scope.row.presalePrice
? scope.row.presalePrice - scope.row.earnestMoney
: ''
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="*预售库存" width="200">
<template slot-scope="scope">
<span v-if="scope.row.isAdvanceSell">{{
scope.row.advanceSellStockNum
}}</span>
</template>
</el-table-column>
</el-table>
</div>
<el-empty
v-show="ruleForm.productList?.length == 0"
description="请选择商品"
></el-empty>
</div>
</el-form> </el-form>
</div> </div>
<!-- 选择商品 -->
</obj-modal> </obj-modal>
</div> </div>
</template> </template>
<script> <script>
import { debounce, cloneDeep } from "lodash"; import { debounce, cloneDeep } from 'lodash'
export default { export default {
components: {}, components: {},
props: {
marketId: {
type: String,
default: ''
},
shopId: {
type: String,
default: ''
}
},
data() { data() {
return { return {
isAdd: true, isAdd: true,
// //
modalConfig: { modalConfig: {
title: "订单详情", title: '查看预售',
show: false, show: false,
width: "800px", width: '1200px',
fullscreen: true
}, },
modalData: {}, modalData: {},
ruleForm: { ruleForm: {
name: "", productList: [],
value: "1", isRefundEarnestMoney: 1 //退 1 0
}, },
rules: { pickerOptions: {
name: [{ required: true, message: "请输入属性名称", trigger: "blur" }], disabledDate(time) {
value: [ return time.getTime() < Date.now()
{ }
required: true,
message: "请输入属性内容",
trigger: "blur",
},
],
}, },
}; orderTime: [], //
arrears: [], //
delivery: [], //
tableData: []
}
},
watch: {
'modalConfig.show'(newVal) {
if (newVal) {
//
setTimeout(() => {
this.$refs.ruleForm.resetFields()
})
}
}
}, },
methods: { methods: {
queryTableData(pageNo, pageSize) {}, queryTableData(pageNo, pageSize) {},
toggle(e) { toggle(e) {
if (this.modalConfig.show == false) { if (this.modalConfig.show == false) {
this.modalConfig.show = true; this.modalConfig.show = true
} else { } else {
this.modalConfig.show = false; this.modalConfig.show = false
} }
if (e) { if (e) {
this.init(cloneDeep(e.row)); this.init(cloneDeep(e))
} }
return { return {
add: (data) => { add: () => {
this.modalConfig.title = "订单详情"; this.orderTime = []
this.isAdd = true; this.arrears = []
this.delivery = []
this.ruleForm = {
startTime: '',
endTime: '',
balancePaymentStartTime: '',
balancePaymentEndTime: '',
estimatedStartDeliveryTime: '',
estimatedEndDeliveryTime: '',
productList: [],
isRefundEarnestMoney: 1 //退 1 0
}
this.modalConfig.title = '新增预售'
this.isAdd = true
}, },
update: () => { update: () => {
this.isAdd = false; this.modalConfig.title = '查看预售'
}, this.isAdd = false
}; }
}
}, },
init(row) { init(row) {
this.modalData = row; console.log(row.startTime, row.endTime)
this.orderTime = [row.startTime, row.endTime]
this.arrears = [row.balancePaymentStartTime, row.balancePaymentEndTime]
this.delivery = [
row.estimatedStartDeliveryTime,
row.estimatedEndDeliveryTime
]
;(this.ruleForm = {
productId: row.id,
advanceSellId: row.advanceSellId,
startTime: row.startTime,
name: row.name,
endTime: row.endTime,
balancePaymentStartTime: row.balancePaymentStartTime,
balancePaymentEndTime: row.balancePaymentEndTime,
estimatedStartDeliveryTime: row.estimatedStartDeliveryTime,
estimatedEndDeliveryTime: row.estimatedEndDeliveryTime,
isRefundEarnestMoney: Number(row.isRefundEarnestMoney),
productSpecificationList: row.productSpecificationList
}),
console.log(this.orderTime, this.arrears, this.delivery)
// this.ruleForm = row;
}, },
//
getOrderTime(e) {
if (e) {
console.log(e)
this.ruleForm.startTime = e[0]
this.ruleForm.endTime = e[1]
} else {
this.ruleForm.startTime = ''
this.ruleForm.endTime = ''
}
},
//
getArrearsTime(e) {
if (e) {
console.log(e)
this.ruleForm.balancePaymentStartTime = e[0]
this.ruleForm.balancePaymentEndTime = e[1]
} else {
this.ruleForm.balancePaymentStartTime = ''
this.ruleForm.balancePaymentEndTime = ''
}
},
//
deliveryTime(e) {
if (e) {
console.log(e)
this.ruleForm.estimatedStartDeliveryTime = e[0]
this.ruleForm.estimatedEndDeliveryTime = e[1]
} else {
this.ruleForm.estimatedStartDeliveryTime = ''
this.ruleForm.estimatedEndDeliveryTime = ''
}
},
selectProduct() {
console.log('选择商品', this.marketId, this.shopId)
this.$nextTick(() => {
this.$refs.commodity.toggle().add({
marketId: this.marketId,
shopId: this.shopId
})
})
},
handleSelectionChange(e) {
console.log(e)
},
getProduct(row) {
this.ruleForm.productList = row.map(item => {
return {
productId: item.id,
name: item.name,
productSpecificationList: item.productSpecificationList
}
})
console.log(this.ruleForm.productList, this.ruleForm.productList.length)
console.log('获取商品')
}
}, },
computed: { computed: {
modalHandles() { modalHandles() {
return [ return [
{ {
label: "取消", label: '关闭',
handle: () => { handle: () => {
this.toggle(); this.toggle()
}, }
}, }
{ // {
label: "确认", // label: "",
type: "primary", // type: "primary",
// submit: true, // // submit: true,
handle: () => { // handle: () => {
this.$refs.ruleForm.validate((valid) => { // },
if (valid) { // },
this.$emit("getAttribute", this.ruleForm); ]
this.toggle(); }
}
});
},
},
];
},
}, },
asyncComputed: {}, asyncComputed: {}
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
</style>