first commit

This commit is contained in:
2026-09-21 19:21:35 +08:00
commit 6c944c4ffd
2733 changed files with 296956 additions and 0 deletions
+289
View File
@@ -0,0 +1,289 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="手机号" prop="phoneNumber">
<el-input
v-model="queryParams.phoneNumber"
placeholder="请输入用户手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="网站订单号 " prop="outTradeNo ">
<el-input
v-model="queryParams.outTradeNo"
placeholder="请输入网站订单号 "
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableData" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="id" label="ID" width="50"></el-table-column>
<el-table-column align="center" prop="nickName" label="申请用户"></el-table-column>
<el-table-column align="center" prop="userType" label="用户类型" width="90">
<template slot-scope="scope">
<el-tag v-if="scope.row.userType === '01'" type="warning" size="mini">主播</el-tag>
<el-tag v-else-if="scope.row.userType === '02'" type="success" size="mini">普通</el-tag>
<el-tag v-else-if="scope.row.userType === '03'" type="info" size="mini">机器人</el-tag>
<el-tag v-else-if="scope.row.userType === '04'" type="danger" size="mini">招商</el-tag>
<el-tag v-else-if="scope.row.userType === '05'" size="mini">卡商</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column align="center" prop="ornamentName" label="饰品名称"></el-table-column>
<el-table-column align="center" prop="address" label="饰品图片">
<template slot align="center" scope="scope">
<image-preview :src="scope.row.imageUrl" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column align="center" prop="outTradeNo" label="订单号"></el-table-column>
<el-table-column align="center" prop="batchId" label="批次号" width="140"></el-table-column>
<el-table-column align="center" prop="remainingCount" label="当日剩余次数" width="110">
<template slot-scope="scope">
<el-tag :type="scope.row.remainingCount > 0 ? 'success' : 'danger'" size="mini">
{{ scope.row.remainingCount !== undefined && scope.row.remainingCount !== null ? scope.row.remainingCount : '-' }}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="ornamentsPrice" label="价格" width="120">
<template slot-scope="scope">
<span :style="{ color: getPriceColor(scope.row), fontWeight: 'bold' }">
{{ scope.row.ornamentsPrice }}
</span>
<div v-if="scope.row.cs340Price" style="font-size: 12px; color: #999;">
三方: {{ scope.row.cs340Price }}
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="createTime" label="下单时间"></el-table-column>
<el-table-column align="center" prop="address" label="操作">
<template slot-scope="scope">
<!-- <el-button type="text" @click="tradeBuy(scope.row)">查询</el-button> -->
<el-button type="text" @click="tradeBuyCs2pifa(scope.row)">查询cs2pifa</el-button>
<el-button type="text" @click="handleReturn(scope.row)">退回申请</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<el-dialog title="退回申请" :visible.sync="dialogFormVisible">
<el-form :model="form" :rules="rule" ref="ruleForm">
<el-form-item label="原因" prop="message">
<el-input type="textarea" v-model="form.message" autocomplete="off" placeholder="填写退回原因"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmit('ruleForm')">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="在售详情" :visible.sync="dialogSaleInfo">
<p>饰品名称:{{saleInfo.itemName}}</p>
<p>库存数量:{{saleInfo.onSaleStock}}</p>
<p>最低在售价格:{{saleInfo.minSellPrice}}</p>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogSaleInfo = false">取 消</el-button>
<el-button type="primary" @click="createOrderByCs2pifa()">确认发货</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
deliverGoodslist,
tradeBuy,
deliveryFail,
queryOnSaleInfo,
batchQueryPrices
} from "@/api/skins/ttdelivery/api";
export default {
name: 'Delivery',
data() {
return {
rule: {
message: [
{ required: true, message: "请输入退回申请的原因", trigger: "blur" },
{ min: 1, max: 5, message: "至少一个字的原因", trigger: "blur" }
]
},
form: {},
dialogFormVisible: false,
dialogSaleInfo: false,
total: 1,
showSearch: true,
loading: false,
tableData: [],
saleInfo: {},
createOrderByV5ItemData: {},
queryParams: {
outTradeNo: null,
pageNum: 1,
pageSize: 10,
phoneNumber: null,
userName: null
}
};
},
mounted() {
this.getList();
},
methods: {
getPriceColor(row) {
if (!row.cs340Price) return '#606266'; // 无三方价格时默认色
return row.ornamentsPrice > row.cs340Price ? '#F56C6C' : '#67C23A'; // 溢价红色,未溢价绿色
},
handleSubmit(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
deliveryFail(this.form).then(res => {
this.dialogFormVisible = false;
this.getList();
this.$modal.msgSuccess("修改成功");
this.form = {};
});
} else {
return false;
}
});
},
handleReturn(res) {
this.form.deliveryRecordId = res.id;
this.dialogFormVisible = true;
},
tradeBuy(res) {
// let aa = {
// deliveryRecordId: res.id,
// id: res.ornamentsId
// };
// tradeBuy(aa).then(res => {
// });
this.$router.push({
path: "/delivery/zbtrecord",
query: {
id: res.ornamentId,
t_id: res.id
}
});
},
tradeBuyCs2pifa(data) {
if (!data.hashName) {
this.$modal.msgError("该饰品未配置hashName,无法查询cs2pifa在售信息");
return;
}
this.createOrderByV5ItemData = data;
queryOnSaleInfo({ marketHashName: data.hashName }).then(res => {
if (!res || !res.data || !res.data.saleCommodityResponse) {
this.$modal.msgError("未查询到该饰品的cs2pifa在售信息");
return;
}
this.saleInfo.itemName = res.data.saleTemplateResponse
? res.data.saleTemplateResponse.templateHashName
: data.hashName;
this.saleInfo.onSaleStock = res.data.saleCommodityResponse.sellNum;
this.saleInfo.minSellPrice = res.data.saleCommodityResponse.minSellPrice;
// 回写实时三方价格到表格行
const realTimePrice = parseFloat(this.saleInfo.minSellPrice);
if (!isNaN(realTimePrice)) {
this.tableData = this.tableData.map(row => {
if (row.id === data.id) {
return { ...row, cs340Price: realTimePrice };
}
return row;
});
}
this.dialogSaleInfo = true;
});
},
createOrderByCs2pifa() {
let aa = {
productId: this.createOrderByV5ItemData.ornamentId,
deliveryRecordId: this.createOrderByV5ItemData.id,
price: this.createOrderByV5ItemData.ornamentsPrice,
partyType: 8
};
tradeBuy(aa).then(res => {
this.getList();
this.$message({
type: "success",
message: "购买发货成功!"
});
});
},
resetQuery() {
this.queryParams = {
outTradeNo: null,
pageNum: 1,
pageSize: 10,
phoneNumber: null,
userName: null
};
this.getList();
},
handleQuery() {
this.getList();
},
getList() {
this.loading = true;
deliverGoodslist(this.queryParams).then(res => {
this.tableData = res.rows;
this.total = res.total;
this.loading = false;
// 加载完成后批量实时查询三方价格
this.fetchRealTimePrices();
});
},
fetchRealTimePrices() {
// 收集所有有 hashName 的饰品
const hashNames = this.tableData
.filter(row => row.hashName)
.map(row => row.hashName);
if (hashNames.length === 0) return;
batchQueryPrices(hashNames).then(res => {
if (res && res.code === 200 && res.data) {
const priceMap = res.data;
this.tableData = this.tableData.map(row => {
if (row.hashName && priceMap[row.hashName] !== undefined) {
return { ...row, cs340Price: parseFloat(priceMap[row.hashName]) };
}
return row;
});
}
}).catch(() => {
// 接口异常时保留数据库缓存价格
});
}
}
};
</script>
<style scoped lang="scss">
.home {
padding: 20px;
}
</style>