Commit 8216aa96 by Jaxon

Merge branch 'SAAS+V5.8.2' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into SAAS+V5.8.2
2 parents 83c8e8b4 0f6c040a
Showing 80 changed files with 2832 additions and 742 deletions
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"build:nomock": "vue-cli-service build --mode nomock", "build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix", "lint": "vue-cli-service lint --fix",
"test:unit": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service test:unit", "test:unit": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service test:unit",
"test:financialRules": "vue-cli-service test:unit tests/unit/financialRules --no-coverage",
"report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report" "report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report"
}, },
"dependencies": { "dependencies": {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
import request from "./request"; import request from "./request";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import { applyDivisionRuleTestGetMock } from "./mockDivisionRuleTestGetResponse";
const path = "dj.api."; const path = "dj.api.";
const path2 = "dj.api.smartcarlife."; const path2 = "dj.api.smartcarlife.";
...@@ -280,7 +281,9 @@ export function scenemerchantrefQueryServiceRefByShop(data) { ...@@ -280,7 +281,9 @@ export function scenemerchantrefQueryServiceRefByShop(data) {
// 获取商户财务设置进度 // 获取商户财务设置进度
export function divisionRuleTestGet(data) { export function divisionRuleTestGet(data) {
data.method = `${path2}divisionRuleTest.get`; data.method = `${path2}divisionRuleTest.get`;
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST).then((result) =>
applyDivisionRuleTestGetMock(result)
);
} }
// 分账测试验证分账金额 // 分账测试验证分账金额
...@@ -288,6 +291,24 @@ export function divisionRuleTestMoneyValid(data) { ...@@ -288,6 +291,24 @@ export function divisionRuleTestMoneyValid(data) {
data.method = `${path2}divisionRuleTest.money.valid`; data.method = `${path2}divisionRuleTest.money.valid`;
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/** 分账测试-重新测试 divisionRuleId + paymentChannelId */
export function divisionRuleTestRetest(data) {
data.method = `${path2}divisionRuleTest.retest`;
return request(data, RequestMethods.POST);
}
/** 分账测试-步骤2发起分账 */
export function divisionRuleTestDivisionSubmit(data) {
data.method = `${path2}divisionRuleTest.division.submit`;
return request(data, RequestMethods.POST);
}
/** 分账测试-同步主步骤 progress 1/2/3 */
export function divisionRuleTestUpdateMainProgress(data) {
data.method = `${path2}divisionRuleTest.updateMainProgress`;
return request(data, RequestMethods.POST);
}
// // 分账测算 // // 分账测算
// export function merchantSettleDistributeRuleTestRule(data) { // export function merchantSettleDistributeRuleTestRule(data) {
// data.method = `${path}merchantSettleDistributeRule.testRule` // data.method = `${path}merchantSettleDistributeRule.testRule`
......
/** 联调:强制 divisionRuleTest.get 回包 subProgress(根级 + divisionRuleTestItem) */
export const FORCE_DIVISION_TEST_SUB_PROGRESS = 35
/**
* 联调开关:true 时 get 回包 subProgress 强制为 35;也可设 VUE_APP_MOCK_DIVISION_TEST_SUB_PROGRESS=true
*/
export const ENABLE_DIVISION_TEST_SUB_PROGRESS_MOCK =
process.env.VUE_APP_MOCK_DIVISION_TEST_SUB_PROGRESS === 'true'
/**
* divisionRuleTest.get 回包处理入口(按开关决定是否 mock)
* @param {*} result
* @returns {*}
*/
export function applyDivisionRuleTestGetMock(result) {
if (!ENABLE_DIVISION_TEST_SUB_PROGRESS_MOCK) {
return result
}
return mockDivisionRuleTestGetSubProgress(result)
}
/**
* @param {*} result divisionRuleTest.get 原始回包
* @returns {*} 注入 subProgress 后的回包
*/
export function mockDivisionRuleTestGetSubProgress(result) {
if (result == null || typeof result !== 'object') {
return result
}
const sp = FORCE_DIVISION_TEST_SUB_PROGRESS
const next = { ...result, subProgress: sp }
if (next.divisionRuleTestItem && typeof next.divisionRuleTestItem === 'object') {
next.divisionRuleTestItem = {
...next.divisionRuleTestItem,
subProgress: sp
}
}
if (Array.isArray(next.divisionRuleTests)) {
next.divisionRuleTests = next.divisionRuleTests.map((item) => {
if (!item || typeof item !== 'object') return item
const patch = { ...item, subProgress: sp }
if (item.divisionRuleTestItem && typeof item.divisionRuleTestItem === 'object') {
patch.divisionRuleTestItem = {
...item.divisionRuleTestItem,
subProgress: sp
}
}
return patch
})
}
return next
}
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
'margin-bottom': isEdit ? '24px' : '', 'margin-bottom': isEdit ? '24px' : '',
'margin-right': isEdit ? '0px' : '30px', 'margin-right': isEdit ? '0px' : '30px',
...item.style, ...item.style,
}" :label="item.label" :prop="item.name" :rules="item.rules" }" :label="item.label" :prop="item.name" :rules="item.rules" :required="!!item.labelRequired">
:required="!!item.labelRequired">
<template #label> <template #label>
<span v-if="!getItemIsHide(item) && item.tips" class="tips-block"> <span v-if="!getItemIsHide(item) && item.tips" class="tips-block">
<span class="tips-label">{{ item.label }}</span> <span class="tips-label">{{ item.label }}</span>
...@@ -49,27 +48,24 @@ ...@@ -49,27 +48,24 @@
:disabled="getItemIsDisabled(item)" :maxlength="item.maxlength" :clearable="item.isClear || false" :disabled="getItemIsDisabled(item)" :maxlength="item.maxlength" :clearable="item.isClear || false"
:type="passwordInputType(item)" :autosize="item.inputType == 'textarea' && !item.rows" :type="passwordInputType(item)" :autosize="item.inputType == 'textarea' && !item.rows"
:rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }"
:show-word-limit="item.showLimit || false" :show-word-limit="item.showLimit || false" v-on="item.listeners ? item.listeners : {}"
v-on="item.listeners ? item.listeners : {}" @keydown.native="(e) => handleInputDown(e, item)" @keydown.native="(e) => handleInputDown(e, item)" @input="(e) => maxLengthInput(e, item)">
@input="(e) => maxLengthInput(e, item)">
<template #prepend> <template #prepend>
<span v-if="item.prepend">{{ item.prepend }}</span> <span v-if="item.prepend">{{ item.prepend }}</span>
</template> </template>
<template #suffix> <template #suffix>
<span v-if="item.append">{{ item.append }}</span> <span v-if="item.append">{{ item.append }}</span>
<span v-if="item.showPass" class="gl-password-toggle" role="button" tabindex="-1" <span v-if="item.showPass" class="gl-password-toggle" role="button" tabindex="-1"
:title="passwordPlain[item.name] ? '隐藏密码' : '显示密码'" :title="passwordPlain[item.name] ? '隐藏密码' : '显示密码'" @click.stop="togglePasswordPlain(item.name)">
@click.stop="togglePasswordPlain(item.name)"> <svg v-if="passwordPlain[item.name]" class="gl-password-toggle-svg" xmlns="http://www.w3.org/2000/svg"
<svg v-if="passwordPlain[item.name]" class="gl-password-toggle-svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" aria-hidden="true">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" /> <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
<circle cx="12" cy="12" r="3" /> <circle cx="12" cy="12" r="3" />
</svg> </svg>
<svg v-else class="gl-password-toggle-svg" xmlns="http://www.w3.org/2000/svg" width="14" <svg v-else class="gl-password-toggle-svg" xmlns="http://www.w3.org/2000/svg" width="14" height="14"
height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> stroke-linejoin="round" aria-hidden="true">
<path <path
d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" /> d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
<line x1="1" y1="1" x2="23" y2="23" /> <line x1="1" y1="1" x2="23" y2="23" />
...@@ -186,8 +182,7 @@ ...@@ -186,8 +182,7 @@
class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH')
? item.uploadStyle.imgWH ? item.uploadStyle.imgWH
: '' : ''
" accept="image/png, image/jpeg, image/gif, image/jpg" " accept="image/png, image/jpeg, image/gif, image/jpg" @change="(e) => handleUploadChange(e, item)" />
@change="(e) => handleUploadChange(e, item)" />
</div> </div>
</div> </div>
<template> <template>
...@@ -326,17 +321,6 @@ ...@@ -326,17 +321,6 @@
</div> </div>
</div> </div>
</el-select> </el-select>
<div v-else-if="item.type === 'map'" class="flex">
<Province ref="provinceForm" :subdistrict="subdistrict" :is-disabled="getItemIsDisabled(item)"
:province-view="item.provinceView" @selectProvince="(e) => handleSelectProvince(e, item)"
@selectCity="(e) => handleSelectCity(e, item)">
</Province>
<el-input v-model="formObj[item.name]" style="flex: 1" placeholder="请选择商户地址" :readonly="item.isReadonly">
</el-input>
<el-button v-show="!getItemIsDisabled(item)" class="m-l-10" type="primary" @click="handleSelectMap(item)">
选择地址
</el-button>
</div>
<div v-if="item.message" class="message-tip"> <div v-if="item.message" class="message-tip">
{{ item.message }} {{ item.message }}
</div> </div>
...@@ -373,14 +357,10 @@ import RemoteSelect from "@/components/remoteSearchSelect/index.vue"; ...@@ -373,14 +357,10 @@ import RemoteSelect from "@/components/remoteSearchSelect/index.vue";
import GLDialog from "../glsx-dialog/index.vue"; import GLDialog from "../glsx-dialog/index.vue";
import { afterRangePickerOptions, beforeRangePickerOptions } from "./common"; import { afterRangePickerOptions, beforeRangePickerOptions } from "./common";
import mapView from "./mapView.vue"; import mapView from "./mapView.vue";
// import textBox from '@/views/material/components/textBox'
import Province from "./provinceCity.vue";
export default { export default {
name: "GlsxCombiForm", name: "GlsxCombiForm",
components: { components: {
// textBox,
Province,
MapView: mapView, MapView: mapView,
GLDialog, GLDialog,
RemoteSelect, RemoteSelect,
......
<template>
<div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" inline="true" class="province" style="padding-left: 0;">
<el-select size="small" v-model="provinceForm.provinceName" clearable :disabled="isDisabled" placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable :disabled="isDisabled" placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable :disabled="isDisabled" placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select>
</el-form>
</div>
</template>
<script>
export default {
name: 'GLProvince',
props: {
// 省市级别,2--只显示省市,3--显示省市区,默认只显示省市
subdistrict: {
type: Number,
default: 2
},
// 省市下拉组件宽度
defaultWidth: {
type: String,
default: '150px'
},
// 组件是否展示,默认展示
provinceView: {
type: Boolean,
default: true
},
isDisabled: {
type: Boolean,
default: false
}
},
data() {
return {
// 所有数据
AllData: [],
// 城市列表
cityList: [],
// 地区列表
townList: [],
provinceForm: {
// 省份名称
provinceName: '',
// 城市名称
cityName: '',
// 地区名称
townName: '',
// 省份代码
provinceCode: '',
// 城市代码
cityCode: '',
// 地区代码
townCode: ''
}
}
},
mounted() {
this.provinceList()
},
methods: {
/*
* @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
列如:this.provinceList({keywords: '山东省'}),这样就可以筛选出山东省下的市、区信息
2、subdistrict --设置显示下级行政区级数,0:不返回下级行政区;1:返回下一级行政区;2:返回下两级行政区;3:返回下三级行政区;
不传的话默认为2,可以在组件中穿,也可以在调用方法的时候传,如果需要展示省市组件,传值最小为2
3、page --最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。
例如page=2;page=3。默认page=1
4、extensions --控制行政区信息中返回行政区边界坐标点; 可选值:base、all;
base:不返回行政区边界坐标点;(默认)
all:只返回当前查询district的边界值,不返回子节点的边界值;目前不能返回乡镇/街道级别的边界值
5、filter -- 按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息,需填入adcode,为了保证数据的正确,强烈建议填入此参数
6、callback -- callback值是用户定义的函数名称,此参数只在output=JSON时有效
7、output --返回数据格式类型,可选值:JSON,XML(默认JSON)
* @return:返回的是一个promise对象,如果不需要展示组件,只需要获取值,可以直接调用方法,异步获取返回值
列如:
const p = this.$refs.provinceForm.provinceList({xxxx(可传值,传值可参考上文params描述) })
p.then(r => {
// r 为返回结果
console.log(r)
})
**/
// 获取省市信息
provinceList(params = {}) {
params ? (params.subdistrict ? '' : (params.subdistrict = this.subdistrict)) : (params.subdistrict = this.subdistrict)
let data = ''
for (const key in params) {
data += '&' + key + '=' + params[key]
}
let path = `https://restapi.amap.com/v3/config/district?key=d22348363c34c266f772ae9b635eef2a`
path = path + data
const pro = fetch(path).then(res => {
return res.json()
})
if (this.provinceView) {
pro.then(r => {
this.AllData = r.districts[0].districts
})
}
return pro
},
// 省市回显
init(province, city, town) {
this.provinceForm = {
provinceName: province,
cityName: city,
townName: town
}
if (province) {
this.AllData.map(item => {
if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode
if (city) {
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
this.townList = itm.districts
if (town) {
this.townList.map(itmx => {
if (itmx.name.indexOf(town) != -1) {
this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name
}
})
}
}
})
}
}
})
}
},
// 选择省
selectProvince(val) {
this.provinceForm.cityName = ''
this.provinceForm.townName = ''
this.cityList = val.districts
this.$emit('selectProvince', { provinceName: val.name, provinceCode: val.adcode })
},
// 选择市
selectCity(val) {
this.provinceForm.townName = ''
this.townList = val.districts
this.$emit('selectCity', { cityName: val.name, cityCode: val.adcode })
},
// 选择区
selectTown(val) {
this.$emit('selectTown', { townName: val.name, townCode: val.adcode })
}
}
}
</script>
<style lang="scss">
.province {
display: inline-flex;
.el-select .el-input {
width: auto !important;
}
}
.select-padding {
margin-right: 10px;
}
</style>
<template> <template>
<d2-dialog :append-to-body="appendToBody" <d2-dialog :append-to-body="appendToBody" btn-ok-label="确定" class="selectGoods" :is-visible.sync="selectGoodsVisible"
btn-ok-label="确定" :title="title" width="70%" @closeDialog="handleSelectGoodsClose" @confirmDialog="handleSelectGoodsConfirm">
class="selectGoods" <d2-search ref="showSearch" class="show-search" :form-data="showFormData" label-width="100px"
:is-visible.sync="selectGoodsVisible"
:title="title"
width="70%"
@closeDialog="handleSelectGoodsClose"
@confirmDialog="handleSelectGoodsConfirm">
<d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
label-width="100px"
:search-form="searchForm"> :search-form="searchForm">
<template #commodityCode> <template #commodityCode>
<el-input v-model.trim="searchForm.commodityCode" <el-input v-model.trim="searchForm.commodityCode" :clearable="true" :maxlength="50" placeholder="请输入产品ID"
:clearable="true" :style="{ width: '100%' }" @input="event => searchInput(event, 'commodityCode')" />
:maxlength="50"
placeholder="请输入产品ID"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'commodityCode')" />
</template> </template>
<template #type> <template #type>
<!-- <el-input v-model.trim="searchForm.type" <!-- <el-input v-model.trim="searchForm.type"
...@@ -27,63 +14,42 @@ ...@@ -27,63 +14,42 @@
placeholder="请输入产品编码" placeholder="请输入产品编码"
:style="{ width: '100%' }" :style="{ width: '100%' }"
@input="event => searchInput(event, 'type')" /> --> @input="event => searchInput(event, 'type')" /> -->
<el-input v-model.trim="searchForm.type" <el-input v-model.trim="searchForm.type" :style="{ width: '100%' }" placeholder="请输入产品编码" :clearable="true"
:style="{ width: '100%' }"
placeholder="请输入产品编码"
:clearable="true"
:maxlength="50" /> :maxlength="50" />
</template> </template>
<template #thirdPartyCode> <template #thirdPartyCode>
<el-input v-model.trim="searchForm.thirdPartyCode" <el-input v-model.trim="searchForm.thirdPartyCode" :clearable="true" :maxlength="50" placeholder="请输入供应商编码"
:clearable="true" :style="{ width: '100%' }" />
:maxlength="50"
placeholder="请输入供应商编码"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'thirdPartyCode')" />
</template> </template>
<template #baseGoodsCommodityCode> <template #baseGoodsCommodityCode>
<el-input v-model.trim="searchForm.baseGoodsCommodityCode" <el-input v-model.trim="searchForm.baseGoodsCommodityCode" :clearable="true" :maxlength="50"
:clearable="true" placeholder="请输入系列ID" :style="{ width: '100%' }"
:maxlength="50"
placeholder="请输入系列ID"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'baseGoodsCommodityCode')" /> @input="event => searchInput(event, 'baseGoodsCommodityCode')" />
</template> </template>
<template #goodsCascader> <template #goodsCascader>
<el-cascader v-model="tempGoodsType" <el-cascader v-model="tempGoodsType" clearable filterable :options="baseData.productTypeList"
clearable placeholder="请选择" :props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
filterable style="width: 100%;" @change="selectAddAttr($event)">
:options="baseData.productTypeList"
placeholder="请选择"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
style="width: 100%;"
@change="selectAddAttr($event)">
</el-cascader> </el-cascader>
</template> </template>
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" <el-button :id="tableParams.btnId" size="small" type="primary">
size="small"
type="primary">
查询 查询
</el-button> </el-button>
</div> </div>
<d2-table ref="groundingIndexTable" <d2-table ref="groundingIndexTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" :has-num="false"
:before-search-fn="beforeSearchFn" :search-form="searchForm" :table-params="tableParams" @setTableFinishFun="setTableFinishFun">
:get-list-api="getListApi"
:has-num="false"
:search-form="searchForm"
:table-params="tableParams"
@setTableFinishFun="setTableFinishFun">
<template #select_btn="scope"> <template #select_btn="scope">
<el-radio v-model="selectedRowId" <el-radio v-model="selectedRowId" :disabled="packageSelectIds && packageSelectIds.includes(scope.scope.id)"
:disabled="packageSelectIds && packageSelectIds.includes(scope.scope.id)"
:label="scope.scope.id"> :label="scope.scope.id">
{{ '' }} {{ '' }}
</el-radio> </el-radio>
</template> </template>
<template #areaName="scope"> <template #areaName="scope">
<el-tooltip v-if="Array.isArray(scope.scope.upgradeGoodsAreaList) && scope.scope.upgradeGoodsAreaList.length" placement="top"> <el-tooltip
v-if="Array.isArray(scope.scope.upgradeGoodsAreaList) && scope.scope.upgradeGoodsAreaList.length"
placement="top">
<div slot="content" class="car-type-list"> <div slot="content" class="car-type-list">
<div v-for="(item, index) in scope.scope.upgradeGoodsAreaList" :key="index">{{ <div v-for="(item, index) in scope.scope.upgradeGoodsAreaList" :key="index">{{
item.provinceName == '全国' ? '全国' : `${item.provinceName}-${item.cityName}` }}</div> item.provinceName == '全国' ? '全国' : `${item.provinceName}-${item.cityName}` }}</div>
...@@ -162,6 +128,10 @@ export default { ...@@ -162,6 +128,10 @@ export default {
merchantIdList: { merchantIdList: {
type: Array, type: Array,
default: () => [] default: () => []
},
isShelves: {
type: Boolean,
default: false,
} }
}, },
data() { data() {
...@@ -222,9 +192,11 @@ export default { ...@@ -222,9 +192,11 @@ export default {
specificationData: "", specificationData: "",
type: "", type: "",
thirdPartyCode: "", thirdPartyCode: "",
thirdPartyName: "",
carTypeSearch: "", carTypeSearch: "",
goodsName: "", goodsName: "",
baseGoodsCommodityCode: "", baseGoodsCommodityCode: "",
}, },
tempGoodsType: [], tempGoodsType: [],
baseData: { baseData: {
...@@ -250,6 +222,13 @@ export default { ...@@ -250,6 +222,13 @@ export default {
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.upgradeGoodsName || "-"; return cellValue.upgradeGoodsName || "-";
}, },
},
{
label: "产品编码",
prop: "type",
formatter: (cellValue) => {
return cellValue.type || "-";
},
}, { }, {
label: "产品ID", label: "产品ID",
prop: "commodityCode", prop: "commodityCode",
...@@ -263,20 +242,16 @@ export default { ...@@ -263,20 +242,16 @@ export default {
formatter: (cellValue) => { formatter: (cellValue) => {
return this.filterSpecsStr(cellValue); return this.filterSpecsStr(cellValue);
}, },
}, {
label: "产品编码",
prop: "type",
formatter: (cellValue) => {
return cellValue.type || "-";
}, },
}, { {
label: "供应商编码", label: "供应商编码",
prop: "thirdPartyCode", prop: "thirdPartyCode",
width: 100, width: 100,
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue?.thirdPartyCode || "-"; return cellValue?.thirdPartyCode || "-";
}, },
}, { },
{
label: "运营成本/元", label: "运营成本/元",
prop: "operationCost", prop: "operationCost",
width: 150 width: 150
...@@ -322,12 +297,39 @@ export default { ...@@ -322,12 +297,39 @@ export default {
}, },
mounted() { mounted() {
this.selectedRowId = this.upgradeGoodsId; this.selectedRowId = this.upgradeGoodsId;
this.updateTableData()
// 获取全部类目 屏蔽服务商自建类目 // 获取全部类目 屏蔽服务商自建类目
getAllCategory({ categoryTypeList: this.selfBuildGoodsType, pageSize: 9999, currentPage: 1 }).then((res) => { getAllCategory({ categoryTypeList: this.selfBuildGoodsType, pageSize: 9999, currentPage: 1 }).then((res) => {
this.baseData.productTypeList = res?.list || []; this.baseData.productTypeList = res?.list || [];
}); });
}, },
methods: { methods: {
updateTableData(data) {
if (this.isShelves) {
this.showFormData.push({
label: "供应商名称",
name: "thirdPartyName",
type: "input",
maxlength: 50,
isClear: true,
keyFn: this.keyDowmGetList,
});
const typeIndex = this.tableParams.tableColumns.findIndex(item => item.prop === 'upgradeGoodsName');
if (typeIndex > -1) {
this.tableParams.tableColumns.splice(typeIndex + 1, 0, {
label: "供应商名称",
prop: "thirdPartyName",
width: 100,
formatter: (cellValue) => {
return cellValue?.thirdPartyName || "-";
},
});
}
}
},
searchInput(e, key) { searchInput(e, key) {
if (!/^[a-z0-9]*$/i.test(e)) { if (!/^[a-z0-9]*$/i.test(e)) {
this.searchForm[key] = e.replace(/[^a-z0-9]/gi, ""); this.searchForm[key] = e.replace(/[^a-z0-9]/gi, "");
...@@ -384,7 +386,9 @@ export default { ...@@ -384,7 +386,9 @@ export default {
thirdPartyCode: "", thirdPartyCode: "",
carTypeSearch: "", carTypeSearch: "",
goodsName: "", goodsName: "",
thirdPartyName: '',
baseGoodsCommodityCode: "", baseGoodsCommodityCode: "",
}; };
this.tempGoodsType = []; this.tempGoodsType = [];
// 重新查询 // 重新查询
......
...@@ -42,10 +42,6 @@ ...@@ -42,10 +42,6 @@
<span class="value">{{ formatAccessoryType($$(commodityInfo.goodsInfo, 'accessoryType')) }}</span> <span class="value">{{ formatAccessoryType($$(commodityInfo.goodsInfo, 'accessoryType')) }}</span>
</p> </p>
<p class="item_class"> <p class="item_class">
<span class="label">供应商:</span>
<EllipsisPopover class="value" :content="$$(commodityInfo.goodsInfo, 'providerName') || '-'"></EllipsisPopover>
</p>
<p class="item_class">
<span class="label">供应方:</span> <span class="label">供应方:</span>
<span class="value">{{ $$(commodityInfo.goodsInfo, 'supplierName') || '-' }}</span> <span class="value">{{ $$(commodityInfo.goodsInfo, 'supplierName') || '-' }}</span>
</p> </p>
...@@ -78,6 +74,9 @@ ...@@ -78,6 +74,9 @@
<el-form-item class="d2-drawer-item" label="运营成本/元:"> <el-form-item class="d2-drawer-item" label="运营成本/元:">
<EllipsisPopover :content="!filterEmpty(item.operationCost) ? priceFilter(item.operationCost) : '-'"></EllipsisPopover> <EllipsisPopover :content="!filterEmpty(item.operationCost) ? priceFilter(item.operationCost) : '-'"></EllipsisPopover>
</el-form-item> </el-form-item>
<el-form-item class="d2-drawer-item" label="供应商:">
<EllipsisPopover :content="item.providerName || '-'"></EllipsisPopover>
</el-form-item>
</div> </div>
</el-form> </el-form>
<!-- 分页 --> <!-- 分页 -->
......
...@@ -38,10 +38,6 @@ ...@@ -38,10 +38,6 @@
<span class="value">{{ formatAccessoryType($$(commodityInfo.goodsInfo, "accessoryType")) }}</span> <span class="value">{{ formatAccessoryType($$(commodityInfo.goodsInfo, "accessoryType")) }}</span>
</p> </p>
<p class="item_class"> <p class="item_class">
<span class="label">供应商:</span>
<EllipsisPopover class="value" :content="$$(commodityInfo.goodsInfo, 'providerName') || '-'"></EllipsisPopover>
</p>
<p class="item_class">
<span class="label">供应方:</span> <span class="label">供应方:</span>
<span class="value">{{ $$(commodityInfo.goodsInfo, "supplierName") || "-" }}</span> <span class="value">{{ $$(commodityInfo.goodsInfo, "supplierName") || "-" }}</span>
</p> </p>
...@@ -88,6 +84,9 @@ ...@@ -88,6 +84,9 @@
<el-form-item class="d2-drawer-item" label="运营成本/元:"> <el-form-item class="d2-drawer-item" label="运营成本/元:">
<EllipsisPopover :content="!filterEmpty(item.operationCost) ? priceFilter(item.operationCost) : '-'"></EllipsisPopover> <EllipsisPopover :content="!filterEmpty(item.operationCost) ? priceFilter(item.operationCost) : '-'"></EllipsisPopover>
</el-form-item> </el-form-item>
<el-form-item class="d2-drawer-item" label="供应商:">
<EllipsisPopover :content="item.providerName || '-'"></EllipsisPopover>
</el-form-item>
</div> </div>
</el-form> </el-form>
</div> </div>
......
...@@ -169,6 +169,7 @@ export default { ...@@ -169,6 +169,7 @@ export default {
type: val.type, type: val.type,
thirdPartyName: val.thirdPartyName, thirdPartyName: val.thirdPartyName,
thirdPartyCode: val.thirdPartyCode, thirdPartyCode: val.thirdPartyCode,
providerIds: val.providerIds || [],
priceUnitType, priceUnitType,
priceUnitName, priceUnitName,
purchaseCost: val.purchaseCost, purchaseCost: val.purchaseCost,
...@@ -254,8 +255,7 @@ export default { ...@@ -254,8 +255,7 @@ export default {
supplierCode: res.goodsInfo.supplierCode, supplierCode: res.goodsInfo.supplierCode,
merchantGoodsInfos: res?.merchantGoodsInfos, merchantGoodsInfos: res?.merchantGoodsInfos,
scrmFlag: res?.goodsInfo?.scrmFlag, scrmFlag: res?.goodsInfo?.scrmFlag,
accessoryType: res.goodsInfo?.accessoryType, accessoryType: res.goodsInfo?.accessoryType
providerId: res.goodsInfo?.providerId
} }
this.productFormData = deepClone({ ...res.goodsInfo, status: res?.status, oldconvertedValue: res.goodsInfo?.convertedValue, tempGoodsType, secondaryGoodsType: res.goodsInfo.secondaryGoodsType, thirdLevelGoodsType: res.goodsInfo.thirdLevelGoodsType }) || {} this.productFormData = deepClone({ ...res.goodsInfo, status: res?.status, oldconvertedValue: res.goodsInfo?.convertedValue, tempGoodsType, secondaryGoodsType: res.goodsInfo.secondaryGoodsType, thirdLevelGoodsType: res.goodsInfo.thirdLevelGoodsType }) || {}
this.setUpdateGoodsInfo(objData) this.setUpdateGoodsInfo(objData)
...@@ -346,6 +346,7 @@ export default { ...@@ -346,6 +346,7 @@ export default {
type: item.type, type: item.type,
thirdPartyName: item.thirdPartyName, thirdPartyName: item.thirdPartyName,
thirdPartyCode: item.thirdPartyCode, thirdPartyCode: item.thirdPartyCode,
providerIds: item.providerIds || [],
priceUnitType: item.priceUnitType, priceUnitType: item.priceUnitType,
priceUnitName: item.priceUnitName, priceUnitName: item.priceUnitName,
productTemplateId: item?.productTemplateId, productTemplateId: item?.productTemplateId,
...@@ -420,6 +421,7 @@ export default { ...@@ -420,6 +421,7 @@ export default {
type: item.type, type: item.type,
thirdPartyName: item.thirdPartyName, thirdPartyName: item.thirdPartyName,
thirdPartyCode: item.thirdPartyCode, thirdPartyCode: item.thirdPartyCode,
providerIds: item.providerIds || [],
priceUnitType: item.priceUnitType, priceUnitType: item.priceUnitType,
priceUnitName: item.priceUnitName, priceUnitName: item.priceUnitName,
purchaseCost: item.purchaseCost, purchaseCost: item.purchaseCost,
...@@ -529,6 +531,7 @@ export default { ...@@ -529,6 +531,7 @@ export default {
type, type,
thirdPartyName: '', thirdPartyName: '',
thirdPartyCode: '', thirdPartyCode: '',
providerIds: [],
priceUnitType: '', priceUnitType: '',
priceUnitName: '', priceUnitName: '',
purchaseCost: '', purchaseCost: '',
...@@ -624,6 +627,7 @@ export default { ...@@ -624,6 +627,7 @@ export default {
item.operationCostEmpty = true // 运营成本必填 item.operationCostEmpty = true // 运营成本必填
item.applicableAreaEmpty = true // 适用区域必填 item.applicableAreaEmpty = true // 适用区域必填
item.purchaseCostEmpty = true // 采购成本必填 item.purchaseCostEmpty = true // 采购成本必填
item.providerIdsEmpty = true // 供应商必填
if (this.equitySceneType.includes(this.goodsInfoData.goodsType) && !this.baseConfig.supplierCode.includes(`${this.goodsInfoData.supplierCode}`)) { if (this.equitySceneType.includes(this.goodsInfoData.goodsType) && !this.baseConfig.supplierCode.includes(`${this.goodsInfoData.supplierCode}`)) {
// 会员权益升级类目(仅供应方是非第三方) 服务项目、嘀加成本必填 // 会员权益升级类目(仅供应方是非第三方) 服务项目、嘀加成本必填
item.serviceItemArrEmpty = true item.serviceItemArrEmpty = true
...@@ -644,7 +648,7 @@ export default { ...@@ -644,7 +648,7 @@ export default {
} }
let specialList = [] let specialList = []
// 1. 基础必填字段 产品编码、采购成本、运营系数、运营成本、适用区域 // 1. 基础必填字段 产品编码、采购成本、运营系数、运营成本、适用区域
const baseFields = ['specificationData', 'type', 'purchaseCost', 'operationCoefficient', 'operationCost', 'upgradeGoodsAreaList'] const baseFields = ['specificationData', 'type', 'providerIds', 'purchaseCost', 'operationCoefficient', 'operationCost', 'upgradeGoodsAreaList']
const { goodsType, supplierCode } = this.goodsInfoData const { goodsType, supplierCode } = this.goodsInfoData
// 2. 权益/延保类 // 2. 权益/延保类
if (isEquityOrExtend) { if (isEquityOrExtend) {
......
...@@ -109,6 +109,11 @@ ...@@ -109,6 +109,11 @@
<span>供应来源</span> <span>供应来源</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td style="position: relative">
<span class="color-red">*</span>
<span>供应商</span>
<div class="resize-handle" @mousedown="onResizeStart"></div>
</td>
<!-- 仅延保类/权益服务 广联直营展示 --> <!-- 仅延保类/权益服务 广联直营展示 -->
<td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)" style="position: relative"> <td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)" style="position: relative">
<span class="color-red">*</span> <span class="color-red">*</span>
...@@ -215,6 +220,12 @@ ...@@ -215,6 +220,12 @@
<el-option v-for="opt in supplySourceOptions" :key="opt.value" :label="opt.label" :value="opt.value" /> <el-option v-for="opt in supplySourceOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select> </el-select>
</td> </td>
<td>
<SupplierSelect
v-model="row.item.providerIds"
:custom-class="!row.item.providerIds.length && row.item.providerIdsEmpty ? 'border-red' : ''"
width="calc(100% - 40px)" />
</td>
<td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)"> <td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)">
<div style="transform: translateX(6px)"> <div style="transform: translateX(6px)">
<el-input v-model="row.item.djCost" class="w-150-per" :class="{ 'border-red': filterEmpty(row.item.djCost) && row.item.djCostEmpty }" :disabled="true" placeholder="请输入" size="small" @input="handlePrice($event, row.originalIndex, 'djCost')"></el-input> <el-input v-model="row.item.djCost" class="w-150-per" :class="{ 'border-red': filterEmpty(row.item.djCost) && row.item.djCostEmpty }" :disabled="true" placeholder="请输入" size="small" @input="handlePrice($event, row.originalIndex, 'djCost')"></el-input>
...@@ -368,7 +379,7 @@ import carSeriesDialog from './carSeriesDialog.vue' ...@@ -368,7 +379,7 @@ import carSeriesDialog from './carSeriesDialog.vue'
import extendServiceItemsDialog from './extendServiceItemsDialog.vue' import extendServiceItemsDialog from './extendServiceItemsDialog.vue'
import serviceItemsDialog from './serviceItemsDialog.vue' import serviceItemsDialog from './serviceItemsDialog.vue'
import specsManage from './specsManage.vue' import specsManage from './specsManage.vue'
import SupplierSelect from './SupplierSelect.vue'
export default { export default {
name: 'MultipleSpecificationForm', name: 'MultipleSpecificationForm',
components: { components: {
...@@ -377,7 +388,8 @@ export default { ...@@ -377,7 +388,8 @@ export default {
CarSeriesDialog: carSeriesDialog, CarSeriesDialog: carSeriesDialog,
SpecsManage: specsManage, SpecsManage: specsManage,
// ApplicableAreaSelect, // ApplicableAreaSelect,
ApplicableAreaQuerySelect ApplicableAreaQuerySelect,
SupplierSelect
}, },
mixins: [useTableVirtualScroll, useResizableColumns], mixins: [useTableVirtualScroll, useResizableColumns],
inject: ['pageData'], inject: ['pageData'],
...@@ -1273,6 +1285,7 @@ export default { ...@@ -1273,6 +1285,7 @@ export default {
type: '', type: '',
thirdPartyName: '', thirdPartyName: '',
thirdPartyCode: '', thirdPartyCode: '',
providerIds: [],
priceUnitType: null, priceUnitType: null,
priceUnitName: '', priceUnitName: '',
purchaseCost: '', purchaseCost: '',
...@@ -1331,6 +1344,7 @@ export default { ...@@ -1331,6 +1344,7 @@ export default {
item.type = temp.type item.type = temp.type
item.thirdPartyName = temp.thirdPartyName item.thirdPartyName = temp.thirdPartyName
item.thirdPartyCode = temp.thirdPartyCode item.thirdPartyCode = temp.thirdPartyCode
item.providerIds = temp.providerIds || []
item.priceUnitType = temp.priceUnitType item.priceUnitType = temp.priceUnitType
item.priceUnitName = temp.priceUnitName item.priceUnitName = temp.priceUnitName
item.purchaseCost = temp.purchaseCost item.purchaseCost = temp.purchaseCost
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
<span>供应商编码</span> <span>供应商编码</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示,延保不必填 -->
<td style="position: relative"> <td style="position: relative">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>计价单位</span> <span>计价单位</span>
...@@ -89,6 +88,11 @@ ...@@ -89,6 +88,11 @@
<span>供应来源</span> <span>供应来源</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td style="position: relative">
<span class="color-red">*</span>
<span>供应商</span>
<div class="resize-handle" @mousedown="onResizeStart"></div>
</td>
<!-- 延保/权益 非第三方展示 --> <!-- 延保/权益 非第三方展示 -->
<td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)" style="position: relative"> <td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)" style="position: relative">
<span class="color-red">*</span> <span class="color-red">*</span>
...@@ -317,7 +321,12 @@ ...@@ -317,7 +321,12 @@
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</td> </td>
<td>
<SupplierSelect
v-model="row.item.providerIds"
:custom-class="!row.item.providerIds.length && row.item.providerIdsEmpty ? 'border-red' : ''"
width="calc(100% - 40px)" />
</td>
<td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)"> <td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)">
<el-input v-model="row.item.djCost" <el-input v-model="row.item.djCost"
class="w-150-per" class="w-150-per"
...@@ -542,7 +551,7 @@ import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVi ...@@ -542,7 +551,7 @@ import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVi
import carSeriesDialog from "./carSeriesDialog.vue"; import carSeriesDialog from "./carSeriesDialog.vue";
import extendServiceItemsDialog from "./extendServiceItemsDialog.vue"; import extendServiceItemsDialog from "./extendServiceItemsDialog.vue";
import serviceItemsDialog from "./serviceItemsDialog.vue"; import serviceItemsDialog from "./serviceItemsDialog.vue";
import SupplierSelect from './SupplierSelect.vue'
export default { export default {
name: "SingleSpecificationForm", name: "SingleSpecificationForm",
components: { components: {
...@@ -551,6 +560,7 @@ export default { ...@@ -551,6 +560,7 @@ export default {
CarSeriesDialog: carSeriesDialog, CarSeriesDialog: carSeriesDialog,
// ApplicableAreaSelect, // ApplicableAreaSelect,
ApplicableAreaQuerySelect, ApplicableAreaQuerySelect,
SupplierSelect
}, },
mixins: [useTableVirtualScroll, useResizableColumns], mixins: [useTableVirtualScroll, useResizableColumns],
props: { props: {
...@@ -1083,6 +1093,7 @@ export default { ...@@ -1083,6 +1093,7 @@ export default {
type: "", type: "",
thirdPartyName: "", thirdPartyName: "",
thirdPartyCode: "", thirdPartyCode: "",
providerIds: [],
priceUnitType: null, priceUnitType: null,
priceUnitName: "", priceUnitName: "",
purchaseCost: "", purchaseCost: "",
......
...@@ -13,15 +13,12 @@ ...@@ -13,15 +13,12 @@
:origin-data="editData" :origin-data="editData"
@accessoryTypeChange="handleAccessoryTypeChange" @accessoryTypeChange="handleAccessoryTypeChange"
@handleAddBrandSupplyConfirm="handleAddBrandSupplyConfirm" @handleAddBrandSupplyConfirm="handleAddBrandSupplyConfirm"
@handleEditBrandSupplyConfirm="handleEditBrandSupplyConfirm" @handleEditBrandSupplyConfirm="handleEditBrandSupplyConfirm">
@handleAddSupplierConfirm="handleAddSupplierConfirm"
@handleEditSupplierConfirm="handleEditSupplierConfirm">
</ProductForm> </ProductForm>
</div> </div>
</template> </template>
<script> <script>
import { addGoodsProvider, editGoodsProvider, getGoodsProviderList } from "@api/productManage";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import { addBrandSupplyMerchant, editBrandSupplyMerchant, getAllCategory, getBrandSupplyMerchant } from "@/api/product"; import { addBrandSupplyMerchant, editBrandSupplyMerchant, getAllCategory, getBrandSupplyMerchant } from "@/api/product";
import { deepClone } from "@/common/util"; import { deepClone } from "@/common/util";
...@@ -53,8 +50,6 @@ export default { ...@@ -53,8 +50,6 @@ export default {
brandMerchantName: "", brandMerchantName: "",
supplierCode: "", supplierCode: "",
supplierName: "", supplierName: "",
providerId: "",
providerName: "",
address: "", address: "",
contactName: "", contactName: "",
contactPhone: "", contactPhone: "",
...@@ -123,19 +118,6 @@ export default { ...@@ -123,19 +118,6 @@ export default {
isDisabled: false, isDisabled: false,
}, },
{ {
name: "providerId",
label: "供应商",
isRequired: true,
type: "dialog-add-select",
multiple: false,
isClear: true,
optionList: [],
optionId: "id",
optionLabel: "providerName",
width: "432px",
isDisabled: false,
},
{
name: "thumbUrl", name: "thumbUrl",
label: "缩略图", label: "缩略图",
type: "photo", type: "photo",
...@@ -210,8 +192,6 @@ export default { ...@@ -210,8 +192,6 @@ export default {
this.getBrandSupplyList(2); this.getBrandSupplyList(2);
// 获取类目 // 获取类目
this.getGoodTypeList(); this.getGoodTypeList();
// 获取供应商
this.getGoodsProvider();
}, },
methods: { methods: {
...mapActions({ ...mapActions({
...@@ -309,34 +289,6 @@ export default { ...@@ -309,34 +289,6 @@ export default {
this.getBrandSupplyList(data.partitionFlag); this.getBrandSupplyList(data.partitionFlag);
}); });
}, },
// 获取供应商
getGoodsProvider() {
return getGoodsProviderList({ currentPage: 1, pageSize: 9999 }).then((res) => {
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == "providerId")].optionList = res?.list || [];
return res?.list || [];
});
},
// 新增供应商
handleAddSupplierConfirm(data, done) {
const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "providerId");
if (supplierIndex === -1)
return;
addGoodsProvider(data).then((res) => {
this.getGoodsProvider().then(() => {
done && done(res);
});
});
},
// 编辑供应商
handleEditSupplierConfirm(data, done) {
const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "providerId");
if (supplierIndex === -1)
return;
editGoodsProvider(data).then((res) => {
this.getGoodsProvider();
done && done(res);
});
},
handleAccessoryTypeChange(val) { handleAccessoryTypeChange(val) {
this.$emit("accessoryTypeChange", val); this.$emit("accessoryTypeChange", val);
}, },
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
v-if="(equitySceneType.includes(formData[item.key]) || extendedPosiType.includes(formData[item.key])) && !baseConfig.supplierCode.includes(`${formData.supplierCode}`)"> v-if="(equitySceneType.includes(formData[item.key]) || extendedPosiType.includes(formData[item.key])) && !baseConfig.supplierCode.includes(`${formData.supplierCode}`)">
<div class="label">嘀加成本元/件:</div> <div class="label">嘀加成本元/件:</div>
<div class="value"> <div class="value">
<ellipsis-popover <ellipsis-popover :content="priceFilter(formData.upgradeGoods['djCost']) || ''"></ellipsis-popover>
:content="priceFilter(formData.upgradeGoods['djCost']) || ''"></ellipsis-popover>
</div> </div>
</div> </div>
<!-- 商品分类 1太阳膜 --> <!-- 商品分类 1太阳膜 -->
...@@ -58,8 +57,7 @@ ...@@ -58,8 +57,7 @@
<div class="item" v-if="membraneTypeList.includes(formData[item.key])"> <div class="item" v-if="membraneTypeList.includes(formData[item.key])">
<div class="label">质保年限/年:</div> <div class="label">质保年限/年:</div>
<div class="value"> <div class="value">
<ellipsis-popover <ellipsis-popover :content="`${formData.upgradeGoods['warrantyPeriod']}年` || ''"></ellipsis-popover>
:content="`${formData.upgradeGoods['warrantyPeriod']}年` || ''"></ellipsis-popover>
</div> </div>
</div> </div>
</div> </div>
...@@ -104,10 +102,9 @@ ...@@ -104,10 +102,9 @@
<div v-else> <div v-else>
<el-form-item :prop="item.name" <el-form-item :prop="item.name"
:label="item.label ? (item.unit ? (membraneTypeList.includes(formData['goodsType']) ? item.label + `(元)/车` : (item.label + '(元)/件')) : item.label) + ':' : ''" :label="item.label ? (item.unit ? (membraneTypeList.includes(formData['goodsType']) ? item.label + `(元)/车` : (item.label + '(元)/件')) : item.label) + ':' : ''"
:id="item.name" :label-width="item.label ? '180px' : '0px'" class="dis-in-block" :id="item.name" :label-width="item.label ? '180px' : '0px'" class="dis-in-block" style="margin-bottom: 0">
style="margin-bottom: 0">
<div> <div>
<span>{{ item.unit ? priceFilter(formData[item.name]) : formData[item.name] }}</span> <span>{{ item.unit ? priceFilter(formData[item.name]) : formData[item.name] || '-' }}</span>
<span v-if="item.name == 'minSellPrice'">{{ formData['validMinSellPrice'] == 'Y' ? '(校验最低价)' : <span v-if="item.name == 'minSellPrice'">{{ formData['validMinSellPrice'] == 'Y' ? '(校验最低价)' :
'(不校验最低价)' }}</span> '(不校验最低价)' }}</span>
</div> </div>
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
<div v-for="(item, index) in i.formBlock" :key="index"> <div v-for="(item, index) in i.formBlock" :key="index">
<!-- 单选 --> <!-- 单选 -->
<!-- 太阳膜类商品 上架部位 --> <!-- 太阳膜类商品 上架部位 -->
<div v-if=" <div v-if="item.type === 'radio' &&
item.type === 'radio' &&
formData['goodsType'] == 1 && formData['goodsType'] == 1 &&
!item.index !item.index
"> ">
...@@ -20,8 +19,8 @@ ...@@ -20,8 +19,8 @@
:label-width="item.label ? '180px' : '0px'" class="dis-in-block" :label-width="item.label ? '180px' : '0px'" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }"> :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
<el-radio-group v-model="formData[item.name]"> <el-radio-group v-model="formData[item.name]">
<el-radio v-for="(subItem, subIndex) in item.radioGroupList" :key="subIndex" <el-radio v-for="(subItem, subIndex) in item.radioGroupList" :key="subIndex" :label="subItem.confId">{{
:label="subItem.confId">{{ subItem.confName }}</el-radio> subItem.confName }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</div> </div>
...@@ -48,8 +47,7 @@ ...@@ -48,8 +47,7 @@
</div> </div>
</div> </div>
<!-- 权益/延保非第三方展示 --> <!-- 权益/延保非第三方展示 -->
<div class="item" v-if=" <div class="item" v-if="(equitySceneType.includes(formData[item.key]) ||
(equitySceneType.includes(formData[item.key]) ||
extendedPosiType.includes(formData[item.key])) && extendedPosiType.includes(formData[item.key])) &&
!baseConfig.supplierCode.includes( !baseConfig.supplierCode.includes(
`${formData.supplierCode}` `${formData.supplierCode}`
...@@ -69,8 +67,7 @@ ...@@ -69,8 +67,7 @@
</div> </div>
</div> </div>
<!-- 商品分类 权益类(供应方为非第三方) --> <!-- 商品分类 权益类(供应方为非第三方) -->
<div class="item" v-if=" <div class="item" v-if="equitySceneType.includes(formData[item.key]) &&
equitySceneType.includes(formData[item.key]) &&
!baseConfig.supplierCode.includes( !baseConfig.supplierCode.includes(
`${formData.supplierCode}` `${formData.supplierCode}`
) )
...@@ -102,8 +99,7 @@ ...@@ -102,8 +99,7 @@
</div> </div>
</div> </div>
<!-- 下拉框/输入框 --> <!-- 下拉框/输入框 -->
<div v-if=" <div v-if="item.type === 'input' ||
item.type === 'input' ||
item.type === 'select' || item.type === 'select' ||
item.type === 'searchSelect' item.type === 'searchSelect'
"> ">
...@@ -128,8 +124,8 @@ ...@@ -128,8 +124,8 @@
</template> </template>
<!-- 选择框 --> <!-- 选择框 -->
<el-select v-else-if="item.type === 'select'" v-model="formData[item.name]" :clearable="item.isClear" <el-select v-else-if="item.type === 'select'" v-model="formData[item.name]" :clearable="item.isClear"
:ref="'selectRefs_' + item.name" :placeholder="'请选择' + item.label" :ref="'selectRefs_' + item.name" :placeholder="'请选择' + item.label" @change="selectAddAttr($event, item)"
@change="selectAddAttr($event, item)" :style="{ width: item.width || formItemWidth }" filterable> :style="{ width: item.width || formItemWidth }" filterable>
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" <el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]"
:label="subItem[item.optionLabel]" :value="subItem[item.optionId]" /> :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" />
</el-select> </el-select>
...@@ -145,7 +141,7 @@ ...@@ -145,7 +141,7 @@
</el-option> </el-option>
</el-select> --> </el-select> -->
<el-button v-else-if="item.type === 'searchSelect'" icon="el-icon-plus" <el-button v-else-if="item.type === 'searchSelect'" icon="el-icon-plus"
@click="handleSelectGoods">选择商品</el-button> @click="handleSelectGoods">选择产品</el-button>
</el-form-item> </el-form-item>
</div> </div>
<!-- 财务规则校验 --> <!-- 财务规则校验 -->
...@@ -195,8 +191,7 @@ ...@@ -195,8 +191,7 @@
: :
</span> </span>
<el-checkbox-group v-model="formData[item.name]"> <el-checkbox-group v-model="formData[item.name]">
<el-checkbox v-for="(subItem, subIndex) in item.checkGroupList" :key="subIndex" <el-checkbox v-for="(subItem, subIndex) in item.checkGroupList" :key="subIndex" :label="subItem.confId">
:label="subItem.confId">
{{ subItem.confName }} {{ subItem.confName }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
...@@ -328,7 +323,7 @@ ...@@ -328,7 +323,7 @@
:initial-index="initialIndex" /> :initial-index="initialIndex" />
<select-goods-dialog v-if="selectGoodsVisible" :select-goods-visible="selectGoodsVisible" <select-goods-dialog v-if="selectGoodsVisible" :select-goods-visible="selectGoodsVisible"
@handleSelectGoodsConfirm="handleSelectGoodsConfirm" @handleSelectGoodsClose="handleSelectGoodsClose" @handleSelectGoodsConfirm="handleSelectGoodsConfirm" @handleSelectGoodsClose="handleSelectGoodsClose"
:upgrade-goods-id="formData.upgradeGoodsId"></select-goods-dialog> :upgrade-goods-id="formData.upgradeGoodsId" :is-shelves="true"></select-goods-dialog>
</div> </div>
</template> </template>
...@@ -387,6 +382,13 @@ export default { ...@@ -387,6 +382,13 @@ export default {
} }
} }
], ],
// purchaseGoodsName: [
// {
// validator: (rule, value, callback) => {
// value.length > 30 ? callback(new Error("产品别名不能超过30个字符")) : callback()
// }
// }
// ],
// minSellPrice: [ // minSellPrice: [
// { required: true, message: "请输入最低售价", trigger: "blur" }, // { required: true, message: "请输入最低售价", trigger: "blur" },
// { // {
......
...@@ -29,10 +29,10 @@ export default { ...@@ -29,10 +29,10 @@ export default {
addOrEdit: 'add', addOrEdit: 'add',
proFormRef: 'pro', proFormRef: 'pro',
editForm: [{ editForm: [{
title: '商品信息', title: '产品信息',
formBlock: [{ formBlock: [{
name: 'upgradeGoodsId', name: 'upgradeGoodsId',
label: '上架商品', label: '上架产品',
isRequired: true, isRequired: true,
type: 'searchSelect', type: 'searchSelect',
optionList: [], optionList: [],
...@@ -86,9 +86,21 @@ export default { ...@@ -86,9 +86,21 @@ export default {
}, { }, {
label: '产品ID', label: '产品ID',
value: 'upgradeCommodityCode' value: 'upgradeCommodityCode'
},
{
label: '供应商名称',
value: 'thirdPartyName'
}] }]
}, },
{ {
name: 'purchaseGoodsName',
label: '产品别名',
type: 'input',
width: '432px',
maxlength: 30,
value: "purchaseGoodsName"
},
{
name: 'purchasePrice', name: 'purchasePrice',
label: '采购价', label: '采购价',
type: 'input', type: 'input',
...@@ -159,7 +171,8 @@ export default { ...@@ -159,7 +171,8 @@ export default {
voucherList: [], voucherList: [],
// validMinSellPriceFlag: true, // validMinSellPriceFlag: true,
// validMinSellPrice: 'Y', // validMinSellPrice: 'Y',
suitCarType: 1 suitCarType: 1,
purchaseGoodsName: ''
}, },
secondGoodsList: [], secondGoodsList: [],
goodsNameKeyword: '', goodsNameKeyword: '',
...@@ -343,6 +356,7 @@ export default { ...@@ -343,6 +356,7 @@ export default {
confirmEvent(params, num) { confirmEvent(params, num) {
const obj = { // 商品信息 const obj = { // 商品信息
position: '', position: '',
purchaseGoodsName: '',
goodsAlias: '', goodsAlias: '',
warrantyType: '', warrantyType: '',
productType: [], productType: [],
......
...@@ -44,10 +44,10 @@ export default { ...@@ -44,10 +44,10 @@ export default {
financeCheckFlagStr: [{ required: true }] financeCheckFlagStr: [{ required: true }]
}, },
editForm: [{ editForm: [{
title: '商品信息', title: '产品信息',
formBlock: [{ formBlock: [{
name: 'goodsName', name: 'goodsName',
label: '上架商品', label: '上架产品',
type: 'incidBox', type: 'incidBox',
key: 'goodsType', key: 'goodsType',
detailInfo: [{ detailInfo: [{
...@@ -91,9 +91,19 @@ export default { ...@@ -91,9 +91,19 @@ export default {
}, { }, {
label: '产品ID', label: '产品ID',
value: 'upgradeCommodityCode' value: 'upgradeCommodityCode'
},
{
label: '供应商名称',
value: 'thirdPartyName'
}] }]
}, },
{ {
name: 'purchaseGoodsName',
label: '产品别名',
width: '432px',
handleInput: true
},
{
name: 'purchasePrice', name: 'purchasePrice',
label: '采购价', label: '采购价',
type: 'input', type: 'input',
......
...@@ -117,11 +117,8 @@ ...@@ -117,11 +117,8 @@
:selected-scene="batchCopySelectScene" @handleBatchCopyConfirm="handleBatchCopyConfirm" :selected-scene="batchCopySelectScene" @handleBatchCopyConfirm="handleBatchCopyConfirm"
@handleBatchCopyClose="handleBatchCopyClose"> @handleBatchCopyClose="handleBatchCopyClose">
</batch-copy-dialog> </batch-copy-dialog>
<d2-file-import-dialog :is-visible="fileVisible" <d2-file-import-dialog :is-visible="fileVisible" title="上传文件" @closeDialog="handleBatchImport"
title="上传文件" @confirmDialog="handleConfirmImport" @downloadTemplate="exportTemplate" />
@closeDialog="handleBatchImport"
@confirmDialog="handleConfirmImport"
@downloadTemplate="exportTemplate" />
</d2-container> </d2-container>
</template> </template>
<script> <script>
...@@ -158,7 +155,9 @@ export default { ...@@ -158,7 +155,9 @@ export default {
status: '', status: '',
yqMerchantId: '', yqMerchantId: '',
goodsSource: 0, goodsSource: 0,
financeCheckFlag: '' financeCheckFlag: '',
thirdPartyName: '',
thirdPartyCode: ''
}, },
tempGoodsType: [], tempGoodsType: [],
getListApi: getGroundingManageList, getListApi: getGroundingManageList,
...@@ -250,6 +249,12 @@ export default { ...@@ -250,6 +249,12 @@ export default {
isClear: true, isClear: true,
keyFn: this.keyDowmGetList keyFn: this.keyDowmGetList
}, { }, {
label: '供应商名称',
name: 'thirdPartyName',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
label: '供应商编码', label: '供应商编码',
name: 'thirdPartyCode', name: 'thirdPartyCode',
type: 'input', type: 'input',
...@@ -295,7 +300,25 @@ export default { ...@@ -295,7 +300,25 @@ export default {
// formatter: (cellValue) => { // formatter: (cellValue) => {
// return cellValue.upgradeGoods.upgradeGoodsName || '-' // return cellValue.upgradeGoods.upgradeGoodsName || '-'
// } // }
}, { },
{
label: '供应商名称',
prop: 'thirdPartyName',
parentProp: 'upgradeGoods',
width: 100,
formatter: (cellValue) => {
return cellValue?.upgradeGoods?.thirdPartyName || '-'
}
},
{
label: '产品别名',
prop: 'purchaseGoodsName',
width: 120,
formatter: (cellValue) => {
return cellValue?.purchaseGoodsName || '-'
}
},
{
label: '规格', label: '规格',
prop: 'thirdPartyCode', prop: 'thirdPartyCode',
width: 140, width: 140,
...@@ -322,17 +345,17 @@ export default { ...@@ -322,17 +345,17 @@ export default {
label: '产品编码', label: '产品编码',
prop: 'type', prop: 'type',
parentProp: 'upgradeGoods', parentProp: 'upgradeGoods',
// formatter: (cellValue) => { formatter: (cellValue) => {
// return cellValue.upgradeGoods.type || '-' return cellValue.upgradeGoods.type || '-'
// } }
}, { }, {
label: '供应商编码', label: '供应商编码',
prop: 'thirdPartyCode', prop: 'thirdPartyCode',
parentProp: 'upgradeGoods', parentProp: 'upgradeGoods',
width: 100, width: 100,
// formatter: (cellValue) => { formatter: (cellValue) => {
// return cellValue?.upgradeGoods?.thirdPartyCode || '-' return cellValue?.upgradeGoods.thirdPartyCode || '-'
// } }
}, { }, {
label: '上架商户', label: '上架商户',
name: '', name: '',
......
<template> <template>
<div> <div>
<baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config" @closeDialog="handleDetailClose(false)"> <baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config"
@closeDialog="handleDetailClose(false)">
<div class="edit-order-dialog" v-if="dialogShow"> <div class="edit-order-dialog" v-if="dialogShow">
<div class="table-class"> <div class="table-class">
<d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :has-page="hasPage" @refreshTable="refreshTable" :table-data="tableList" :table-total="detailInfo.tableTotal"> <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :has-page="hasPage"
@refreshTable="refreshTable" :table-data="tableList" :table-total="detailInfo.tableTotal">
<div slot="nowPurNum" slot-scope="scope" style="margin: 0 8px;"> <div slot="nowPurNum" slot-scope="scope" style="margin: 0 8px;">
<el-select v-model="nowPurNumList[scope.index]" placeholder="请选择" clearable> <el-select v-model="nowPurNumList[scope.index]" placeholder="请选择" clearable>
<el-option v-for="item in staffList" :key="item.uuid" :label="item.staffName" :value="item.uuid"> <el-option v-for="item in staffList" :key="item.uuid" :label="item.staffName" :value="item.uuid">
...@@ -33,12 +35,17 @@ ...@@ -33,12 +35,17 @@
</div> </div>
<div class="footer"> <div class="footer">
<el-button @click="handleDetailClose(false)">取消</el-button> <el-button @click="handleDetailClose(false)">取消</el-button>
<el-button @click="submit" type="primary" v-preventReClick :loading="$store.state.d2admin.loading.value">确定</el-button> <el-button @click="submit" type="primary" v-preventReClick
:loading="$store.state.d2admin.loading.value">确定</el-button>
</div> </div>
</div> </div>
</baseDialog> </baseDialog>
<card-dialog v-if="cardVisible" :card-visible="cardVisible" :order-info="orderInfo" :selected-list="selectedCardList" @handleClose="handleCardDialog" @handleConfirm="handleCardConfirm"></card-dialog> <card-dialog v-if="cardVisible" :card-visible="cardVisible" :order-info="orderInfo" :selected-list="selectedCardList"
<glsk-form-dialog v-if="batchVisible" :selectVisible="batchVisible" :dialogConfig="batchDialogConfig" label-width="200px" :formRules="batchRules" :editData="batchForm" :editFormData="batchEditFormData" :baseData="{ staffList: staffList }" @handleClose="batchDialogVisible" @handleConfirm="handleBatchConfirm"></glsk-form-dialog> @handleClose="handleCardDialog" @handleConfirm="handleCardConfirm"></card-dialog>
<glsk-form-dialog v-if="batchVisible" :selectVisible="batchVisible" :dialogConfig="batchDialogConfig"
label-width="200px" :formRules="batchRules" :editData="batchForm" :editFormData="batchEditFormData"
:baseData="{ staffList: staffList }" @handleClose="batchDialogVisible"
@handleConfirm="handleBatchConfirm"></glsk-form-dialog>
</div> </div>
</template> </template>
...@@ -131,6 +138,11 @@ export default { ...@@ -131,6 +138,11 @@ export default {
prop: 'upgradeGoodsName' prop: 'upgradeGoodsName'
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: '产品编码', label: '产品编码',
prop: 'type' prop: 'type'
...@@ -140,11 +152,20 @@ export default { ...@@ -140,11 +152,20 @@ export default {
prop: 'specificationData' prop: 'specificationData'
}, },
{ {
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{
label: '适用车型', label: '适用车型',
addHtml: 'carName', addHtml: 'carName',
width: 200 width: 200
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: '系列', label: '系列',
prop: 'goodsName' prop: 'goodsName'
}, },
...@@ -347,7 +368,7 @@ export default { ...@@ -347,7 +368,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
> span { >span {
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
......
<!-- 审核 --> <!-- 审核 -->
<template> <template>
<baseDialog :dialog-config="dialogConfig" <baseDialog :dialog-config="dialogConfig" :is-show.sync="visible" class="accountDailog" @handleClick="handleAddConfirm">
:is-show.sync="visible"
class="accountDailog"
@handleClick="handleAddConfirm">
<div class="reject-dialog"> <div class="reject-dialog">
<div class="edit-page edit-tmpl"> <div class="edit-page edit-tmpl">
<div class="title"> <div class="title">
产品信息 产品信息
</div> </div>
<div class="content-box"> <div class="content-box">
<d2-table ref="purchaseOrderDetailTable" <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :table-data="detailInfo.tableData"
:table-params="tableParams" :layout="layout" :table-total="detailInfo.tableTotal" @refreshTable="refreshTable">
:table-data="detailInfo.tableData"
:layout="layout"
:table-total="detailInfo.tableTotal"
@refreshTable="refreshTable">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" <img v-if="scope.scope.refundStatus == 'Y'" class="return" src="@/assets/retrun.png"
class="return"
src="@/assets/retrun.png"
alt="" /> alt="" />
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
<template #filmRollNo="scope"> <template #filmRollNo="scope">
<div v-if=" <div v-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length == 1 && scope.scope.filmRollList.length == 1
"> ">
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if=" <div v-else-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length > 1 && scope.scope.filmRollList.length > 1
"> ">
<el-popover placement="top" <el-popover placement="top" width="200" trigger="hover">
width="200"
trigger="hover">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title"> <div class="title">
膜卷号 膜卷号
</div> </div>
<div v-for="(subItem, subIndex) in scope.scope.filmRollList" <div v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex"
:key="subIndex"
class="merchant-item"> class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
...@@ -70,15 +56,12 @@ ...@@ -70,15 +56,12 @@
</div> </div>
</template> </template>
<template #carName="scope"> <template #carName="scope">
<el-tooltip v-if=" <el-tooltip v-if="scope.scope.suitCarTypeList
scope.scope.suitCarTypeList
&& scope.scope.suitCarTypeList.length && scope.scope.suitCarTypeList.length
" " placement="top">
placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
<div v-for="(item, index) in scope.scope.suitCarTypeList" <div v-for="(item, index) in scope.scope.suitCarTypeList" :key="index">
:key="index">
{{ {{
`${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}` `${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}`
}} }}
...@@ -92,29 +75,21 @@ ...@@ -92,29 +75,21 @@
</div> </div>
</template> </template>
<template #actionSlot="scope"> <template #actionSlot="scope">
<el-button type="text" <el-button type="text" @click="handleInventoryDetail(scope.scope)">
@click="handleInventoryDetail(scope.scope)">
库存明细 库存明细
</el-button> </el-button>
</template> </template>
</d2-table> </d2-table>
</div> </div>
</div> </div>
<glsx-combi-form ref="editFormRef" <glsx-combi-form ref="editFormRef" class="edit-form-container" label-width="150px" default-width="350px"
class="edit-form-container" :form-ref="editChildRef" :form-obj="infoForm" :form-data="editFormData" :form-rules="formRules">
label-width="150px"
default-width="350px"
:form-ref="editChildRef"
:form-obj="infoForm"
:form-data="editFormData"
:form-rules="formRules">
</glsx-combi-form> </glsx-combi-form>
<span :style="{ 'margin-left': '150px' }">{{ txtObj[fromPage] }}</span> <span :style="{ 'margin-left': '150px' }">{{ txtObj[fromPage] }}</span>
<ExamineRecord :list="originalAuditDetaiList" style="margin-top:20px;" /> <ExamineRecord :list="originalAuditDetaiList" style="margin-top:20px;" />
</div> </div>
<StockDetailDialog v-if="stockDetailDialogVisible" <StockDetailDialog v-if="stockDetailDialogVisible" :visible.sync="stockDetailDialogVisible"
:visible.sync="stockDetailDialogVisible"
:record-info="stockDetailInfo" /> :record-info="stockDetailInfo" />
</baseDialog> </baseDialog>
</template> </template>
...@@ -217,6 +192,11 @@ export default { ...@@ -217,6 +192,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "type", prop: "type",
}, },
...@@ -224,6 +204,12 @@ export default { ...@@ -224,6 +204,12 @@ export default {
label: "规格", label: "规格",
prop: "specificationData", prop: "specificationData",
}, },
{
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{ {
label: "采购数量", label: "采购数量",
prop: "goodsNumber", prop: "goodsNumber",
...@@ -245,8 +231,7 @@ export default { ...@@ -245,8 +231,7 @@ export default {
const condition = baseConfig.membraneTypeList.includes( const condition = baseConfig.membraneTypeList.includes(
cellValue.goodsType, cellValue.goodsType,
) )
? `${ ? `${cellValue.conversionValue
cellValue.conversionValue
? cellValue.goodsNumber * cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue
: "-" : "-"
}米` }米`
...@@ -257,6 +242,10 @@ export default { ...@@ -257,6 +242,10 @@ export default {
}, },
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "已发货数量", label: "已发货数量",
prop: "purchaseNumber", prop: "purchaseNumber",
width: 110, width: 110,
...@@ -470,6 +459,7 @@ export default { ...@@ -470,6 +459,7 @@ export default {
color: #999999; color: #999999;
} }
} }
.edit-page.edit-tmpl { .edit-page.edit-tmpl {
background: #ffffff; background: #ffffff;
...@@ -483,10 +473,12 @@ export default { ...@@ -483,10 +473,12 @@ export default {
color: #333333; color: #333333;
} }
} }
.content-box { .content-box {
padding: 0 20px 20px; padding: 0 20px 20px;
background: #ffffff; background: #ffffff;
} }
.car-type-list { .car-type-list {
max-height: 300px; max-height: 300px;
overflow-y: scroll; overflow-y: scroll;
...@@ -498,6 +490,7 @@ export default { ...@@ -498,6 +490,7 @@ export default {
margin-right: 2px; margin-right: 2px;
vertical-align: middle; vertical-align: middle;
} }
.edit-form-container { .edit-form-container {
::v-deep .el-textarea { ::v-deep .el-textarea {
width: 432px !important; width: 432px !important;
......
<template> <template>
<div> <div>
<baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config" @closeDialog="handleDetailClose(false)"> <baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config"
@closeDialog="handleDetailClose(false)">
<div class="edit-order-dialog" v-if="dialogShow"> <div class="edit-order-dialog" v-if="dialogShow">
<div class="addressTitle"> <div class="addressTitle">
<img src="../images/addressIcon.webp" alt="" class="icon" /> <img src="../images/addressIcon.webp" alt="" class="icon" />
...@@ -23,18 +24,19 @@ ...@@ -23,18 +24,19 @@
{{ detailInfo.purchaseOrderRemark }}</span></span> {{ detailInfo.purchaseOrderRemark }}</span></span>
</div> --> </div> -->
<div class="table-class"> <div class="table-class">
<d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :has-page="hasPage" :table-data="tableList"> <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :has-page="hasPage"
:table-data="tableList">
<div slot="nowPurNum" slot-scope="scope" style="margin: 0 8px;"> <div slot="nowPurNum" slot-scope="scope" style="margin: 0 8px;">
<!-- 未退货才可以 --> <!-- 未退货才可以 -->
<div v-if=" <div v-if="(tableList[scope.index].purchaseNumber == 0 ||
(tableList[scope.index].purchaseNumber == 0 ||
tableList[scope.index].purchaseNumber != tableList[scope.index].purchaseNumber !=
tableList[scope.index].goodsNumber) && scope.scope.refundStatus != 'Y' tableList[scope.index].goodsNumber) && scope.scope.refundStatus != 'Y'
"> ">
<!-- 判断是否当前账户发货 --> <!-- 判断是否当前账户发货 -->
<el-input v-if=" <el-input v-if="(isEmptyEdit &&
(isEmptyEdit && !tableList[scope.index].shipperUuid) || tableList[scope.index].shipperUuid == userInfo.detail.uuid"
!tableList[scope.index].shipperUuid) || tableList[scope.index].shipperUuid == userInfo.detail.uuid" :class="{ 'border-red': !nowPurNumList[scope.index] && isSubmit }" placeholder="请输入" v-model="nowPurNumList[scope.index]" @input="(e) => handleInput(e, scope)"></el-input> :class="{ 'border-red': !nowPurNumList[scope.index] && isSubmit }" placeholder="请输入"
v-model="nowPurNumList[scope.index]" @input="(e) => handleInput(e, scope)"></el-input>
<!-- <div v-if="detailInfo.tableData[scope.index].shipperUuid != userInfo.detail.uuid">{{ detailInfo.tableData[scope.index].shipper }}</div> --> <!-- <div v-if="detailInfo.tableData[scope.index].shipperUuid != userInfo.detail.uuid">{{ detailInfo.tableData[scope.index].shipper }}</div> -->
<div v-else> <div v-else>
已分配:{{ tableList[scope.index].shipper }} 已分配:{{ tableList[scope.index].shipper }}
...@@ -49,7 +51,8 @@ ...@@ -49,7 +51,8 @@
</div> </div>
</div> </div>
<div slot="cardNum" slot-scope="scope" style="margin: 0 8px;"> <div slot="cardNum" slot-scope="scope" style="margin: 0 8px;">
<div v-if="tableList[scope.index].entityCardFlag != 'Y' || (tableList[scope.index].shipperUuid && tableList[scope.index].shipperUuid != userInfo.detail.uuid)"> <div
v-if="tableList[scope.index].entityCardFlag != 'Y' || (tableList[scope.index].shipperUuid && tableList[scope.index].shipperUuid != userInfo.detail.uuid)">
- -
</div> </div>
<div v-else-if="tableList[scope.index].purchaseNumber != tableList[scope.index].goodsNumber"> <div v-else-if="tableList[scope.index].purchaseNumber != tableList[scope.index].goodsNumber">
...@@ -83,10 +86,12 @@ ...@@ -83,10 +86,12 @@
<div class="form-content"> <div class="form-content">
<el-form label-width="100px" :rules="dialogRules" :model="dialogData" ref="delivery-dialog-form"> <el-form label-width="100px" :rules="dialogRules" :model="dialogData" ref="delivery-dialog-form">
<el-form-item label="承运公司:" prop="deliveryCompany"> <el-form-item label="承运公司:" prop="deliveryCompany">
<el-input placeholder="请输入承运物流公司" maxlength="20" v-model.trim="dialogData.deliveryCompany" class="dis-in-block" /> <el-input placeholder="请输入承运物流公司" maxlength="20" v-model.trim="dialogData.deliveryCompany"
class="dis-in-block" />
</el-form-item> </el-form-item>
<el-form-item label="承运单号:" prop="deliveryNumber"> <el-form-item label="承运单号:" prop="deliveryNumber">
<el-input maxlength="50" placeholder="请输入承运物流单号" v-model.trim="dialogData.deliveryNumber" class="dis-in-block" @input="deliveryNumberInput" /> <el-input maxlength="50" placeholder="请输入承运物流单号" v-model.trim="dialogData.deliveryNumber"
class="dis-in-block" @input="deliveryNumberInput" />
</el-form-item> </el-form-item>
<el-form-item label="发货时间:" prop="deliveryDate"> <el-form-item label="发货时间:" prop="deliveryDate">
<el-date-picker class="dis-in-block" v-model="dialogData.deliveryDate" type="datetime" placeholder="选择日期时间"> <el-date-picker class="dis-in-block" v-model="dialogData.deliveryDate" type="datetime" placeholder="选择日期时间">
...@@ -108,11 +113,15 @@ ...@@ -108,11 +113,15 @@
:value="item.id" :value="item.id"
/> />
</el-select> --> </el-select> -->
<el-select class="dis-in-block" v-model="dialogData.shippingWarehouseId" clearable placeholder="请选择发货仓库" @change="selectChange($event)" @blur="selectBlur" @focus="selectFocus" filterable> <el-select class="dis-in-block" v-model="dialogData.shippingWarehouseId" clearable placeholder="请选择发货仓库"
<el-option v-for="(item, index) in shippingWarehouseList" :key="item.id" :label="item.name" :value="item.id"> @change="selectChange($event)" @blur="selectBlur" @focus="selectFocus" filterable>
<el-option v-for="(item, index) in shippingWarehouseList" :key="item.id" :label="item.name"
:value="item.id">
<!-- 发货仓库 --> <!-- 发货仓库 -->
<div class="flex-option"> <div class="flex-option">
<el-input v-show="editOptionIndex == index" :maxlength="10" class="add-option-input" :autofocus="true" @click.stop.native="editOptionFocus" v-model.trim="editOptionValue" size="small" placeholder="请输入" /> <el-input v-show="editOptionIndex == index" :maxlength="10" class="add-option-input"
:autofocus="true" @click.stop.native="editOptionFocus" v-model.trim="editOptionValue" size="small"
placeholder="请输入" />
<span v-show="editOptionIndex == -1 || editOptionIndex != index <span v-show="editOptionIndex == -1 || editOptionIndex != index
" class="add-option-input">{{ item.name }}</span> " class="add-option-input">{{ item.name }}</span>
<div> <div>
...@@ -122,15 +131,18 @@ ...@@ -122,15 +131,18 @@
<i v-show="shippingWarehouseList.length > 1 && <i v-show="shippingWarehouseList.length > 1 &&
editOptionIndex == index editOptionIndex == index
" class="el-icon-check option_icon add_icon" @click.stop="editOptionConfirm(item.id)" /> " class="el-icon-check option_icon add_icon" @click.stop="editOptionConfirm(item.id)" />
<i v-if="shippingWarehouseList.length > 1" class="el-icon-close del_icon" @click.stop="delOption(item.id)" /> <i v-if="shippingWarehouseList.length > 1" class="el-icon-close del_icon"
@click.stop="delOption(item.id)" />
</div> </div>
</div> </div>
</el-option> </el-option>
<div class="add-option"> <div class="add-option">
<div v-if="showOptionInput" class="flex-option"> <div v-if="showOptionInput" class="flex-option">
<el-input class="add-option-input" :maxlength="10" v-model.trim="addOptionValue" size="small" placeholder="请输入" @blur="clearValidateHandle" id="add-option-input" /> <el-input class="add-option-input" :maxlength="10" v-model.trim="addOptionValue" size="small"
placeholder="请输入" @blur="clearValidateHandle" id="add-option-input" />
<div> <div>
<i v-if="addOptionValue" class="el-icon-check option_icon add_icon" @click.stop="addOptionConfirm()" /> <i v-if="addOptionValue" class="el-icon-check option_icon add_icon"
@click.stop="addOptionConfirm()" />
<i class="el-icon-close option_icon del_icon" @click.stop="delOption(undefined)" /> <i class="el-icon-close option_icon del_icon" @click.stop="delOption(undefined)" />
</div> </div>
</div> </div>
...@@ -152,11 +164,13 @@ ...@@ -152,11 +164,13 @@
<div class="footer"> <div class="footer">
<el-button @click="handleDetailClose(false)">取消</el-button> <el-button @click="handleDetailClose(false)">取消</el-button>
<el-button @click="submit" type="primary" v-preventReClick :loading="$store.state.d2admin.loading.value">确定</el-button> <el-button @click="submit" type="primary" v-preventReClick
:loading="$store.state.d2admin.loading.value">确定</el-button>
</div> </div>
</div> </div>
</baseDialog> </baseDialog>
<card-dialog v-if="cardVisible" :card-visible="cardVisible" :order-info="orderInfo" :card-max-num="cardMaxNum" :selected-list="selectedCardList" @handleClose="handleCardDialog" @handleConfirm="handleCardConfirm"></card-dialog> <card-dialog v-if="cardVisible" :card-visible="cardVisible" :order-info="orderInfo" :card-max-num="cardMaxNum"
:selected-list="selectedCardList" @handleClose="handleCardDialog" @handleConfirm="handleCardConfirm"></card-dialog>
</div> </div>
</template> </template>
...@@ -254,6 +268,11 @@ export default { ...@@ -254,6 +268,11 @@ export default {
prop: 'upgradeGoodsName' prop: 'upgradeGoodsName'
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "type" prop: "type"
}, },
...@@ -261,6 +280,11 @@ export default { ...@@ -261,6 +280,11 @@ export default {
label: "规格", label: "规格",
prop: "specificationData" prop: "specificationData"
}, },
{
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{ {
label: '适用车型', label: '适用车型',
...@@ -309,6 +333,10 @@ export default { ...@@ -309,6 +333,10 @@ export default {
width: 150 width: 150
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "已发货数量", label: "已发货数量",
prop: "purchaseNumber", prop: "purchaseNumber",
width: 120, width: 120,
...@@ -661,7 +689,7 @@ export default { ...@@ -661,7 +689,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
> span { >span {
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
......
<!-- 发货单详情弹窗 --> <!-- 发货单详情弹窗 -->
<template> <template>
<div> <div>
<baseDialog title="详细信息" :is-show.sync="detailVisible" :config="dialogConfig.setting" :dialog-config="dialogConfig.config" width="1050px" :no-cancel="true" btn-ok-label="关闭" @closeDialog="handleClose" @confirmDialog="handleClose"> <baseDialog title="详细信息" :is-show.sync="detailVisible" :config="dialogConfig.setting"
:dialog-config="dialogConfig.config" width="1050px" :no-cancel="true" btn-ok-label="关闭" @closeDialog="handleClose"
@confirmDialog="handleClose">
<div class="stockMonthDailog"> <div class="stockMonthDailog">
<div class="addressTitle"> <div class="addressTitle">
<img src="../images/addressIcon.webp" alt="" class="icon"> <img src="../images/addressIcon.webp" alt="" class="icon">
...@@ -30,11 +32,13 @@ ...@@ -30,11 +32,13 @@
<span>{{ itemList.deliveryDate }}</span> <span>{{ itemList.deliveryDate }}</span>
</div> </div>
<div> <div>
<el-button style="padding: 0;" v-if="itemList.putStatus == 0" type="text" @click="handleEdit(itemList)">编辑</el-button> <el-button style="padding: 0;" v-if="itemList.putStatus == 0" type="text"
@click="handleEdit(itemList)">编辑</el-button>
<el-button style="padding: 0;" type="text" @click="handleSign(itemList)">发货签收单</el-button> <el-button style="padding: 0;" type="text" @click="handleSign(itemList)">发货签收单</el-button>
</div> </div>
</div> </div>
<d2-table ref="recordTable" :table-data="itemList.deliveryDetailList" :table-params="tableParams" :has-page="false"> <d2-table ref="recordTable" :table-data="itemList.deliveryDetailList" :table-params="tableParams"
:has-page="false">
<span slot="deliveryCard" slot-scope="scope"> <span slot="deliveryCard" slot-scope="scope">
<template v-if="scope.scope.deliveryCardList && scope.scope.deliveryCardList.length > 1"> <template v-if="scope.scope.deliveryCardList && scope.scope.deliveryCardList.length > 1">
<!-- {{ scope.scope.deliveryCardList.length || 0 }} --> <!-- {{ scope.scope.deliveryCardList.length || 0 }} -->
...@@ -52,12 +56,17 @@ ...@@ -52,12 +56,17 @@
</div> </div>
</div> </div>
</baseDialog> </baseDialog>
<baseDialog title="查看发货卡号" :config="carDialogConfig.setting" :dialog-config="carDialogConfig.config" :is-show.sync="handleDeliveryCardVisible" width="500px" :no-cancel="true" btn-ok-label="关闭" @closeDialog="handleDeliveryCardVisible = false" @confirmDialog="handleDeliveryCardVisible = false"> <baseDialog title="查看发货卡号" :config="carDialogConfig.setting" :dialog-config="carDialogConfig.config"
<d2-table class="deliveryCardCon" ref="recordTable" :table-data="deliveryCardList" :table-params="innerParams" :has-page="false"> :is-show.sync="handleDeliveryCardVisible" width="500px" :no-cancel="true" btn-ok-label="关闭"
@closeDialog="handleDeliveryCardVisible = false" @confirmDialog="handleDeliveryCardVisible = false">
<d2-table class="deliveryCardCon" ref="recordTable" :table-data="deliveryCardList" :table-params="innerParams"
:has-page="false">
</d2-table> </d2-table>
</baseDialog> </baseDialog>
<!-- 编辑 --> <!-- 编辑 -->
<glsk-form-dialog v-if="editVisible" :selectVisible="editVisible" :dialogConfig="editDialogConfig" label-width="104px" dialog-width="520px" :formRules="editRules" :editData="editData" :editFormData="editFormData" :base-data="baseData" @handleClose="editVisible = false" @handleConfirm="handleEditConfirm"></glsk-form-dialog> <glsk-form-dialog v-if="editVisible" :selectVisible="editVisible" :dialogConfig="editDialogConfig" label-width="104px"
dialog-width="520px" :formRules="editRules" :editData="editData" :editFormData="editFormData" :base-data="baseData"
@handleClose="editVisible = false" @handleConfirm="handleEditConfirm"></glsk-form-dialog>
</div> </div>
</template> </template>
...@@ -120,6 +129,11 @@ export default { ...@@ -120,6 +129,11 @@ export default {
prop: 'upgradeGoodsName' prop: 'upgradeGoodsName'
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: '产品编码', label: '产品编码',
prop: 'type' prop: 'type'
}, },
...@@ -128,6 +142,15 @@ export default { ...@@ -128,6 +142,15 @@ export default {
prop: 'specificationData' prop: 'specificationData'
}, },
{ {
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: '发货数量', label: '发货数量',
prop: 'purchaseNumber', prop: 'purchaseNumber',
formatter: cellValue => { formatter: cellValue => {
...@@ -321,7 +344,7 @@ export default { ...@@ -321,7 +344,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
> span { >span {
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
...@@ -347,10 +370,12 @@ export default { ...@@ -347,10 +370,12 @@ export default {
display: flex; display: flex;
width: 319px; width: 319px;
} }
.detail-label { .detail-label {
width: 70px; width: 70px;
flex-shrink: 0; flex-shrink: 0;
} }
span { span {
color: #333333ff; color: #333333ff;
} }
......
<template> <template>
<baseDialog :is-show.sync="dialogShow" <baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config"
:config="dialogConfig.setting"
:dialog-config="dialogConfig.config"
@closeDialog="handleDetailClose"> @closeDialog="handleDetailClose">
<div v-if="dialogShow" class="detail-content"> <div v-if="dialogShow" class="detail-content">
<div class="addressTitle"> <div class="addressTitle">
<img src="../images/addressIcon.webp" <img src="../images/addressIcon.webp" alt="" class="icon" />
alt=""
class="icon" />
<span class="title">{{ paramsObj.merchantName }}</span> <span class="title">{{ paramsObj.merchantName }}</span>
</div> </div>
<div class="address-info"> <div class="address-info">
...@@ -42,8 +38,7 @@ ...@@ -42,8 +38,7 @@
</span> </span>
</span> </span>
</div> </div>
<div v-if="detailInfo.terminateDeliveryInstruction" <div v-if="detailInfo.terminateDeliveryInstruction" class="address-info">
class="address-info">
<span class="address"> <span class="address">
结束发货说明:<span class="label"> 结束发货说明:<span class="label">
{{ {{
...@@ -53,28 +48,18 @@ ...@@ -53,28 +48,18 @@
</span> </span>
</div> </div>
<div class="table-class"> <div class="table-class">
<d2-table ref="purchaseOrderDetailTable" <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :table-data="detailInfo.tableData"
:table-params="tableParams" :table-total="detailInfo.tableTotal" @refreshTable="refreshTable">
:table-data="detailInfo.tableData"
:table-total="detailInfo.tableTotal"
@refreshTable="refreshTable">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" <img v-if="scope.scope.refundStatus == 'Y'" class="return" src="@/assets/retrun.png" alt="" />
class="return"
src="@/assets/retrun.png"
alt="" />
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
<template #uploadFileUrls="scope"> <template #uploadFileUrls="scope">
<div v-if="scope.scope.uploadFileUrls"> <div v-if="scope.scope.uploadFileUrls">
<el-image fit="fill" <el-image fit="fill" :preview-src-list="scope.scope.uploadFileUrls.split(',')
:preview-src-list=" " :src="scope.scope.uploadFileUrls.split(',')[0]" style="width: 36px; height: 36px">
scope.scope.uploadFileUrls.split(',')
"
:src="scope.scope.uploadFileUrls.split(',')[0]"
style="width: 36px; height: 36px">
</el-image> </el-image>
</div> </div>
<div v-else> <div v-else>
...@@ -82,27 +67,21 @@ ...@@ -82,27 +67,21 @@
</div> </div>
</template> </template>
<template #filmRollNo="scope"> <template #filmRollNo="scope">
<div v-if=" <div v-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length == 1 && scope.scope.filmRollList.length == 1
"> ">
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if=" <div v-else-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length > 1 && scope.scope.filmRollList.length > 1
"> ">
<el-popover placement="top" <el-popover placement="top" width="200" trigger="hover">
width="200"
trigger="hover">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title"> <div class="title">
膜卷号 膜卷号
</div> </div>
<div v-for="(subItem, subIndex) in scope <div v-for="(subItem, subIndex) in scope
.scope.filmRollList" .scope.filmRollList" :key="subIndex" class="merchant-item">
:key="subIndex"
class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
</div> </div>
...@@ -129,16 +108,13 @@ ...@@ -129,16 +108,13 @@
</div> </div>
</template> </template>
<template #carName="scope"> <template #carName="scope">
<el-tooltip v-if=" <el-tooltip v-if="scope.scope.suitCarTypeList
scope.scope.suitCarTypeList
&& scope.scope.suitCarTypeList.length && scope.scope.suitCarTypeList.length
" " placement="top">
placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
<div v-for="(item, index) in scope.scope <div v-for="(item, index) in scope.scope
.suitCarTypeList" .suitCarTypeList" :key="index">
:key="index">
{{ {{
`${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}` `${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}`
}} }}
...@@ -155,10 +131,8 @@ ...@@ -155,10 +131,8 @@
</template> </template>
</d2-table> </d2-table>
</div> </div>
<ExamineRecord v-if="detailInfo.auditDetaiList && !paramsObj.factoryType" <ExamineRecord v-if="detailInfo.auditDetaiList && !paramsObj.factoryType" :use-expand="false"
:use-expand="false" :list="detailInfo.auditDetaiList" style="margin-top:20px;" />
:list="detailInfo.auditDetaiList"
style="margin-top:20px;" />
</div> </div>
</baseDialog> </baseDialog>
...@@ -224,6 +198,11 @@ export default { ...@@ -224,6 +198,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "type", prop: "type",
}, },
...@@ -232,11 +211,20 @@ export default { ...@@ -232,11 +211,20 @@ export default {
prop: "specificationData", prop: "specificationData",
}, },
{ {
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100,
},
{
label: "适用车型", label: "适用车型",
addHtml: "carName", addHtml: "carName",
width: 200, width: 200,
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "系列", label: "系列",
prop: "goodsName", prop: "goodsName",
}, },
...@@ -268,8 +256,7 @@ export default { ...@@ -268,8 +256,7 @@ export default {
= baseConfig.membraneTypeList.includes( = baseConfig.membraneTypeList.includes(
cellValue.goodsType, cellValue.goodsType,
) )
? `${ ? `${cellValue.conversionValue
cellValue.conversionValue
? cellValue.goodsNumber ? cellValue.goodsNumber
* cellValue.conversionValue * cellValue.conversionValue
: "-" : "-"
...@@ -448,7 +435,7 @@ export default { ...@@ -448,7 +435,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
> span { >span {
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
......
<!-- 驳回 --> <!-- 驳回 -->
<template> <template>
<baseDialog :dialog-config="dialogConfig" <baseDialog :dialog-config="dialogConfig" :is-show.sync="visible" class="accountDailog" @handleClick="handleAddConfirm">
:is-show.sync="visible"
class="accountDailog"
@handleClick="handleAddConfirm">
<div class="reject-dialog"> <div class="reject-dialog">
<div class="edit-page edit-tmpl"> <div class="edit-page edit-tmpl">
<div class="title"> <div class="title">
产品信息 产品信息
</div> </div>
<div class="content-box"> <div class="content-box">
<d2-table ref="purchaseOrderDetailTable" <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :table-data="detailInfo.tableData"
:table-params="tableParams" :layout="layout" :table-total="detailInfo.tableTotal" @refreshTable="refreshTable">
:table-data="detailInfo.tableData"
:layout="layout"
:table-total="detailInfo.tableTotal"
@refreshTable="refreshTable">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" <img v-if="scope.scope.refundStatus == 'Y'" class="return" src="@/assets/retrun.png"
class="return"
src="@/assets/retrun.png"
alt="" /> alt="" />
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
<template #filmRollNo="scope"> <template #filmRollNo="scope">
<div v-if=" <div v-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length == 1 && scope.scope.filmRollList.length == 1
"> ">
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if=" <div v-else-if="scope.scope.filmRollList
scope.scope.filmRollList
&& scope.scope.filmRollList.length > 1 && scope.scope.filmRollList.length > 1
"> ">
<el-popover placement="top" <el-popover placement="top" width="200" trigger="hover">
width="200"
trigger="hover">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title"> <div class="title">
膜卷号 膜卷号
</div> </div>
<div v-for="(subItem, subIndex) in scope.scope.filmRollList" <div v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex"
:key="subIndex"
class="merchant-item"> class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
...@@ -65,15 +51,12 @@ ...@@ -65,15 +51,12 @@
</div> </div>
</template> </template>
<template #carName="scope"> <template #carName="scope">
<el-tooltip v-if=" <el-tooltip v-if="scope.scope.suitCarTypeList
scope.scope.suitCarTypeList
&& scope.scope.suitCarTypeList.length && scope.scope.suitCarTypeList.length
" " placement="top">
placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
<div v-for="(item, index) in scope.scope.suitCarTypeList" <div v-for="(item, index) in scope.scope.suitCarTypeList" :key="index">
:key="index">
{{ {{
`${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}` `${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}`
}} }}
...@@ -87,43 +70,29 @@ ...@@ -87,43 +70,29 @@
</div> </div>
</template> </template>
<template #actionSlot="scope"> <template #actionSlot="scope">
<el-button type="text" <el-button type="text" @click="handleInventoryDetail(scope.scope)">
@click="handleInventoryDetail(scope.scope)">
库存明细 库存明细
</el-button> </el-button>
</template> </template>
</d2-table> </d2-table>
</div> </div>
</div> </div>
<el-form ref="refundForm" <el-form ref="refundForm" label-width="150px" :model="infoForm" :rules="formRules">
label-width="150px"
:model="infoForm"
:rules="formRules">
<el-form-item label="驳回节点:" prop="rejectNode"> <el-form-item label="驳回节点:" prop="rejectNode">
<el-select v-model="infoForm.rejectNode" <el-select v-model="infoForm.rejectNode" placeholder="请选择驳回节点" style="width: 450px">
placeholder="请选择驳回节点" <el-option v-for="item in baseData.rejectNodeOptions" :key="item.id" :label="item.label"
style="width: 450px">
<el-option v-for="item in baseData.rejectNodeOptions"
:key="item.id"
:label="item.label"
:value="item.id" /> :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="驳回原因:" prop="rejectCause"> <el-form-item label="驳回原因:" prop="rejectCause">
<el-input v-model="infoForm.rejectCause" <el-input v-model="infoForm.rejectCause" type="textarea" :row="4" show-word-limit placeholder="请输入驳回原因"
type="textarea" maxlength="200" class="reject-input" />
:row="4"
show-word-limit
placeholder="请输入驳回原因"
maxlength="200"
class="reject-input" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<ExamineRecord :list="originalAuditDetaiList" style="margin-top:20px;" /> <ExamineRecord :list="originalAuditDetaiList" style="margin-top:20px;" />
</div> </div>
<StockDetailDialog v-if="stockDetailDialogVisible" <StockDetailDialog v-if="stockDetailDialogVisible" :visible.sync="stockDetailDialogVisible"
:visible.sync="stockDetailDialogVisible"
:record-info="stockDetailInfo" /> :record-info="stockDetailInfo" />
</baseDialog> </baseDialog>
</template> </template>
...@@ -216,6 +185,11 @@ export default { ...@@ -216,6 +185,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "type", prop: "type",
}, },
...@@ -224,6 +198,11 @@ export default { ...@@ -224,6 +198,11 @@ export default {
prop: "specificationData", prop: "specificationData",
}, },
{ {
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{
label: "采购数量", label: "采购数量",
prop: "goodsNumber", prop: "goodsNumber",
formatter: (cellValue) => { formatter: (cellValue) => {
...@@ -244,8 +223,7 @@ export default { ...@@ -244,8 +223,7 @@ export default {
const condition = baseConfig.membraneTypeList.includes( const condition = baseConfig.membraneTypeList.includes(
cellValue.goodsType, cellValue.goodsType,
) )
? `${ ? `${cellValue.conversionValue
cellValue.conversionValue
? cellValue.goodsNumber * cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue
: "-" : "-"
}米` }米`
...@@ -255,6 +233,7 @@ export default { ...@@ -255,6 +233,7 @@ export default {
: `${cellValue.goodsNumber}件`; : `${cellValue.goodsNumber}件`;
}, },
}, },
{ {
label: "已发货数量", label: "已发货数量",
prop: "purchaseNumber", prop: "purchaseNumber",
...@@ -266,6 +245,10 @@ export default { ...@@ -266,6 +245,10 @@ export default {
}, },
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "单价", label: "单价",
prop: "upgradePurchasePrice", prop: "upgradePurchasePrice",
formatter: (row) => { formatter: (row) => {
...@@ -410,6 +393,7 @@ export default { ...@@ -410,6 +393,7 @@ export default {
.tips { .tips {
color: #999999; color: #999999;
} }
.edit-page.edit-tmpl { .edit-page.edit-tmpl {
background: #ffffff; background: #ffffff;
...@@ -423,10 +407,12 @@ export default { ...@@ -423,10 +407,12 @@ export default {
color: #333333; color: #333333;
} }
} }
.content-box { .content-box {
padding: 0 20px 20px; padding: 0 20px 20px;
background: #ffffff; background: #ffffff;
} }
.car-type-list { .car-type-list {
max-height: 300px; max-height: 300px;
overflow-y: scroll; overflow-y: scroll;
......
...@@ -3,16 +3,11 @@ ...@@ -3,16 +3,11 @@
<d2-container class="container"> <d2-container class="container">
<template #header> <template #header>
<div class="header"> <div class="header">
<d2-search ref="showSearch" <d2-search ref="showSearch" :labelWidth="labelWidth" class="show-search" :form-data="showFormData"
class="show-search"
:form-data="showFormData"
:search-form="searchForm"> :search-form="searchForm">
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" <el-button :id="tableParams.btnId" handle size="small" type="primary">
handle
size="small"
type="primary">
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> <el-button size="small" @click="handleReset">
...@@ -30,27 +25,18 @@ ...@@ -30,27 +25,18 @@
<auth-button category="Button" :show-btn-ids="['9090704']" /> <auth-button category="Button" :show-btn-ids="['9090704']" />
</span> </span>
</d2-table-header> </d2-table-header>
<d2-table ref="purchaseAndDeliveryTable" <d2-table ref="purchaseAndDeliveryTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi"
:before-search-fn="beforeSearchFn" :search-form="tableSearchForm" :table-params="tableParams" @searchChange="searchChange"
:get-list-api="getListApi" @selectionTable="handleSelectionTable" @setTableFinishFun="setTableFinishFun">
:search-form="tableSearchForm"
:table-params="tableParams"
@searchChange="searchChange"
@selectionTable="handleSelectionTable"
@setTableFinishFun="setTableFinishFun">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" <img v-if="scope.scope.refundStatus == 'Y'" alt="" class="return" src="@/assets/retrun.png">
alt=""
class="return"
src="@/assets/retrun.png">
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
<template #suitCarTypeList="scope"> <template #suitCarTypeList="scope">
<div> <div>
<el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length" <el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length" effect="dark"
effect="dark"
placement="top"> placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
...@@ -72,7 +58,9 @@ ...@@ -72,7 +58,9 @@
</span> </span>
<!-- 确认发货 --> <!-- 确认发货 -->
<!-- style="margin-right: 10px;" --> <!-- style="margin-right: 10px;" -->
<span v-if="scope.scope.refundStatus != 'Y' && (scope.scope.deliveryStatus == 1 || scope.scope.deliveryStatus == 3)" style="margin-right: 10px;"> <span
v-if="scope.scope.refundStatus != 'Y' && (scope.scope.deliveryStatus == 1 || scope.scope.deliveryStatus == 3)"
style="margin-right: 10px;">
<auth-button :data="scope.scope" :show-btn-ids="['9090702']" /> <auth-button :data="scope.scope" :show-btn-ids="['9090702']" />
</span> </span>
<!-- <el-button :data="scope.scope" type="text" @click="handleDelivery(scope.scope)">发货</el-button> --> <!-- <el-button :data="scope.scope" type="text" @click="handleDelivery(scope.scope)">发货</el-button> -->
...@@ -89,36 +77,20 @@ ...@@ -89,36 +77,20 @@
</template> </template>
</d2-table> </d2-table>
</div> </div>
<FactoryDeliveryDetailDialog v-if="detailVisible" <FactoryDeliveryDetailDialog v-if="detailVisible" :record-info="detailInfo" :visible.sync="detailVisible">
:record-info="detailInfo"
:visible.sync="detailVisible">
</FactoryDeliveryDetailDialog> </FactoryDeliveryDetailDialog>
<EditOrderDialog v-if="editVisible" <EditOrderDialog v-if="editVisible" page="factory" :params-obj="dialogData" :table-list="editTableList"
page="factory" :visible.sync="editVisible" @editClose="editClose">
:params-obj="dialogData"
:table-list="editTableList"
:visible.sync="editVisible"
@editClose="editClose">
</EditOrderDialog> </EditOrderDialog>
<!-- :config="rejectConfig.setting" :dialog-config="rejectConfig.config" :config="rejectConfig.setting" --> <!-- :config="rejectConfig.setting" :dialog-config="rejectConfig.config" :config="rejectConfig.setting" -->
<baseDialog :dialog-config="rejectConfig.config" <baseDialog :dialog-config="rejectConfig.config" :is-show.sync="rejectVisible" @handleClick="handleRejectConfirm">
:is-show.sync="rejectVisible"
@handleClick="handleRejectConfirm">
<!-- <d2-dialog v-if="rejectVisible" :is-visible="rejectVisible" title="驳回提2" @confirmDialog="handleRejectConfirm" <!-- <d2-dialog v-if="rejectVisible" :is-visible="rejectVisible" title="驳回提2" @confirmDialog="handleRejectConfirm"
@closeDialog="handleRejectClose"> --> @closeDialog="handleRejectClose"> -->
<div class="reject-dialog"> <div class="reject-dialog">
<el-form ref="delivery-dialog-form" <el-form ref="delivery-dialog-form" label-width="150px" :model="rejectData" :rules="rejectRules">
label-width="150px"
:model="rejectData"
:rules="rejectRules">
<el-form-item label="驳回原因:" prop="rejectCause"> <el-form-item label="驳回原因:" prop="rejectCause">
<el-input v-model.trim="rejectData.rejectCause" <el-input v-model.trim="rejectData.rejectCause" class="dis-in-block reject-input" maxlength="50"
class="dis-in-block reject-input" placeholder="请输入驳回原因" :rows="3" show-word-limit type="textarea" />
maxlength="50"
placeholder="请输入驳回原因"
:rows="3"
show-word-limit
type="textarea" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -149,6 +121,7 @@ export default { ...@@ -149,6 +121,7 @@ export default {
}, },
data() { data() {
return { return {
labelWidth: '100px',
editVisible: false, editVisible: false,
editTableList: [], editTableList: [],
reg: { reg: {
...@@ -251,6 +224,19 @@ export default { ...@@ -251,6 +224,19 @@ export default {
type: "datePicker", type: "datePicker",
isClear: true, isClear: true,
}, },
{
label: '供应商名称',
name: 'thirdPartyName',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
label: '供应商编码',
name: 'thirdPartyCode',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}
], ],
selectedList: [], selectedList: [],
getListApi: warehousedeliverPage, getListApi: warehousedeliverPage,
...@@ -268,6 +254,11 @@ export default { ...@@ -268,6 +254,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: '供应商名称',
prop: 'thirdPartyName',
width: 100
},
{
label: "产品编码", label: "产品编码",
prop: "type", prop: "type",
}, },
...@@ -285,6 +276,11 @@ export default { ...@@ -285,6 +276,11 @@ export default {
}, },
}, },
{ {
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{
label: "系列", label: "系列",
prop: "goodsName", prop: "goodsName",
}, },
...@@ -312,6 +308,10 @@ export default { ...@@ -312,6 +308,10 @@ export default {
prop: "purchaseNumber", prop: "purchaseNumber",
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "订单编号", label: "订单编号",
prop: "orderCode", prop: "orderCode",
}, },
...@@ -698,6 +698,7 @@ export default { ...@@ -698,6 +698,7 @@ export default {
max-height: 320px; max-height: 320px;
overflow-y: scroll; overflow-y: scroll;
} }
.return { .return {
width: 15px; width: 15px;
height: 14px; height: 14px;
......
...@@ -6,18 +6,11 @@ ...@@ -6,18 +6,11 @@
产品信息 产品信息
</div> </div>
<div class="content-box"> <div class="content-box">
<d2-table ref="purchaseOrderDetailTable" <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" :table-data="detailInfo.tableData"
:table-params="tableParams" :layout="layout" :table-total="detailInfo.tableTotal" @refreshTable="refreshTable">
:table-data="detailInfo.tableData"
:layout="layout"
:table-total="detailInfo.tableTotal"
@refreshTable="refreshTable">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" <img v-if="scope.scope.refundStatus == 'Y'" class="return" src="@/assets/retrun.png" alt="">
class="return"
src="@/assets/retrun.png"
alt="">
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
...@@ -26,15 +19,12 @@ ...@@ -26,15 +19,12 @@
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1"> <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1">
<el-popover placement="top" <el-popover placement="top" width="200" trigger="hover">
width="200"
trigger="hover">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title"> <div class="title">
膜卷号 膜卷号
</div> </div>
<div v-for="(subItem, subIndex) in scope.scope.filmRollList" <div v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex"
:key="subIndex"
class="merchant-item"> class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
...@@ -52,7 +42,8 @@ ...@@ -52,7 +42,8 @@
</div> </div>
</template> </template>
<template #carName="scope"> <template #carName="scope">
<el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length" placement="top"> <el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length"
placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
<div v-for="(item, index) in scope.scope.suitCarTypeList" :key="index"> <div v-for="(item, index) in scope.scope.suitCarTypeList" :key="index">
...@@ -71,25 +62,15 @@ ...@@ -71,25 +62,15 @@
</div> </div>
</div> </div>
<div class="content-box"> <div class="content-box">
<glsx-combi-form ref="editFormRef" <glsx-combi-form ref="editFormRef" class="edit-form-container" label-width="150px" default-width="470px"
class="edit-form-container" :is-block="isBlock" :form-ref="editChildRef" :form-obj="infoForm" :form-data="editFormData"
label-width="150px"
default-width="470px"
:is-block="isBlock"
:form-ref="editChildRef"
:form-obj="infoForm"
:form-data="editFormData"
:form-rules="formRules"> :form-rules="formRules">
</glsx-combi-form> </glsx-combi-form>
<ExamineRecord :use-expand="false" <ExamineRecord :use-expand="false" :list="detailInfo.auditDetaiList" style="margin-top:20px;" />
:list="detailInfo.auditDetaiList"
style="margin-top:20px;" />
</div> </div>
<div class="footer"> <div class="footer">
<el-button type="primary" <el-button type="primary" :loading="loading" @click="handleConfirm">
:loading="loading"
@click="handleConfirm">
确定 确定
</el-button> </el-button>
<el-button @click="handleCancel"> <el-button @click="handleCancel">
...@@ -140,6 +121,11 @@ export default { ...@@ -140,6 +121,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "供应商名称",
prop: 'thirdPartyName',
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "type", prop: "type",
}, },
...@@ -147,6 +133,12 @@ export default { ...@@ -147,6 +133,12 @@ export default {
label: "规格", label: "规格",
prop: "specificationData", prop: "specificationData",
}, },
{
label: '供应商编码',
prop: 'thirdPartyCode',
width: 100
},
{ {
label: "采购数量", label: "采购数量",
prop: "goodsNumber", prop: "goodsNumber",
...@@ -163,6 +155,7 @@ export default { ...@@ -163,6 +155,7 @@ export default {
return this.paramsObj.purchaseType == 1 ? condition : `${cellValue.goodsNumber}件`; return this.paramsObj.purchaseType == 1 ? condition : `${cellValue.goodsNumber}件`;
}, },
}, },
{ {
label: "已发货数量", label: "已发货数量",
prop: "purchaseNumber", prop: "purchaseNumber",
...@@ -172,6 +165,10 @@ export default { ...@@ -172,6 +165,10 @@ export default {
}, },
}, },
{ {
label: "产品别名",
prop: "purchaseGoodsName",
},
{
label: "单价", label: "单价",
prop: "upgradePurchasePrice", prop: "upgradePurchasePrice",
formatter: (row) => { formatter: (row) => {
...@@ -420,6 +417,7 @@ export default { ...@@ -420,6 +417,7 @@ export default {
::v-deep .d2-container-full { ::v-deep .d2-container-full {
bottom: 60px !important; bottom: 60px !important;
} }
.edit-page.edit-tmpl { .edit-page.edit-tmpl {
background: #ffffff; background: #ffffff;
...@@ -433,11 +431,13 @@ export default { ...@@ -433,11 +431,13 @@ export default {
color: #333333; color: #333333;
} }
} }
.content-box { .content-box {
padding: 20px; padding: 20px;
background: #ffffff; background: #ffffff;
box-sizing: border-box; box-sizing: border-box;
} }
.car-type-list { .car-type-list {
max-height: 300px; max-height: 300px;
overflow-y: scroll; overflow-y: scroll;
...@@ -481,7 +481,7 @@ export default { ...@@ -481,7 +481,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
> span { >span {
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
...@@ -505,6 +505,7 @@ export default { ...@@ -505,6 +505,7 @@ export default {
margin-bottom: 8px; margin-bottom: 8px;
} }
} }
.remark-input { .remark-input {
width: 85%; width: 85%;
} }
......
<template> <template>
<div class="classificationCptContainer"> <div class="classificationCptContainer">
<ClassificationRuleHeader :goods-type-group-division-id="goodsTypeGroupDivisionId" <ClassificationRuleHeader @rule-test="ruleTest" />
@rule-test="ruleTest"
@get-progress="getProgress" />
<el-form ref="classification" <el-form ref="classification"
:model="classificationObj" :model="classificationObj"
:rules="rules" :rules="rules"
...@@ -1012,18 +1010,6 @@ ...@@ -1012,18 +1010,6 @@
:table-select-options="tableSelectOptions" :table-select-options="tableSelectOptions"
:classification-obj-select="tableClassificationObjSelect" :classification-obj-select="tableClassificationObjSelect"
@distribution-rules-change="onDistributionRulesChange" /> @distribution-rules-change="onDistributionRulesChange" />
<TipsDialog v-if="tipsDialogVisible"
:account-valid-merchants="accountValidMerchants"
:visible.sync="tipsDialogVisible" />
<FinancialCalculationDialog v-if="financialCalculationVisible"
:financial-calculation-obj="financialCalculationObj"
:visible.sync="financialCalculationVisible"
v-on="$listeners" />
<ChannelSelectDialog v-if="channelSelectDialogVisible"
:division-rule-tests="divisionRuleTests"
:visible.sync="channelSelectDialogVisible"
v-on="$listeners"
@handleConfirm="channelConfirm" />
</div> </div>
</template> </template>
...@@ -1040,9 +1026,6 @@ import { ...@@ -1040,9 +1026,6 @@ import {
getUpgradeGoodsRowKey, getUpgradeGoodsRowKey,
filterUpgradeGoodsByMerchantCode, filterUpgradeGoodsByMerchantCode,
} from "../../merchantStep/utils/groundingUpgradeList"; } from "../../merchantStep/utils/groundingUpgradeList";
import { divisionRuleTestGet } from "@api/merchant";
// 1按毛利比例;2按收入比例;3按固定金额
// 1按收入比例;2按毛利比例;3按固定金额;4按(产值-流量成本)比例;5按(产值-流量成本-其他费用不包含产品成本))比例;6按(产值-流量成本-其他费用包含产品成本)比例);其他费用:1按收入比例
import { mapGetters, mapMutations } from "vuex"; import { mapGetters, mapMutations } from "vuex";
import { import {
defaultSelectOptions, defaultSelectOptions,
...@@ -1053,20 +1036,14 @@ import { limitPrice } from "@/common/format"; ...@@ -1053,20 +1036,14 @@ import { limitPrice } from "@/common/format";
import { deepClone } from "@/common/util"; import { deepClone } from "@/common/util";
import { expenseSideRowKey } from "../utils/expenseRowKey"; import { expenseSideRowKey } from "../utils/expenseRowKey";
import { CLASSIFICATION_EMIT } from "../utils/classificationEmitTypes"; import { CLASSIFICATION_EMIT } from "../utils/classificationEmitTypes";
import channelSelectDialog from "./channelSelectDialog";
import ClassificationRuleHeader from "./classificationCpt/ClassificationRuleHeader.vue"; import ClassificationRuleHeader from "./classificationCpt/ClassificationRuleHeader.vue";
import GoodsSourceCategoryPicker from "./classificationCpt/GoodsSourceCategoryPicker.vue"; import GoodsSourceCategoryPicker from "./classificationCpt/GoodsSourceCategoryPicker.vue";
import financialCalculationDialog from "./financialCalculationDialog";
import tableAccount from "./tableAccount"; import tableAccount from "./tableAccount";
import tipsDialog from "./tipsDialog";
export default { export default {
name: "ClassificationCpt", name: "ClassificationCpt",
components: { components: {
TableAccount: tableAccount, TableAccount: tableAccount,
TipsDialog: tipsDialog,
FinancialCalculationDialog: financialCalculationDialog,
ChannelSelectDialog: channelSelectDialog,
ClassificationRuleHeader, ClassificationRuleHeader,
GoodsSourceCategoryPicker, GoodsSourceCategoryPicker,
}, },
...@@ -1147,11 +1124,6 @@ export default { ...@@ -1147,11 +1124,6 @@ export default {
: callback(new Error("请输入折算比例")); : callback(new Error("请输入折算比例"));
}; };
return { return {
channelSelectDialogVisible: false,
divisionRuleTests: [],
financialCalculationVisible: false,
tipsDialogVisible: false,
accountValidMerchants: [],
classificationObj: { classificationObj: {
goodsTypes: [], goodsTypes: [],
// trafficSide: [], // trafficSide: [],
...@@ -1235,7 +1207,6 @@ export default { ...@@ -1235,7 +1207,6 @@ export default {
], ],
}, },
serviceSelectList: [], serviceSelectList: [],
financialCalculationObj: {},
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
currentPagePackage: 1, currentPagePackage: 1,
...@@ -1468,15 +1439,6 @@ export default { ...@@ -1468,15 +1439,6 @@ export default {
// return this.classificationObjSelect // return this.classificationObjSelect
// } // }
}, },
goodsTypeGroupDivisionId() {
// console.log(
// this.tabItem.groupDivisionRuleId,
// "this.tabItem.groupDivisionRuleId"
// )
const id
= this.tabItem.testFlag == "N" ? this.tabItem.groupDivisionRuleId : false;
return id || false;
},
}, },
watch: { watch: {
"classificationObj.goodsSource": { "classificationObj.goodsSource": {
...@@ -1601,13 +1563,6 @@ export default { ...@@ -1601,13 +1563,6 @@ export default {
deep: true, deep: true,
// immediate: true // immediate: true
}, },
"tabItem.groupDivisionRuleId": {
handler() {
this.resetGoodsTypeGroupDivisionId();
},
deep: true,
immediate: true,
},
"tabItem.pendingCalculateErrorOps": { "tabItem.pendingCalculateErrorOps": {
handler() { handler() {
this.$nextTick(() => this.replayPendingCalculateErrorOps()); this.$nextTick(() => this.replayPendingCalculateErrorOps());
...@@ -1905,66 +1860,6 @@ export default { ...@@ -1905,66 +1860,6 @@ export default {
); );
}, },
// ...mapActions("FinancialRules", ["reset"]), // ...mapActions("FinancialRules", ["reset"]),
resetGoodsTypeGroupDivisionId() {
// goodsTypeGroupDivisionId() {
// console.log(
// this.tabItem.groupDivisionRuleId,
// "this.tabItem.groupDivisionRuleId"
// )
// const id = this.tabItem.testFlag != 'Y' ? this.tabItem.groupDivisionRuleId : false
// this.goodsTypeGroupDivisionId = id || false
// }
},
getProgress() {
if (!this.goodsTypeGroupDivisionId)
return;
divisionRuleTestGet({
goodsTypeGroupDivisionId: this.goodsTypeGroupDivisionId,
}).then((result) => {
if (!result)
return;
const {
notInForceAccountMerchants,
divisionRuleTests,
subProgress,
accountValidMerchants,
} = result;
if (notInForceAccountMerchants) {
this.tipsDialogVisible = true;
this.accountValidMerchants = notInForceAccountMerchants;
return;
}
if (subProgress == 32) {
this.tipsDialogVisible = true;
this.accountValidMerchants = accountValidMerchants;
return;
}
if (Array.isArray(divisionRuleTests) && divisionRuleTests.length > 0) {
if (divisionRuleTests.length === 1) {
this.channelConfirm(divisionRuleTests[0]);
} else {
this.channelSelectDialogVisible = true;
this.divisionRuleTests = divisionRuleTests;
}
return;
}
const sp = Number(subProgress);
if ([34, 35, 36, 31].includes(sp)) {
this.financialCalculationVisible = true;
this.financialCalculationObj = result;
}
}).catch((err) => {
console.error("[FinancialRules/classificationCpt] getProgress", err);
});
},
channelConfirm(result) {
this.financialCalculationVisible = true;
this.financialCalculationObj = { ...result, ...result.divisionRuleTestItem };
// }
},
ruleTest() { ruleTest() {
this.emitClassificationChange(CLASSIFICATION_EMIT.RULES_TEST); this.emitClassificationChange(CLASSIFICATION_EMIT.RULES_TEST);
}, },
...@@ -2264,8 +2159,6 @@ export default { ...@@ -2264,8 +2159,6 @@ export default {
"upgradeGoods", "upgradeGoods",
"packageGoods", "packageGoods",
"goodsSource", "goodsSource",
"testFlag",
"groupDivisionRuleId",
"goodsCostConvertRate", "goodsCostConvertRate",
"virtualAccountCostConvertRate", "virtualAccountCostConvertRate",
"recoveryCostConvertRate", "recoveryCostConvertRate",
...@@ -2487,8 +2380,6 @@ export default { ...@@ -2487,8 +2380,6 @@ export default {
partnerDeductChargeFlag: obj.partnerDeductChargeFlag, partnerDeductChargeFlag: obj.partnerDeductChargeFlag,
virtualAccountCostFlag: obj.virtualAccountCostFlag, virtualAccountCostFlag: obj.virtualAccountCostFlag,
recoveryCostFlag: obj.recoveryCostFlag, recoveryCostFlag: obj.recoveryCostFlag,
testFlag: obj.testFlag,
groupDivisionRuleId: obj.groupDivisionRuleId,
djCostFlag: obj.djCostFlag, djCostFlag: obj.djCostFlag,
thirdPartyCostFlag: obj.thirdPartyCostFlag, thirdPartyCostFlag: obj.thirdPartyCostFlag,
goodsCostFlag: obj.goodsCostFlag, goodsCostFlag: obj.goodsCostFlag,
......
...@@ -2,20 +2,12 @@ ...@@ -2,20 +2,12 @@
<div class="hederContainer"> <div class="hederContainer">
<span class="tips ruleTest">不确定规则是否正确?点击 <span class="tips ruleTest">不确定规则是否正确?点击
<el-button type="text" @click="$emit('rule-test')">进行测算</el-button></span> <el-button type="text" @click="$emit('rule-test')">进行测算</el-button></span>
<span v-show="goodsTypeGroupDivisionId" class="tips dimensionTest">未进行分账测试,点击
<el-button type="text" @click="$emit('get-progress')">立即测试</el-button></span>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "ClassificationRuleHeader", name: "ClassificationRuleHeader"
props: {
goodsTypeGroupDivisionId: {
type: [String, Number, Boolean],
default: false
}
}
} }
</script> </script>
...@@ -42,9 +34,5 @@ export default { ...@@ -42,9 +34,5 @@ export default {
background: #185efe; background: #185efe;
} }
} }
.dimensionTest {
margin-left: 80px;
}
} }
</style> </style>
<template>
<div class="division-test-step1">
<div v-if="!step1Paid" class="pay-qrcode-wrap">
<img v-if="qrCodeURL" :src="qrCodeURL" class="pay-qrcode" alt="支付二维码">
<div v-else class="pay-qrcode pay-qrcode--loading" v-loading="true" />
<p class="pay-tip">微信扫码支付({{ payAmount }}元)</p>
</div>
<div v-else class="order-linked">
<span>关联测试订单:{{ orderCode }}</span>
<el-button
type="text"
class="retest-link"
@click="$emit('retest')"
>
重新测试
</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'DivisionTestStep1Pay',
props: {
step1Paid: {
type: Boolean,
default: false
},
orderCode: {
type: String,
default: ''
},
qrCodeURL: {
type: String,
default: ''
},
payAmount: {
type: [String, Number],
default: 3.5
},
readOnly: {
type: Boolean,
default: false
}
}
}
</script>
<style scoped lang="scss">
.division-test-step1 {
min-height: 280px;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fa;
border-radius: 8px;
padding: 24px;
}
.pay-qrcode-wrap {
text-align: center;
}
.pay-qrcode {
width: 200px;
height: 200px;
object-fit: contain;
display: block;
margin: 0 auto 16px;
background: #fff;
}
.pay-qrcode--loading {
min-height: 200px;
}
.pay-tip {
font-size: 14px;
color: #333;
margin: 0;
}
.order-linked {
font-size: 14px;
color: #333;
.retest-link {
margin-left: 8px;
padding: 0;
}
}
</style>
<template>
<div class="division-test-step2">
<div class="merchant-grid">
<div
v-for="(item, index) in merchants"
:key="merchantKey(item, index)"
class="merchant-grid-item"
>
<p class="merchant-name">
<span class="bullet">•</span>{{ item.merchantName }}
</p>
<div v-if="item.testCompleted" class="completed-tag">已完成测试</div>
<el-input
v-else
:value="item.displayDivisionMoney"
size="small"
disabled
placeholder="请输入分润金额"
/>
</div>
</div>
<p class="step2-hint">
设置待测试商户的分润金额<br>
说明:分润总金额必须等于3.5元,最后一个商户默认承担手续费
</p>
</div>
</template>
<script>
export default {
name: 'DivisionTestStep2Allocate',
props: {
merchants: {
type: Array,
default: () => []
}
},
methods: {
merchantKey(item, index) {
return item.merchantId ?? item.merchantName ?? index
}
}
}
</script>
<style scoped lang="scss">
.division-test-step2 {
background: #f5f7fa;
border-radius: 8px;
padding: 24px 32px 20px;
min-height: 280px;
}
.merchant-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px 40px;
max-width: 640px;
margin: 0 auto;
}
.merchant-grid-item {
.merchant-name {
margin: 0 0 8px;
font-size: 14px;
color: #333;
.bullet {
margin-right: 4px;
color: #666;
}
}
.completed-tag {
height: 32px;
line-height: 32px;
font-size: 14px;
color: #2b58ad;
padding-left: 8px;
}
}
.step2-hint {
text-align: center;
font-size: 12px;
color: #666;
line-height: 1.6;
margin: 24px 0 0;
}
</style>
<template>
<div class="division-test-step3">
<el-form ref="verifyForm" :model="form" :rules="rules" class="merchant-grid-form">
<div class="merchant-grid">
<el-form-item
v-for="(item, index) in form.testMerchantDivisions"
:key="merchantKey(item, index)"
:prop="'testMerchantDivisions.' + index + '.confirmDivisionMoney'"
:rules="item.testCompleted ? [] : amountRules"
class="merchant-grid-item"
>
<p class="merchant-name">
<span class="bullet">•</span>{{ item.merchantName }}
</p>
<div v-if="item.testCompleted" class="completed-tag">已完成测试</div>
<el-input
v-else
v-model="form.testMerchantDivisions[index].confirmDivisionMoney"
size="small"
placeholder="请输入到账金额"
:disabled="readOnly"
@input="onAmountInput($event, index)"
/>
</el-form-item>
</div>
</el-form>
<p class="step3-hint">次日分账成功后确认分账方到账金额</p>
</div>
</template>
<script>
/** 步骤3仅负责表单;提交由父组件 handleCompleteTest 调用 divisionRuleTest.money.valid */
import { limitPrice } from '@/common/format'
import { isValidAmountInput, mergeStep3FormMerchants } from '../../utils/validateStep3Amounts'
export default {
name: 'DivisionTestStep3Verify',
props: {
merchants: {
type: Array,
default: () => []
},
readOnly: {
type: Boolean,
default: false
}
},
data() {
return {
form: {
testMerchantDivisions: []
},
amountRules: [
{
required: true,
message: '请输入到账金额',
trigger: ['blur', 'change']
},
{
validator: (rule, value, callback) => {
if (!isValidAmountInput(value)) {
callback(new Error('请输入0-3.5的数字,最多两位小数'))
} else {
callback()
}
},
trigger: ['blur', 'change']
}
]
}
},
computed: {
rules() {
return {}
}
},
watch: {
merchants: {
immediate: true,
deep: true,
handler(list) {
this.form.testMerchantDivisions = mergeStep3FormMerchants(
list,
this.form.testMerchantDivisions
)
}
}
},
methods: {
merchantKey(item, index) {
return item.merchantId ?? item.merchantName ?? index
},
onAmountInput(val, index) {
this.form.testMerchantDivisions[index].confirmDivisionMoney = limitPrice(val, 0, 6, 2)
},
validate() {
return new Promise((resolve) => {
if (!this.$refs.verifyForm) {
resolve(false)
return
}
this.$refs.verifyForm.validate((valid) => resolve(valid))
})
},
getSubmitMerchants() {
return this.form.testMerchantDivisions
}
}
}
</script>
<style scoped lang="scss">
.division-test-step3 {
background: #f5f7fa;
border-radius: 8px;
padding: 24px 32px 20px;
min-height: 280px;
}
.merchant-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px 40px;
max-width: 640px;
margin: 0 auto;
}
.merchant-grid-item {
margin-bottom: 0;
::v-deep .el-form-item__content {
line-height: normal;
}
.merchant-name {
margin: 0 0 8px;
font-size: 14px;
color: #333;
.bullet {
margin-right: 4px;
color: #666;
}
}
.completed-tag {
height: 32px;
line-height: 32px;
font-size: 14px;
color: #2b58ad;
padding-left: 8px;
}
}
.step3-hint {
text-align: center;
font-size: 12px;
color: #666;
margin: 24px 0 0;
}
</style>
<template>
<div class="division-test-stepper">
<div class="stepper-track">
<template v-for="n in 3">
<button
:key="'node-' + n"
type="button"
class="stepper-node"
:class="'is-' + stepVisualState(n)"
@click="onStepClick(n)"
>
<i v-if="stepVisualState(n) === 'done'" class="el-icon-check stepper-check" />
<span v-else class="stepper-num">{{ n }}</span>
</button>
<div
v-if="n < 3"
:key="'line-' + n"
class="stepper-line"
:class="{ 'is-done': isConnectorDone(n) }"
/>
</template>
</div>
</div>
</template>
<script>
export default {
name: 'DivisionTestStepper',
props: {
maxReachedStep: {
type: Number,
default: 1
},
viewStep: {
type: Number,
default: 1
},
stepCompletedFlags: {
type: Array,
default: () => [false, false, false]
}
},
methods: {
/** done=蓝色勾 | current=蓝色序号 | wait=灰色序号 */
stepVisualState(stepNum) {
const idx = stepNum - 1
const completed =
!!this.stepCompletedFlags[idx] || stepNum < Number(this.viewStep)
if (completed) return 'done'
if (stepNum === Number(this.viewStep)) return 'current'
return 'wait'
},
/** 步骤 n 与 n+1 之间的连线:前序步骤已完成时为蓝色 */
isConnectorDone(stepNum) {
return this.stepVisualState(stepNum) === 'done'
},
onStepClick(stepNum) {
this.$emit('step-click', stepNum)
}
}
}
</script>
<style scoped lang="scss">
$step-primary: #2a58ad;
$step-wait-border: #dcdfe6;
$step-wait-text: #c0c4cc;
$step-line-wait: #dcdfe6;
.division-test-stepper {
margin-bottom: 24px;
padding: 0 40px;
}
.stepper-track {
display: flex;
align-items: center;
justify-content: center;
max-width: 360px;
margin: 0 auto;
}
.stepper-node {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border-radius: 50%;
border: 1px solid $step-wait-border;
background: #fff;
cursor: pointer;
outline: none;
cursor: pointer;
transition: border-color 0.2s, color 0.2s;
&:focus-visible {
box-shadow: 0 0 0 2px rgba($step-primary, 0.25);
}
&.is-done {
border-color: $step-primary;
color: $step-primary;
}
&.is-current {
border-color: $step-primary;
color: $step-primary;
}
&.is-wait {
border-color: $step-wait-border;
color: $step-wait-text;
}
}
.stepper-check {
font-size: 14px;
font-weight: 700;
line-height: 1;
}
.stepper-num {
font-size: 14px;
font-weight: 500;
line-height: 1;
}
.stepper-line {
flex: 1;
height: 1px;
min-width: 48px;
margin: 0 8px;
background: $step-line-wait;
transition: background-color 0.2s;
&.is-done {
background: $step-primary;
}
}
</style>
import { deepClone } from "@/common/util"
import {
getStableReconciliationRuleId,
mergeReconciliationRuleServerFields
} from "../../merchantStep/utils/reconciliationIncrementalRules"
/**
* 删 Tab 时收集待提交的 DELETE 快照(sessionAdded 的新 Tab 不产生 DELETE)。
*
* @param {object} params
* @param {object|null|undefined} params.removedRule
* @param {object|null|undefined} params.removedTabMeta
* @param {boolean} params.isSessionOnlyNew
* @returns {object|null}
*/
export function collectPendingDeleteForRemovedTab({
removedRule,
removedTabMeta,
isSessionOnlyNew
}) {
if (isSessionOnlyNew) return null
let rid =
removedRule && typeof removedRule === "object"
? getStableReconciliationRuleId(removedRule)
: ""
if (!rid && removedTabMeta) {
const gid = removedTabMeta.groupDivisionRuleId
if (gid != null && String(gid).trim() !== "") {
rid = String(gid).trim()
}
}
if (!rid) return null
const ruleSnapshot =
removedRule && typeof removedRule === "object"
? deepClone(removedRule)
: {}
delete ruleSnapshot.type
delete ruleSnapshot.tabPaneIndex
if (
ruleSnapshot.groupDivisionRuleId == null
|| String(ruleSnapshot.groupDivisionRuleId).trim() === ""
) {
ruleSnapshot.groupDivisionRuleId =
removedTabMeta && removedTabMeta.groupDivisionRuleId != null
? removedTabMeta.groupDivisionRuleId
: rid
}
return ruleSnapshot
}
/**
* splice 后按 oldIdx 从 prev 缓存 merge 服务端 id 字段。
*
* @param {Array<object>} goodsTypeGroupRules
* @param {number} tabIndex
* @param {Array<object>} prevGoodsTypeGroupRules
* @returns {Array<object>}
*/
export function mergeRemainingRulesAfterTabRemoval(
goodsTypeGroupRules,
tabIndex,
prevGoodsTypeGroupRules
) {
const remaining = goodsTypeGroupRules.slice()
remaining.splice(tabIndex, 1)
const prev = prevGoodsTypeGroupRules || []
for (let index = 0; index < remaining.length; index++) {
const oldIdx = index < tabIndex ? index : index + 1
const cachedForId = prev[oldIdx]
if (cachedForId) {
remaining[index] = mergeReconciliationRuleServerFields(
remaining[index],
cachedForId
)
}
}
return remaining
}
/**
* removeTab 核心纯逻辑:收集 pending DELETE + 剩余规则 id 合并。
*
* @param {object} params
* @returns {{ remainingRules: Array<object>, pendingDelete: object|null }}
*/
export function applyRemoveTabToGoodsTypeGroupRules({
goodsTypeGroupRules,
tabIndex,
prevGoodsTypeGroupRules,
removedRule,
removedTabMeta,
isSessionOnlyNew
}) {
const pendingDelete = collectPendingDeleteForRemovedTab({
removedRule,
removedTabMeta,
isSessionOnlyNew
})
const remainingRules = mergeRemainingRulesAfterTabRemoval(
goodsTypeGroupRules,
tabIndex,
prevGoodsTypeGroupRules
)
return { remainingRules, pendingDelete }
}
/**
* 删 Tab 后按 oldIdx 恢复 editableTabs meta(revision / touched / sessionAdded)。
*
* @param {Array<object>} prevTabsMeta
* @param {number} tabIndex
* @param {number} remainingCount
* @returns {Array<object>}
*/
export function mapTabMetaAfterTabRemoval(prevTabsMeta, tabIndex, remainingCount) {
const out = []
for (let index = 0; index < remainingCount; index++) {
const oldIdx = index < tabIndex ? index : index + 1
const meta = prevTabsMeta[oldIdx]
out.push({
sessionAdded: !!(meta && meta.sessionAdded),
ruleCacheRevision:
meta && meta.ruleCacheRevision != null ? Number(meta.ruleCacheRevision) : 0,
confirmedRuleCacheRevision:
meta && meta.confirmedRuleCacheRevision != null
? Number(meta.confirmedRuleCacheRevision)
: 0,
classificationUserTouched: !!(meta && meta.classificationUserTouched)
})
}
return out
}
/**
* 分账测试相关接口公共入参(使用财务详情 divisionRuleId,不再传 goodsTypeGroupDivisionId)
*/
export function buildDivisionRuleTestParams(ctx = {}) {
const {
merchantId,
sceneType,
paymentChannelId,
divisionRuleId,
baseSceneCode
} = ctx
const params = {}
if (merchantId != null && merchantId !== '') {
params.merchantId = merchantId
}
if (sceneType != null && sceneType !== '') {
params.sceneType = sceneType
}
if (paymentChannelId != null && paymentChannelId !== '') {
params.paymentChannelId = paymentChannelId
}
if (divisionRuleId != null && divisionRuleId !== '') {
params.divisionRuleId = divisionRuleId
}
if (baseSceneCode != null && baseSceneCode !== '') {
params.baseSceneCode = baseSceneCode
}
return params
}
/** divisionRuleTest.retest:仅 divisionRuleId + paymentChannelId */
export function buildDivisionRuleTestRetestParams(ctx = {}) {
const { divisionRuleId, paymentChannelId } = ctx
const params = {}
if (divisionRuleId != null && divisionRuleId !== '') {
params.divisionRuleId = divisionRuleId
}
if (paymentChannelId != null && paymentChannelId !== '') {
params.paymentChannelId = paymentChannelId
}
return params
}
/** divisionRuleTest.money.valid:divisionRuleId + paymentChannelId + testMerchantDivisions */
export function buildDivisionRuleTestMoneyValidParams({
testObj = {},
testMerchantDivisions,
divisionRuleId
} = {}) {
const params = {
testMerchantDivisions: testMerchantDivisions || []
}
if (divisionRuleId != null && divisionRuleId !== '') {
params.divisionRuleId = divisionRuleId
}
if (testObj.paymentChannelId != null && testObj.paymentChannelId !== '') {
params.paymentChannelId = testObj.paymentChannelId
}
return params
}
/** divisionRuleTest.updateMainProgress:divisionRuleId + paymentChannelId + progress(1|2|3) */
export function buildDivisionRuleTestUpdateMainProgressParams(ctx = {}) {
const { divisionRuleId, paymentChannelId, progress } = ctx
const params = {}
if (divisionRuleId != null && divisionRuleId !== '') {
params.divisionRuleId = divisionRuleId
}
if (paymentChannelId != null && paymentChannelId !== '') {
params.paymentChannelId = paymentChannelId
}
const p = Number(progress)
if (p >= 1 && p <= 3) {
params.progress = p
}
return params
}
import { deepClone } from "@/common/util"
import { fillDjGoodsTypeGroupRelations } from "../../merchantStep/utils/reconciliationShared"
/**
* 与 index.vue buildFullMergedGoodsTypeGroupRules 一致:冲突检测用全量规则视图。
*
* @param {object} params
* @param {number} params.tabCount editableTabs.length
* @param {Record<number, object>} [params.validatedByIndex]
* @param {Array<object>} [params.slotCaches] financialObj.goodsTypeGroupRules
* @returns {Array<object>}
*/
export function buildFullMergedGoodsTypeGroupRules({
tabCount,
validatedByIndex,
slotCaches
}) {
const n = tabCount
const out = []
const map = validatedByIndex || {}
const caches = slotCaches || []
for (let i = 0; i < n; i++) {
if (map[i]) {
out.push(map[i])
} else {
const cached = caches[i]
out.push(fillDjGoodsTypeGroupRelations(deepClone(cached || {})))
}
}
return out
}
import { sortDivisionTestMerchants, isPlatformMerchant } from './sortDivisionTestMerchants'
import { isMerchantCompletedFromDetail } from './validateStep3Amounts'
export const PLATFORM_FIXED_AMOUNT = 0.5
export const ALLOCATABLE_POOL = 3
export const TOTAL_PROFIT_AMOUNT = 3.5
/** distributionMoney 为 0、null、'' 表示已完成分账测试 */
export function isMerchantTestCompleted(item) {
if (!item) return false
if (item.testCompleted === true) return true
const v = item.distributionMoney
if (v == null || v === '') return true
const n = Number(v)
return Number.isFinite(n) && n === 0
}
function roundMoney(n) {
return Math.round(n * 100) / 100
}
function hasDistributionMoneyValue(item) {
const v = item?.distributionMoney
if (v == null || v === '') return false
const n = Number(v)
return Number.isFinite(n) && n !== 0
}
function hasPresetDivisionMoney(item) {
if (hasDistributionMoneyValue(item)) return true
const v = item.divisionMoney ?? item.testDivisionMoney ?? item.allocateDivisionMoney
return v != null && v !== ''
}
/**
* 对未完成测试的非平台商户随机分配 ALLOCATABLE_POOL 元,最后一户承担尾差。
* @param {object[]} pendingMerchants
* @param {() => number} [randomFn] 0-1,便于单测
*/
export function randomAllocatePool(pendingMerchants, randomFn = Math.random) {
const n = pendingMerchants.length
if (n === 0) return []
if (n === 1) return [ALLOCATABLE_POOL]
const weights = []
let sum = 0
for (let i = 0; i < n - 1; i++) {
const w = randomFn() + 0.01
weights.push(w)
sum += w
}
const amounts = []
let allocated = 0
for (let i = 0; i < n - 1; i++) {
const part = roundMoney((weights[i] / sum) * ALLOCATABLE_POOL)
amounts.push(part)
allocated += part
}
amounts.push(roundMoney(ALLOCATABLE_POOL - allocated))
return amounts
}
function resolveDisplayAmount(item, platform, cache, randomAmounts, pendingIdxRef) {
if (hasDistributionMoneyValue(item)) {
return String(item.distributionMoney)
}
if (platform) {
if (hasPresetDivisionMoney(item)) {
return String(
item.distributionMoney
?? item.divisionMoney
?? item.testDivisionMoney
?? PLATFORM_FIXED_AMOUNT
)
}
return String(PLATFORM_FIXED_AMOUNT)
}
if (hasPresetDivisionMoney(item)) {
return String(
item.distributionMoney
?? item.divisionMoney
?? item.testDivisionMoney
?? item.allocateDivisionMoney
)
}
const key = String(item.merchantId ?? item.merchantName ?? '')
if (cache[key] != null && cache[key] !== '') {
return String(cache[key])
}
const amount = randomAmounts[pendingIdxRef.idx] ?? 0
pendingIdxRef.idx += 1
return String(amount)
}
/**
* @param {object[]} testMerchantDivisions
* @param {{ randomFn?: () => number, cachedAllocations?: Record<string, string> }} [options]
* @returns {object[]} 带 displayDivisionMoney、testCompleted 的副本(已排序)
*/
export function buildStep2DisplayMerchants(testMerchantDivisions, options = {}) {
const sorted = sortDivisionTestMerchants(testMerchantDivisions || [])
const randomFn = options.randomFn || Math.random
const cache = options.cachedAllocations || {}
const pending = sorted.filter((m) => !isMerchantTestCompleted(m) && !isPlatformMerchant(m))
const randomAmounts = randomAllocatePool(pending, randomFn)
const pendingIdxRef = { idx: 0 }
return sorted.map((item) => {
const completed = isMerchantTestCompleted(item)
const platform = isPlatformMerchant(item)
const displayDivisionMoney = completed
? ''
: resolveDisplayAmount(item, platform, cache, randomAmounts, pendingIdxRef)
return {
...item,
testCompleted: completed,
displayDivisionMoney
}
})
}
/** 步骤 3:同一商户列表与完成态,保留 confirmDivisionMoney 供填写 */
export function buildStep3VerifyMerchants(testMerchantDivisions) {
const sorted = sortDivisionTestMerchants(testMerchantDivisions || [])
return sorted.map((m) => ({
...m,
testCompleted: isMerchantCompletedFromDetail(m),
confirmDivisionMoney: m.confirmDivisionMoney ?? ''
}))
}
export function sumDisplayDivisionMoney(merchants) {
return (merchants || []).reduce((sum, m) => {
if (m.testCompleted) return sum
const v = parseFloat(m.displayDivisionMoney)
return sum + (Number.isFinite(v) ? v : 0)
}, 0)
}
export function isTotalProfitAmountValid(merchants, total = TOTAL_PROFIT_AMOUNT) {
const sum = roundMoney(sumDisplayDivisionMoney(merchants))
return Math.abs(sum - total) < 0.001
}
export function buildWebSocketUrl(rawUrl, pageProtocol) {
if (!rawUrl || typeof rawUrl !== "string") return ""
let url = rawUrl.trim()
const secure =
pageProtocol != null
? pageProtocol === "https:"
: typeof window !== "undefined" && window.location.protocol === "https:"
if (/^wss?:\/\//i.test(url)) {
if (secure && /^ws:\/\//i.test(url)) {
return "wss://" + url.slice(5)
}
return url
}
const scheme = secure ? "wss://" : "ws://"
return scheme + url.replace(/^\/\//, "")
}
import { deepClone } from "@/common/util"
import { mergeChildClassificationPayload } from "./mergeClassificationPayload"
/**
* 与 index.vue getAllParams 一致:按 editableTabs 顺序收集 rules。
*
* @param {object} params
* @param {Array<object>} params.editableTabs
* @param {Array<object>|undefined} params.slotCaches financialObj.goodsTypeGroupRules
* @param {(paneName: string) => object|null|undefined} [params.getChildPayloadByPaneName]
* 激活 Tab 返回 getClassificationParams();未挂载返回 null/undefined
* @returns {Array<object>}
*/
export function collectGoodsTypeGroupRulesFromTabs({
editableTabs,
slotCaches,
getChildPayloadByPaneName
}) {
const list = deepClone(editableTabs)
const goodsTypeGroupRules = []
const caches = slotCaches || []
for (let index = 0; index < list.length; index++) {
const tabindex = editableTabs.findIndex(
(item) => item.name === list[index].name
)
const getPayload = getChildPayloadByPaneName
let payload = null
if (typeof getPayload === "function") {
try {
payload = getPayload(list[index].name)
} catch (e) {
payload = undefined
}
}
if (payload != null && typeof payload === "object") {
try {
const cached = caches[tabindex]
const { next } = mergeChildClassificationPayload(payload, cached)
goodsTypeGroupRules.push(next)
} catch (e) {
const cached = caches[tabindex]
goodsTypeGroupRules.push(cached ? deepClone(cached) : {})
}
} else {
const cached = caches[tabindex]
goodsTypeGroupRules.push(cached ? deepClone(cached) : {})
}
}
return goodsTypeGroupRules
}
/** autoFlag=Y 且 testFlag 严格为 N(未通过分账测试) */
export function isDivisionRuleAutoTestPending(item) {
return item && item.autoFlag == "Y" && item.testFlag == "N"
}
export function buildDivisionRuleAutosByChannelId(divisionRuleAutos) {
const map = {}
;(divisionRuleAutos || []).forEach((item) => {
if (item && item.paymentChannelId != null) {
map[item.paymentChannelId] = {
paymentChannelId: item.paymentChannelId,
autoFlag: item.autoFlag,
testFlag: item.testFlag
}
}
})
return map
}
/**
* 立即测试按钮:须已有 divisionRuleId,当前开启自动分账,且服务端(详情/保存回包)判定待测。
* 本地切换 autoFlag 不触发显示,避免后端尚未生成测算 id。
*/
export function shouldShowDivisionTestButton(
currentChannel,
serverChannelById,
divisionRuleId
) {
if (divisionRuleId == null || divisionRuleId === "") return false
if (!currentChannel || currentChannel.autoFlag != "Y") return false
const serverChannel =
serverChannelById && serverChannelById[currentChannel.paymentChannelId]
return isDivisionRuleAutoTestPending(serverChannel)
}
export function hasPendingDivisionRuleAutoTest(divisionRuleAutos) {
return (divisionRuleAutos || []).some(isDivisionRuleAutoTestPending)
}
export function findPendingDivisionRuleAutoTestIndices(divisionRuleAutos) {
return (divisionRuleAutos || [])
.map((item, index) => (isDivisionRuleAutoTestPending(item) ? index : -1))
.filter((i) => i >= 0)
}
/** 从 divisionRuleTest.get 的 divisionRuleTests 中匹配当前渠道 */
export function findDivisionRuleTestByChannelId(divisionRuleTests, paymentChannelId) {
if (!Array.isArray(divisionRuleTests) || paymentChannelId == null) return null
return (
divisionRuleTests.find(
(t) =>
t?.paymentChannelId == paymentChannelId
|| t?.divisionRuleTestItem?.paymentChannelId == paymentChannelId
) || null
)
}
/** subProgress 进行中:34 步骤1 / 35 已付款 / 36 已分账 / 31 失败(不驱动展示步骤) */
export const DIVISION_TEST_SUB_PROGRESS_IN_PROGRESS = [34, 35, 36, 31]
export function isDivisionTestInProgress(subProgress) {
const sp = Number(subProgress)
return DIVISION_TEST_SUB_PROGRESS_IN_PROGRESS.includes(sp)
}
export function isDivisionTestPassed(subProgress) {
const sp = Number(subProgress)
return sp > 0 && !isDivisionTestInProgress(sp)
}
function hasOutTradeNo(payload = {}) {
const v = payload.outTradeNo
return v != null && v !== ''
}
function isOrderPaidFromPayload(payload, sp) {
if (payload.orderPaid === true) return true
if (payload.paymentSuccess === true) return true
if (payload.payStatus === 1 || payload.payStatus === '1' || payload.payStatus === 'Y') {
return true
}
if (sp === 31 && hasOutTradeNo(payload)) return true
return sp >= 35
}
/**
* 仅从 subProgress / 支付状态解析业务态,不映射展示步骤
* @param {number|string} subProgress
* @param {{ orderPaid?: boolean, payStatus?: *, paymentSuccess?: boolean, outTradeNo?: string }} [payload]
*/
export function mapSubProgressToUi(subProgress, payload = {}) {
const sp = Number(subProgress)
const step1Paid = isOrderPaidFromPayload(payload, sp)
return {
step1Paid,
subProgress: sp,
isFailed: sp === 31
}
}
/** 步骤条完成态:[0]=步骤1已付款 [1]=步骤2已到达 [2]=步骤3失败标记(仅 max>=3 时) */
export function buildStepCompletedFlags(step1Paid, maxReachedStep, isFailed = false) {
const max = Number(maxReachedStep) || 1
return [
!!step1Paid,
max >= 2,
!!isFailed && max >= 3
]
}
/**
* @param {number} targetStep
* @param {{ maxReachedStep: number, step1Paid?: boolean }} uiState
*/
export function canNavigateToStep(targetStep, uiState) {
const step = Number(targetStep)
const max = Number(uiState.maxReachedStep) || 1
if (step < 1 || step > 3) return false
return step <= max
}
/**
* 回看已完成步骤时为只读
* @param {number} viewStep
* @param {{ maxReachedStep: number }} uiState
*/
export function isStepReadOnly(viewStep, uiState) {
const v = Number(viewStep)
const max = Number(uiState.maxReachedStep) || 1
return v < max
}
/**
* subProgress 决定可达的最大步骤
* @param {number|string} subProgress
* @param {number|string} [progress] 服务端主步骤 1/2/3
* @returns {number} 1 | 2 | 3
*/
export function resolveMaxReachedStepFromSubProgress(subProgress, progress) {
const sp = Number(subProgress) || 0
const mp = Number(progress) || 0
if (sp === 36) return 3
if (sp >= 35) return 2
if (sp === 31 && mp >= 1 && mp <= 3) return mp
return 1
}
/**
* 打开弹窗时决定初始展示步骤:优先 progress(1/2/3),无 progress 时回退 subProgress
* @param {number|string} subProgress
* @param {number|string} [progress] 服务端主步骤 1/2/3
* @returns {{ viewStep: number, maxReachedStep: number }}
*/
export function resolveInitialWizardSteps(subProgress, progress) {
const sp = Number(subProgress) || 0
const mp = Number(progress) || 0
let maxReachedStep = resolveMaxReachedStepFromSubProgress(sp, mp)
if (mp >= 1 && mp <= 3) {
maxReachedStep = Math.max(maxReachedStep, mp)
return { viewStep: mp, maxReachedStep }
}
if (sp === 36) {
return { viewStep: 3, maxReachedStep: 3 }
}
if (sp === 31 && maxReachedStep > 1) {
return { viewStep: maxReachedStep, maxReachedStep }
}
return { viewStep: 1, maxReachedStep }
}
export function isDivisionTestFailed(subProgress) {
return Number(subProgress) === 31
}
/**
* subProgress=31/36 等需按服务端 progress 恢复展示步骤
*/
export function shouldSyncWizardStepsFromProgress(subProgress) {
const sp = Number(subProgress)
return sp === 31 || sp === 36
}
/**
* 步骤1是否展示「关联测试订单」(而非二维码)
* @param {{ step1Paid?: boolean, subProgress?: number|string, outTradeNo?: string, maxReachedStep?: number, viewStep?: number }} params
*/
export function shouldShowStep1OrderLinked({
step1Paid = false,
subProgress = 0,
outTradeNo = '',
maxReachedStep = 1,
viewStep = 1
} = {}) {
if (step1Paid) return true
if (Number(subProgress) === 31 && outTradeNo) return true
if (Number(maxReachedStep) > 1 && Number(viewStep) === 1) return true
return false
}
/**
* 保证「全部品类」(groupType===1) 位于 goodsTypeGroupRules[0]。
*
* 旧逻辑在首条为特殊品类时 unshift 空壳 { groupType: 1 },若接口已在其它下标返回带 groupDivisionRuleId
* 的 groupType 1,会导致 Tab0 无 id、真实全部品类错位,提交时 type 误判为 ADD。
*
* @param {Array<object>|null|undefined} rules
* @returns {Array<object>}
*/
export function ensureAllCategoryRuleFirst(rules) {
let list = Array.isArray(rules) ? [...rules] : []
if (!list.length) {
return [{ groupType: 1 }]
}
const allIdx = list.findIndex((r) => r && r.groupType == 1)
if (allIdx > 0) {
const reordered = [...list]
const [allRule] = reordered.splice(allIdx, 1)
reordered.unshift(allRule)
return reordered
}
if (allIdx === 0) {
return list
}
if (list[0] && list[0].groupType == 2) {
return [{ groupType: 1 }, ...list]
}
return list
}
import { getStableReconciliationRuleId } from "../../merchantStep/utils/reconciliationIncrementalRules"
import { shouldIncludeReconciliationTabForProcess } from "../../merchantStep/utils/reconciliationSubmitTabGate"
import { reconciliationRulePayloadIsSubstantive } from "../../merchantStep/utils/validateReconciliationRulePayload"
import { financialRulePayloadDeepEqual } from "./rulePayloadCanonicalCompare"
import { prepareRuleForValidation } from "./validateGoodsTypeGroupRulePayload"
/**
* @param {Array<object>|null|undefined} baseline
* @param {number} ti
* @returns {boolean}
*/
export function financialBaselineHasSlotForTabIndex(baseline, ti) {
const prevRaw = Array.isArray(baseline) ? baseline[ti] : null
return !!(prevRaw && typeof prevRaw === "object")
}
/**
* @param {object|null|undefined} baselineRule
* @param {object|null|undefined} currentRule
* @returns {boolean}
*/
export function financialRulePayloadEqualsNormalized(baselineRule, currentRule) {
if (!baselineRule || typeof baselineRule !== "object") {
if (!currentRule || typeof currentRule !== "object") return true
return !reconciliationRulePayloadIsSubstantive(currentRule)
}
if (!currentRule || typeof currentRule !== "object") return true
const curNorm = prepareRuleForValidation(currentRule)
const prevNorm = prepareRuleForValidation(baselineRule)
return financialRulePayloadDeepEqual(curNorm, prevNorm)
}
/**
* 当前 Tab 槽位规则是否与进入页时的基线不一致。
*
* @param {Array<object>|null|undefined} baseline
* @param {number} ti
* @param {object|null|undefined} currentRule
* @returns {boolean}
*/
export function financialTabDiffersFromBaseline(baseline, ti, currentRule) {
if (!Array.isArray(baseline)) return false
const prevRaw = baseline[ti]
if (!prevRaw) {
if (!currentRule) return false
return reconciliationRulePayloadIsSubstantive(currentRule)
}
return !financialRulePayloadEqualsNormalized(prevRaw, currentRule)
}
/**
* 校验通过后的单条规则快照是否与进入页基线一致(用于收缩 goodsTypeGroupRules 增量)。
*
* @param {Array<object>|null|undefined} baseline
* @param {number} ti
* @param {object|null|undefined} snapshot
* @returns {boolean}
*/
export function financialSnapshotEqualsBaseline(baseline, ti, snapshot) {
if (!Array.isArray(baseline) || !snapshot || typeof snapshot !== "object") {
return false
}
const prevRaw = baseline[ti]
if (!prevRaw) {
if (!reconciliationRulePayloadIsSubstantive(snapshot)) return true
return false
}
return financialRulePayloadEqualsNormalized(prevRaw, snapshot)
}
/**
* 全量保存:与 merchantCheck indicesToProcess 同款语义。
* 仅 touched/sessionAdded 且与基线 diff(或无基线槽位)的 Tab 进入增量候选。
*
* @param {Array<object>} editableTabs
* @param {Array<object>|null|undefined} baseline
* @param {Array<object>|null|undefined} slotCaches financialObj.goodsTypeGroupRules
* @returns {number[]}
*/
export function resolveIndicesForFinancialIncrementalSubmit(
editableTabs,
baseline,
slotCaches
) {
const indices = []
const tabs = editableTabs || []
const caches = slotCaches || []
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i]
if (!tab || String(tab.name) === "add") continue
const differs = financialTabDiffersFromBaseline(baseline, i, caches[i])
const isSessionAdded = tab.sessionAdded === true
if (!differs && !isSessionAdded) continue
if (differs) {
if (
!shouldIncludeReconciliationTabForProcess({
hasBaselineSlot: financialBaselineHasSlotForTabIndex(baseline, i),
classificationUserTouched: tab.classificationUserTouched === true,
sessionAdded: isSessionAdded
})
) {
continue
}
}
indices.push(i)
}
return indices
}
/**
* 校验通过的 Tab 中,仅「快照与基线仍不一致」的进入提交(无基线时仅 sessionAdded 且 substantive)。
*
* @param {number[]} dirtyIndices
* @param {Record<number, object>} validatedByIndex
* @param {Array<object>|null|undefined} baseline
* @param {Array<object>} editableTabs
* @returns {number[]}
*/
export function filterFinancialIndicesToSubmitIncremental(
dirtyIndices,
validatedByIndex,
baseline,
editableTabs
) {
const tabs = editableTabs || []
return (dirtyIndices || []).filter((ti) => {
const rule = validatedByIndex[ti]
if (!rule || typeof rule !== "object") return false
if (!Array.isArray(baseline)) {
return (
tabs[ti]?.sessionAdded === true
&& reconciliationRulePayloadIsSubstantive(rule)
)
}
return !financialSnapshotEqualsBaseline(baseline, ti, rule)
})
}
...@@ -9,6 +9,25 @@ const GUARD_EMPTY_ARRAY_KEYS = [ ...@@ -9,6 +9,25 @@ const GUARD_EMPTY_ARRAY_KEYS = [
"packageGoods" "packageGoods"
] ]
/** 服务端主键/关联 id:子组件 getClassificationParams 不带,须从槽位缓存保留 */
const SERVER_ID_FIELDS = ["groupDivisionRuleId", "id", "groupSettleRuleId"]
function preserveServerIdFieldsFromBase(next, base, payload) {
for (let i = 0; i < SERVER_ID_FIELDS.length; i++) {
const key = SERVER_ID_FIELDS[i]
const fromPayload = payload[key]
const payloadHasValue =
Object.prototype.hasOwnProperty.call(payload, key)
&& fromPayload != null
&& String(fromPayload).trim() !== ""
if (payloadHasValue) continue
const fromBase = base[key]
if (fromBase != null && String(fromBase).trim() !== "") {
next[key] = fromBase
}
}
}
/** /**
* 将子组件 getClassificationParams() 的 payload 与槽位缓存合并为 next(与 index buildMerged 一致)。 * 将子组件 getClassificationParams() 的 payload 与槽位缓存合并为 next(与 index buildMerged 一致)。
* *
...@@ -53,5 +72,6 @@ export function mergeChildClassificationPayload(payload, prevStoredRaw) { ...@@ -53,5 +72,6 @@ export function mergeChildClassificationPayload(payload, prevStoredRaw) {
next[key] = b next[key] = b
} }
}) })
preserveServerIdFieldsFromBase(next, base, payload)
return { next, prevStored: prevStoredRaw } return { next, prevStored: prevStoredRaw }
} }
export function resolveDivisionRuleIdFromApi(payload) {
if (!payload || typeof payload !== "object") return undefined
const top = payload.divisionRuleId
if (top != null && top !== "") return top
const nested = payload.merchantSettleDistributeRule
if (nested && nested.divisionRuleId != null && nested.divisionRuleId !== "") {
return nested.divisionRuleId
}
return undefined
}
function findDivisionRuleTestChannelEntry(payload = {}) {
const channelId = payload.paymentChannelId
if (!Array.isArray(payload.divisionRuleTests) || !payload.divisionRuleTests.length) {
return null
}
return channelId != null
? payload.divisionRuleTests.find((t) => t && t.paymentChannelId == channelId)
: payload.divisionRuleTests[0]
}
/**
* 分账测试订单号:优先取 divisionRuleTests 项下 divisionRuleTestItem.orderCode
*/
export function resolveDivisionTestOrderCode(payload = {}) {
if (!payload || typeof payload !== 'object') return ''
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.orderCode
if (fromList != null && fromList !== '') {
return String(fromList)
}
const fromItem = payload.divisionRuleTestItem?.orderCode
if (fromItem != null && fromItem !== '') {
return String(fromItem)
}
if (payload.orderCode != null && payload.orderCode !== '') {
return String(payload.orderCode)
}
return ''
}
/**
* 分账测试支付流水号:优先取 divisionRuleTests 项下 divisionRuleTestItem.outTradeNo
*/
export function resolveDivisionTestOutTradeNo(payload = {}) {
if (!payload || typeof payload !== 'object') return ''
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.outTradeNo
if (fromList != null && fromList !== '') {
return String(fromList)
}
const fromItem = payload.divisionRuleTestItem?.outTradeNo
if (fromItem != null && fromItem !== '') {
return String(fromItem)
}
if (payload.outTradeNo != null && payload.outTradeNo !== '') {
return String(payload.outTradeNo)
}
return ''
}
/**
* 分账测试进度:优先取 divisionRuleTests 项下 divisionRuleTestItem.subProgress
*/
export function resolveDivisionTestSubProgress(payload = {}, fallback) {
if (!payload || typeof payload !== 'object') {
return fallback != null ? Number(fallback) || 0 : 0
}
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.subProgress ?? entry?.subProgress
if (fromList != null && fromList !== '') {
return Number(fromList) || 0
}
const fromItem = payload.divisionRuleTestItem?.subProgress
if (fromItem != null && fromItem !== '') {
return Number(fromItem) || 0
}
if (payload.subProgress != null && payload.subProgress !== '') {
return Number(payload.subProgress) || 0
}
if (fallback != null && fallback !== '') {
return Number(fallback) || 0
}
return 0
}
/**
* 主步骤 progress(1/2/3):与 subProgress 同源解析
*/
export function resolveDivisionTestProgress(payload = {}, fallback) {
if (!payload || typeof payload !== 'object') {
return fallback != null && fallback !== '' ? Number(fallback) || 0 : 0
}
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.progress ?? entry?.progress
if (fromList != null && fromList !== '') {
return Number(fromList) || 0
}
const fromItem = payload.divisionRuleTestItem?.progress
if (fromItem != null && fromItem !== '') {
return Number(fromItem) || 0
}
if (payload.progress != null && payload.progress !== '') {
return Number(payload.progress) || 0
}
if (fallback != null && fallback !== '') {
return Number(fallback) || 0
}
return 0
}
/**
* money.valid 用 goodsTypeGroupDivisionId:与 orderCode 同源解析
*/
export function resolveGoodsTypeGroupDivisionId(payload = {}) {
if (!payload || typeof payload !== 'object') return undefined
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.goodsTypeGroupDivisionId
if (fromList != null && fromList !== '') {
return fromList
}
const fromItem = payload.divisionRuleTestItem?.goodsTypeGroupDivisionId
if (fromItem != null && fromItem !== '') {
return fromItem
}
if (payload.goodsTypeGroupDivisionId != null && payload.goodsTypeGroupDivisionId !== '') {
return payload.goodsTypeGroupDivisionId
}
return undefined
}
/**
* 分账测试商户列表:优先取 divisionRuleTests 项下 divisionRuleTestItem.testMerchantDivisions
*/
export function resolveDivisionTestMerchantDivisions(payload = {}) {
if (!payload || typeof payload !== 'object') return []
const entry = findDivisionRuleTestChannelEntry(payload)
const fromList = entry?.divisionRuleTestItem?.testMerchantDivisions
if (Array.isArray(fromList) && fromList.length) {
return fromList
}
const fromItem = payload.divisionRuleTestItem?.testMerchantDivisions
if (Array.isArray(fromItem) && fromItem.length) {
return fromItem
}
if (Array.isArray(payload.testMerchantDivisions)) {
return payload.testMerchantDivisions
}
return []
}
/** 合并接口数据并写入规范化 orderCode、outTradeNo、subProgress、testMerchantDivisions */
export function normalizeDivisionTestPayload(payload = {}) {
const orderCode = resolveDivisionTestOrderCode(payload)
const outTradeNo = resolveDivisionTestOutTradeNo(payload)
const subProgress = resolveDivisionTestSubProgress(payload, payload.subProgress)
const progress = resolveDivisionTestProgress(payload, payload.progress)
const testMerchantDivisions = resolveDivisionTestMerchantDivisions(payload)
return {
...payload,
orderCode,
outTradeNo,
subProgress,
progress,
testMerchantDivisions
}
}
/**
* 与 index.vue getGoodsTypeGroupRules 全量提交路径一致:
* 仅 touched 或 sessionAdded 的 Tab 进入 indicesForIncremental。
*
* @param {Array<object>} editableTabs
* @returns {number[]}
*/
export function resolveIndicesForIncrementalSubmit(editableTabs) {
const indices = []
const tabs = editableTabs || []
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i]
if (
tab
&& String(tab.name) !== "add"
&& (tab.classificationUserTouched === true || tab.sessionAdded === true)
) {
indices.push(i)
}
}
return indices
}
/** testMerchantDivisions 展示顺序:targetMerchantType 3 → 2 → 1(4 与 1 同为平台方) */
const TARGET_MERCHANT_TYPE_DISPLAY_ORDER = { 3: 0, 2: 1, 1: 2, 4: 2 }
/**
* @param {object} item testMerchantDivisions 单项
* @returns {number} 越小越靠前
*/
export function getTargetMerchantTypeSortKey(item) {
if (item == null) return 99
const n = Number(item.targetMerchantType)
if (!Number.isFinite(n)) return 99
return TARGET_MERCHANT_TYPE_DISPLAY_ORDER[n] ?? 50
}
export function getMerchantTargetType(item) {
if (item == null) return 99
const tt = Number(item.targetType ?? item.merchantTargetType ?? item.applicationObjectType)
if (Number.isFinite(tt)) return tt
if (item.platformFlag === 'Y' || item.isPlatform === true) return 4
return 99
}
export function isPlatformMerchant(item) {
const tmt = Number(item?.targetMerchantType)
if (tmt === 1 || tmt === 4) return true
const tt = getMerchantTargetType(item)
return tt === 3 || tt === 4
}
/** 按 testMerchantDivisions[].targetMerchantType 顺序 3、2、1 展示;同类型按商户名 */
export function sortDivisionTestMerchants(list) {
if (!Array.isArray(list)) return []
return [...list].sort((a, b) => {
const oa = getTargetMerchantTypeSortKey(a)
const ob = getTargetMerchantTypeSortKey(b)
if (oa !== ob) return oa - ob
return (a.merchantName || '').localeCompare(b.merchantName || '', 'zh')
})
}
const MAX_AMOUNT = 3.5
/**
* 详情回显 distributionMoney 为 0 时视为已完成,不参与 money.valid 提交
*(用户输入 confirmDivisionMoney 为 0 的待确认商户仍应提交)
*/
export function isMerchantCompletedFromDetail(item) {
if (!item) return false
const v = item.distributionMoney
if (v == null || v === '') return false
const n = Number(v)
return Number.isFinite(n) && n === 0
}
/** 步骤3待提交商户(排除详情已为 0 的已完成商户) */
export function getStep3PendingMerchants(merchants) {
return (merchants || []).filter((m) => !isMerchantCompletedFromDetail(m))
}
export function isValidAmountInput(value) {
if (value === '' || value == null) return false
const s = String(value).trim()
if (!/^\d+(\.\d{1,2})?$/.test(s)) return false
const n = parseFloat(s)
return Number.isFinite(n) && n >= 0 && n <= MAX_AMOUNT
}
/**
* @param {object[]} merchants 步骤3表单行(含 confirmDivisionMoney)
* @returns {{ valid: boolean, message?: string }}
*/
export function validateStep3Amounts(merchants) {
const pending = getStep3PendingMerchants(merchants)
if (pending.length === 0) {
return { valid: false, message: '没有待确认到账的商户' }
}
for (const item of pending) {
const val = item.confirmDivisionMoney
if (!isValidAmountInput(val)) {
return { valid: false, message: '请填写正确的到账金额(0-3.5,最多两位小数)' }
}
}
return { valid: true }
}
function step3MerchantKey(item) {
return String(item?.merchantId ?? item?.merchantName ?? '')
}
/** 同步 props 商户列表时保留步骤3已填写的 confirmDivisionMoney */
export function mergeStep3FormMerchants(merchants, previousFormRows) {
const prevMap = new Map()
;(previousFormRows || []).forEach((m) => {
const key = step3MerchantKey(m)
if (key) prevMap.set(key, m.confirmDivisionMoney)
})
return (merchants || []).map((m) => {
const key = step3MerchantKey(m)
const prev = prevMap.get(key)
return {
...m,
confirmDivisionMoney: prev !== undefined ? prev : (m.confirmDivisionMoney ?? '')
}
})
}
export function buildStep3SubmitMerchants(displayMerchants, formMerchants) {
const formMap = new Map()
;(formMerchants || []).forEach((m) => {
const key = step3MerchantKey(m)
if (key) formMap.set(key, m)
})
return getStep3PendingMerchants(displayMerchants).map((m) => {
const key = step3MerchantKey(m)
const form = formMap.get(key) || m
return {
...m,
confirmDivisionMoney: form.confirmDivisionMoney
}
})
}
...@@ -33,6 +33,12 @@ export function mergeReconciliationRuleServerFields(snapshot, cachedRule) { ...@@ -33,6 +33,12 @@ export function mergeReconciliationRuleServerFields(snapshot, cachedRule) {
if (cachedRule.id != null && String(cachedRule.id).trim() !== "") { if (cachedRule.id != null && String(cachedRule.id).trim() !== "") {
out.id = cachedRule.id out.id = cachedRule.id
} }
if (
cachedRule.groupSettleRuleId != null
&& String(cachedRule.groupSettleRuleId).trim() !== ""
) {
out.groupSettleRuleId = cachedRule.groupSettleRuleId
}
return out return out
} }
......
# 真实脱敏 Fixture
将脱敏后的详情/提交 JSON 放在此目录,文件名建议:
- `detail-with-special.json` — 全部品类 + 多特殊品类详情响应
- `submit-after-delete-special.json` — 删光特殊品类后的 submit body
单测通过 `loadFixture(name)` 优先加载 `real/`,不存在则回退 `synthetic/`。
{
"goodsTypeGroupRules": [
{
"groupType": 1,
"groupDivisionRuleId": 17805,
"groupSettleRuleId": 17942,
"shop4sDeductChargeFlag": "Y",
"partnerDeductChargeFlag": "Y",
"goodsCostFlag": "N",
"expenseCategoryRules": [
{
"calculateMode": 1,
"expenseCategoryCalculateType": 1,
"expenseCategoryValue": "10"
}
],
"merchantDistributionRules": [{ "merchantId": "100" }],
"owningMerchantDistributionRules": [{ "merchantId": "100" }]
}
]
}
{
"goodsTypeGroupRules": [
{
"groupType": 1,
"groupDivisionRuleId": 17805,
"groupSettleRuleId": 17942,
"shop4sDeductChargeFlag": "Y",
"partnerDeductChargeFlag": "Y",
"goodsCostFlag": "N",
"expenseCategoryRules": [
{
"calculateMode": 1,
"expenseCategoryCalculateType": 1,
"expenseCategoryValue": "10"
}
],
"merchantDistributionRules": [{ "merchantId": "100" }],
"owningMerchantDistributionRules": [{ "merchantId": "100" }]
},
{
"groupType": 2,
"groupDivisionRuleId": 17806,
"groupSettleRuleId": 17943,
"goodsSource": 1,
"goodsTypeGroupRelations": [{ "goodsType": "G1" }],
"shop4sDeductChargeFlag": "Y",
"partnerDeductChargeFlag": "Y",
"goodsCostFlag": "N",
"expenseCategoryRules": [
{
"calculateMode": 1,
"expenseCategoryCalculateType": 1,
"expenseCategoryValue": "10"
}
],
"merchantDistributionRules": [{ "merchantId": "100" }],
"owningMerchantDistributionRules": [{ "merchantId": "100" }]
},
{
"groupType": 2,
"groupDivisionRuleId": 17808,
"groupSettleRuleId": 17944,
"goodsSource": 1,
"goodsTypeGroupRelations": [{ "goodsType": "G2" }],
"shop4sDeductChargeFlag": "Y",
"partnerDeductChargeFlag": "Y",
"goodsCostFlag": "N",
"expenseCategoryRules": [
{
"calculateMode": 1,
"expenseCategoryCalculateType": 1,
"expenseCategoryValue": "10"
}
],
"merchantDistributionRules": [{ "merchantId": "100" }],
"owningMerchantDistributionRules": [{ "merchantId": "100" }]
}
]
}
{
"description": "删光特殊品类 Tab 后期望的增量提交形态(合成)",
"incrementalRules": [
{
"groupType": 1,
"groupDivisionRuleId": "17805",
"groupSettleRuleId": 17942,
"type": "UPDATE",
"tabPaneIndex": 0
}
],
"pendingDeletes": [
{ "groupType": 2, "groupDivisionRuleId": "17806" },
{ "groupType": 2, "groupDivisionRuleId": "17808" }
],
"mergedSubmitExpectation": {
"firstEntryType": "UPDATE",
"firstEntryId": "17805",
"deleteIds": ["17806", "17808"]
}
}
import {
appendDeleteOpsToIncremental
} from "@/views/systemConfig/merchant/financialRules/utils/buildGoodsTypeGroupIncrementalRules"
import { GOODS_TYPE_GROUP_RULE_OP } from "@/views/systemConfig/merchant/financialRules/utils/goodsTypeGroupRuleOpType"
describe("appendDeleteOpsToIncremental", () => {
test("空 deletedEntries → 原样返回", () => {
const base = [{ type: GOODS_TYPE_GROUP_RULE_OP.UPDATE, groupDivisionRuleId: "17805" }]
expect(appendDeleteOpsToIncremental(base, null)).toEqual(base)
expect(appendDeleteOpsToIncremental(base, [])).toEqual(base)
})
test("追加 DELETE(字符串 id)", () => {
const base = [{ type: GOODS_TYPE_GROUP_RULE_OP.UPDATE, groupDivisionRuleId: "17805" }]
const out = appendDeleteOpsToIncremental(base, ["17806"])
expect(out).toHaveLength(2)
expect(out[1]).toEqual({
type: GOODS_TYPE_GROUP_RULE_OP.DELETE,
groupDivisionRuleId: "17806"
})
})
test("追加 DELETE(完整规则对象)", () => {
const base = [{ type: GOODS_TYPE_GROUP_RULE_OP.UPDATE, groupDivisionRuleId: "17805" }]
const out = appendDeleteOpsToIncremental(base, [
{ groupType: 2, groupDivisionRuleId: 17808, groupSettleRuleId: 17944 }
])
expect(out[1].type).toBe(GOODS_TYPE_GROUP_RULE_OP.DELETE)
expect(out[1].groupDivisionRuleId).toBe("17808")
expect(out[1].groupType).toBe(2)
expect(out[1].groupSettleRuleId).toBe(17944)
expect(out[1].tabPaneIndex).toBeUndefined()
})
test("deletedEntries 内重复 id → 去重", () => {
const out = appendDeleteOpsToIncremental([], ["17806", "17806", 17806])
expect(out).toHaveLength(1)
expect(out[0].groupDivisionRuleId).toBe("17806")
})
test("与 incremental 已有 DELETE 重复 → 跳过", () => {
const base = [
{ type: GOODS_TYPE_GROUP_RULE_OP.DELETE, groupDivisionRuleId: "17806" }
]
const out = appendDeleteOpsToIncremental(base, ["17806", "17808"])
expect(out).toHaveLength(2)
expect(out[1].groupDivisionRuleId).toBe("17808")
})
test("无 id 的对象 entry → 不产出 DELETE", () => {
const out = appendDeleteOpsToIncremental([], [{ groupType: 2, sessionAdded: true }])
expect(out).toHaveLength(0)
})
test("id 字段 fallback", () => {
const out = appendDeleteOpsToIncremental([], [{ id: "99", groupType: 2 }])
expect(out[0].groupDivisionRuleId).toBe("99")
})
})
import {
buildDivisionRuleTestParams,
buildDivisionRuleTestRetestParams,
buildDivisionRuleTestMoneyValidParams,
buildDivisionRuleTestUpdateMainProgressParams
} from "@/views/systemConfig/merchant/financialRules/utils/buildDivisionRuleTestParams"
describe("buildDivisionRuleTestParams", () => {
it("includes divisionRuleId from financial detail, not goodsTypeGroupDivisionId", () => {
const params = buildDivisionRuleTestParams({
merchantId: "m1",
sceneType: 1,
paymentChannelId: "ch1",
divisionRuleId: 4928,
baseSceneCode: "SC001"
})
expect(params).toEqual({
merchantId: "m1",
sceneType: 1,
paymentChannelId: "ch1",
divisionRuleId: 4928,
baseSceneCode: "SC001"
})
expect(params.goodsTypeGroupDivisionId).toBeUndefined()
})
it("omits empty divisionRuleId", () => {
const params = buildDivisionRuleTestParams({
merchantId: "m1",
sceneType: 1,
divisionRuleId: ""
})
expect(params.divisionRuleId).toBeUndefined()
})
it("buildDivisionRuleTestRetestParams only divisionRuleId and paymentChannelId", () => {
const params = buildDivisionRuleTestRetestParams({
divisionRuleId: 4928,
paymentChannelId: "ch1",
merchantId: "m1",
sceneType: 1
})
expect(params).toEqual({
divisionRuleId: 4928,
paymentChannelId: "ch1"
})
})
it("buildDivisionRuleTestMoneyValidParams requires explicit divisionRuleId", () => {
const testMerchantDivisions = [
{ merchantId: "m1", distributionMoney: "1.0", confirmDivisionMoney: "1.0" }
]
const params = buildDivisionRuleTestMoneyValidParams({
testObj: { paymentChannelId: "ch1", divisionRuleId: 100 },
testMerchantDivisions
})
expect(params.divisionRuleId).toBeUndefined()
expect(params.paymentChannelId).toBe("ch1")
expect(params.testMerchantDivisions).toEqual(testMerchantDivisions)
})
it("buildDivisionRuleTestMoneyValidParams uses explicit divisionRuleId and paymentChannelId", () => {
const testMerchantDivisions = [
{ merchantId: "m1", distributionMoney: "1.0", confirmDivisionMoney: "1.0" }
]
const params = buildDivisionRuleTestMoneyValidParams({
testObj: { paymentChannelId: "ch2" },
testMerchantDivisions,
divisionRuleId: 4928
})
expect(params).toEqual({
divisionRuleId: 4928,
paymentChannelId: "ch2",
testMerchantDivisions
})
expect(params.goodsTypeGroupDivisionId).toBeUndefined()
})
it("buildDivisionRuleTestUpdateMainProgressParams three fields", () => {
const params = buildDivisionRuleTestUpdateMainProgressParams({
divisionRuleId: 4928,
paymentChannelId: "ch1",
progress: 2
})
expect(params).toEqual({
divisionRuleId: 4928,
paymentChannelId: "ch1",
progress: 2
})
})
it("buildDivisionRuleTestUpdateMainProgressParams omits invalid progress", () => {
const params = buildDivisionRuleTestUpdateMainProgressParams({
divisionRuleId: 1,
paymentChannelId: "ch1",
progress: 0
})
expect(params.progress).toBeUndefined()
})
})
/**
* @jest-environment jsdom
*/
import { buildFullMergedGoodsTypeGroupRules } from "@/views/systemConfig/merchant/financialRules/utils/buildFullMergedGoodsTypeGroupRules"
import { loadFixture } from "./helpers/financialRulesTestHelpers"
describe("buildFullMergedGoodsTypeGroupRules", () => {
test("validated 槽位用快照,其余用缓存 fillDj", () => {
const fixture = loadFixture("all-plus-special-tabs")
const caches = fixture.goodsTypeGroupRules
const validated = { 1: { groupType: 2, groupDivisionRuleId: "validated-only" } }
const out = buildFullMergedGoodsTypeGroupRules({
tabCount: 3,
validatedByIndex: validated,
slotCaches: caches
})
expect(out).toHaveLength(3)
expect(out[0].groupDivisionRuleId).toBe(17805)
expect(out[1].groupDivisionRuleId).toBe("validated-only")
expect(out[2].groupDivisionRuleId).toBe(17808)
})
test("空缓存槽位 → fillDj 空对象", () => {
const out = buildFullMergedGoodsTypeGroupRules({
tabCount: 1,
validatedByIndex: {},
slotCaches: []
})
expect(out).toHaveLength(1)
expect(out[0]).toEqual({})
})
})
import {
buildStep2DisplayMerchants,
buildStep3VerifyMerchants,
isMerchantTestCompleted,
randomAllocatePool,
sumDisplayDivisionMoney,
isTotalProfitAmountValid,
PLATFORM_FIXED_AMOUNT,
ALLOCATABLE_POOL
} from "@/views/systemConfig/merchant/financialRules/utils/buildStep2DisplayMerchants"
describe("buildStep2DisplayMerchants", () => {
it("randomAllocatePool sums to 3", () => {
const amounts = randomAllocatePool(
[{}, {}, {}],
() => 0.5
)
const sum = amounts.reduce((a, b) => a + b, 0)
expect(Math.round(sum * 100)).toBe(Math.round(ALLOCATABLE_POOL * 100))
})
it("shows distributionMoney in step2 input", () => {
const list = [
{ merchantName: "流量", targetType: 1, distributionMoney: "2.5" },
{ merchantName: "平台", targetType: 4, distributionMoney: "0.5" }
]
const display = buildStep2DisplayMerchants(list)
expect(display.find((m) => m.merchantName === "流量").displayDivisionMoney).toBe("2.5")
expect(display.find((m) => m.merchantName === "平台").displayDivisionMoney).toBe("0.5")
})
it("distributionMoney 0 or empty means testCompleted", () => {
expect(isMerchantTestCompleted({ distributionMoney: 0 })).toBe(true)
expect(isMerchantTestCompleted({ distributionMoney: "0" })).toBe(true)
expect(isMerchantTestCompleted({ distributionMoney: "" })).toBe(true)
expect(isMerchantTestCompleted({ distributionMoney: null })).toBe(true)
expect(isMerchantTestCompleted({ distributionMoney: "1.5" })).toBe(false)
const display = buildStep2DisplayMerchants([
{ merchantName: "已测", targetType: 2, distributionMoney: 0 },
{ merchantName: "待测", targetType: 1, distributionMoney: "3" }
])
expect(display.find((m) => m.merchantName === "已测").testCompleted).toBe(true)
expect(display.find((m) => m.merchantName === "已测").displayDivisionMoney).toBe("")
expect(display.find((m) => m.merchantName === "待测").testCompleted).toBe(false)
expect(display.find((m) => m.merchantName === "待测").displayDivisionMoney).toBe("3")
})
it("platform fallback when no distributionMoney", () => {
const list = [
{ merchantName: "流量", targetType: 1, distributionMoney: "3" },
{ merchantName: "平台", targetType: 4, distributionMoney: "0.5" }
]
const display = buildStep2DisplayMerchants(list, { randomFn: () => 1 })
expect(display.find((m) => m.merchantName === "平台").displayDivisionMoney).toBe("0.5")
})
it("isTotalProfitAmountValid excludes completed merchants", () => {
const merchants = [
{ testCompleted: true, displayDivisionMoney: "" },
{ testCompleted: false, displayDivisionMoney: "0.5" },
{ testCompleted: false, displayDivisionMoney: "3" }
]
expect(isTotalProfitAmountValid(merchants)).toBe(true)
expect(sumDisplayDivisionMoney(merchants)).toBe(3.5)
})
it("uses cache when distributionMoney missing on refetch", () => {
const list = [
{ merchantId: "1", merchantName: "A", targetType: 1, distributionMoney: "3" }
]
const first = buildStep2DisplayMerchants(list)
const cache = { 1: first[0].displayDivisionMoney }
const second = buildStep2DisplayMerchants(
[{ merchantId: "1", merchantName: "A", targetType: 1, distributionMoney: "3" }],
{ randomFn: () => 0.9, cachedAllocations: cache }
)
expect(second[0].displayDivisionMoney).toBe("3")
})
it("buildStep3VerifyMerchants shares testCompleted", () => {
const list = [
{ merchantName: "A", distributionMoney: 0 },
{ merchantName: "B", distributionMoney: "1.2", confirmDivisionMoney: "1.2" }
]
const step3 = buildStep3VerifyMerchants(list)
expect(step3[0].testCompleted).toBe(true)
expect(step3[1].testCompleted).toBe(false)
expect(step3[1].confirmDivisionMoney).toBe("1.2")
})
})
import { buildWebSocketUrl } from "@/views/systemConfig/merchant/financialRules/utils/buildWebSocketUrl"
describe("buildWebSocketUrl", () => {
it("uses wss on https pages for host-only url", () => {
expect(buildWebSocketUrl("host/path?query", "https:")).toBe(
"wss://host/path?query"
)
})
it("uses ws on http pages for host-only url", () => {
expect(buildWebSocketUrl("host/path", "http:")).toBe("ws://host/path")
})
it("upgrades ws:// to wss:// on https pages", () => {
expect(buildWebSocketUrl("ws://host/path", "https:")).toBe("wss://host/path")
})
it("keeps wss:// on https pages", () => {
expect(buildWebSocketUrl("wss://host/path", "https:")).toBe("wss://host/path")
})
it("returns empty string for invalid input", () => {
expect(buildWebSocketUrl("", "https:")).toBe("")
expect(buildWebSocketUrl(null, "https:")).toBe("")
})
it("strips leading // before adding scheme", () => {
expect(buildWebSocketUrl("//host/path", "http:")).toBe("ws://host/path")
})
})
/**
* @jest-environment jsdom
*/
import { collectGoodsTypeGroupRulesFromTabs } from "@/views/systemConfig/merchant/financialRules/utils/collectGoodsTypeGroupRulesFromTabs"
describe("collectGoodsTypeGroupRulesFromTabs", () => {
test("激活 Tab 走 mergeChildClassificationPayload", () => {
const caches = [
{ groupType: 1, groupDivisionRuleId: 17805, expenseCategoryRules: [{ id: 1 }] }
]
const tabs = [{ name: "1", title: "全部品类" }]
const out = collectGoodsTypeGroupRulesFromTabs({
editableTabs: tabs,
slotCaches: caches,
getChildPayloadByPaneName: () => ({ groupType: 1, expenseCategoryRules: [{ id: 1 }] })
})
expect(out[0].groupDivisionRuleId).toBe(17805)
})
test("非激活 Tab 读缓存", () => {
const caches = [
{ groupType: 1, groupDivisionRuleId: 17805 },
{ groupType: 2, groupDivisionRuleId: 17806 }
]
const tabs = [{ name: "1" }, { name: "2" }]
const out = collectGoodsTypeGroupRulesFromTabs({
editableTabs: tabs,
slotCaches: caches,
getChildPayloadByPaneName: (name) => (name === "1" ? { groupType: 1 } : null)
})
expect(out[1].groupDivisionRuleId).toBe(17806)
expect(out[1].groupType).toBe(2)
})
})
import {
isDivisionRuleAutoTestPending,
hasPendingDivisionRuleAutoTest,
findPendingDivisionRuleAutoTestIndices,
findDivisionRuleTestByChannelId,
buildDivisionRuleAutosByChannelId,
shouldShowDivisionTestButton
} from "@/views/systemConfig/merchant/financialRules/utils/divisionRuleAutoTest"
describe("divisionRuleAutoTest", () => {
it("isDivisionRuleAutoTestPending: strict testFlag N and autoFlag Y", () => {
expect(
isDivisionRuleAutoTestPending({ autoFlag: "Y", testFlag: "N" })
).toBe(true)
expect(
isDivisionRuleAutoTestPending({ autoFlag: "Y", testFlag: "Y" })
).toBe(false)
expect(
isDivisionRuleAutoTestPending({ autoFlag: "Y" })
).toBe(false)
expect(
isDivisionRuleAutoTestPending({ autoFlag: "N", testFlag: "N" })
).toBe(false)
})
it("hasPendingDivisionRuleAutoTest", () => {
const list = [
{ autoFlag: "Y", testFlag: "Y" },
{ autoFlag: "Y", testFlag: "N" }
]
expect(hasPendingDivisionRuleAutoTest(list)).toBe(true)
expect(hasPendingDivisionRuleAutoTest([{ autoFlag: "Y", testFlag: "Y" }])).toBe(false)
})
it("findPendingDivisionRuleAutoTestIndices", () => {
const list = [
{ autoFlag: "N", testFlag: "N" },
{ autoFlag: "Y", testFlag: "N" },
{ autoFlag: "Y", testFlag: "Y" }
]
expect(findPendingDivisionRuleAutoTestIndices(list)).toEqual([1])
})
it("findDivisionRuleTestByChannelId matches paymentChannelId", () => {
const tests = [
{ paymentChannelId: "ch1", divisionRuleTestItem: { orderCode: "A" } },
{
paymentChannelId: "ch2",
divisionRuleTestItem: { paymentChannelId: "ch2", orderCode: "B" }
}
]
expect(findDivisionRuleTestByChannelId(tests, "ch2").divisionRuleTestItem.orderCode).toBe("B")
expect(findDivisionRuleTestByChannelId(tests, "ch9")).toBe(null)
})
it("buildDivisionRuleAutosByChannelId", () => {
const map = buildDivisionRuleAutosByChannelId([
{ paymentChannelId: 1, autoFlag: "Y", testFlag: "N" },
{ paymentChannelId: 2, autoFlag: "N", testFlag: "N" }
])
expect(map[1]).toEqual({ paymentChannelId: 1, autoFlag: "Y", testFlag: "N" })
expect(map[2].autoFlag).toBe("N")
})
it("buildDivisionRuleAutosByChannelId: snapshot isolated from local autoFlag toggle", () => {
const channel = { paymentChannelId: 10, autoFlag: "N", testFlag: "N" }
const map = buildDivisionRuleAutosByChannelId([channel])
channel.autoFlag = "Y"
expect(map[10].autoFlag).toBe("N")
expect(
shouldShowDivisionTestButton(channel, map, "rule-1")
).toBe(false)
})
it("shouldShowDivisionTestButton: server pending and local auto on", () => {
const serverMap = buildDivisionRuleAutosByChannelId([
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" }
])
expect(
shouldShowDivisionTestButton(
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" },
serverMap,
"rule-1"
)
).toBe(true)
})
it("shouldShowDivisionTestButton: local auto on without server pending stays hidden", () => {
const serverMap = buildDivisionRuleAutosByChannelId([
{ paymentChannelId: 10, autoFlag: "N", testFlag: "N" }
])
expect(
shouldShowDivisionTestButton(
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" },
serverMap,
"rule-1"
)
).toBe(false)
})
it("shouldShowDivisionTestButton: no divisionRuleId", () => {
const serverMap = buildDivisionRuleAutosByChannelId([
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" }
])
expect(
shouldShowDivisionTestButton(
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" },
serverMap,
undefined
)
).toBe(false)
})
it("shouldShowDivisionTestButton: local auto off hides even if server pending", () => {
const serverMap = buildDivisionRuleAutosByChannelId([
{ paymentChannelId: 10, autoFlag: "Y", testFlag: "N" }
])
expect(
shouldShowDivisionTestButton(
{ paymentChannelId: 10, autoFlag: "N", testFlag: "N" },
serverMap,
"rule-1"
)
).toBe(false)
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!