Commit af3fc35a by 张晓玮

Merge branch 'v4.26.0' into 'develop'

V4.26.0

See merge request !7
2 parents d3ab59af 9a4c4bcd
import { http, http_common } from '@/main'
const path = 'dj.api.smartcarlife.'
// 服务商下门店数据
const getSimpleMerchantList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.scenemerchantref.queryShopRefByPartnerShop`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 服务商下门店数据(分页)
const getSimpleMerchantListByPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.scenemerchantref.queryShopRefByPartnerShopPage`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 所属系列所属分类下拉框数据
const getPurchaseGroundingSearchSelectData = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.listByDataType`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取采购上架列表
const getPurchaseGroundingList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 导出采购上架记录
const exportPurchaseGrounding = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 新增编辑采购上架记录
const addOrUpdatePurchaseGrounding = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smarcarlife.purchaseMall.addOrUpdate`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 上架商品数据
const getGroundingGoodsList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}upgradeGoods.listWithPage`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取采购上架记录详情
const getPurchaseGroundingDetail = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.getById`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 删除采购上架记录
const delPurchaseGrounding = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.deleteById`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 上下架采购上架记录
const updatePurchaseGroundingStatus = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseMall.updateStatus`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default {
getSimpleMerchantList,
getSimpleMerchantListByPage,
getPurchaseGroundingSearchSelectData,
getPurchaseGroundingList,
exportPurchaseGrounding,
addOrUpdatePurchaseGrounding,
getGroundingGoodsList,
getPurchaseGroundingDetail,
delPurchaseGrounding,
updatePurchaseGroundingStatus
}
\ No newline at end of file \ No newline at end of file
import { http, http_common } from '@/main'
const path = 'dj.api.smarcarlife.'
// 采购审核列表
const getPurchaseCheckList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseApply.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 审核
const auditPurchaseCheck = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseApply.audit`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 驳回
const cancelPurchaseCheck = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseApply.reject`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 导出
const exportPurchaseCheck = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseApply.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
getPurchaseCheckList,
auditPurchaseCheck,
cancelPurchaseCheck,
exportPurchaseCheck
}
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,7 @@ html { ...@@ -10,7 +10,7 @@ html {
.purchase .container { .purchase .container {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1); // box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px; padding: 20px;
} }
......
import Vue from 'vue' import Vue from 'vue'
import { defaultStatusOptions,putStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData } from '@/utils/constants.js' import { defaultStatusOptions,putStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData, purchaseGroundingStatusList, groundingCheckStatusList } from '@/utils/constants.js'
// 发货状态 // 发货状态
Vue.filter('deliveryStatus', (id, formatString) => { Vue.filter('deliveryStatus', (id, formatString) => {
const text = '--' const text = '--'
...@@ -41,3 +41,25 @@ Vue.filter('deliveryStatus', (id, formatString) => { ...@@ -41,3 +41,25 @@ Vue.filter('deliveryStatus', (id, formatString) => {
} }
return text return text
}) })
// 上架记录状态
Vue.filter('groundingStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < purchaseGroundingStatusList.length; i++) {
if (purchaseGroundingStatusList[i].id === id) {
return purchaseGroundingStatusList[i].label
}
}
return text
})
// 采购审核状态
Vue.filter('purchaseCheckStatus',(id, formatString) => {
const text = '--'
for (let i = 0; i < groundingCheckStatusList.length; i++) {
if (groundingCheckStatusList[i].id === id) {
return groundingCheckStatusList[i].label
}
}
return text
})
...@@ -13,6 +13,18 @@ const staticRoutes = Object.freeze([{ ...@@ -13,6 +13,18 @@ const staticRoutes = Object.freeze([{
path: '/DeliverList/index', path: '/DeliverList/index',
component: resolve => require([`@/views/DeliverList/index.vue`], resolve), component: resolve => require([`@/views/DeliverList/index.vue`], resolve),
meta: {} meta: {}
},
{
name: 'purchaseGrounding',
path: 'purchaseGrounding/index',
component: resolve => require([`@/views/purchaseGrounding/index.vue`], resolve),
meta: {}
},
{
name: 'purchaseCheck',
path: 'purchaseCheck/index',
component: resolve => require([`@/views/purchaseCheck/index.vue`], resolve),
meta: {}
} }
]) ])
export default staticRoutes export default staticRoutes
\ No newline at end of file \ No newline at end of file
...@@ -86,3 +86,51 @@ export const purchaseTypeList = [ ...@@ -86,3 +86,51 @@ export const purchaseTypeList = [
} }
] ]
export const membraneTypeList = [1, 4, 6, 12, 14] export const membraneTypeList = [1, 4, 6, 12, 14]
// 采购上架状态
export const purchaseGroundingStatusList = [
{
id: 0,
label: '草稿'
},
{
id: 1,
label: '已下架'
},
{
id: 2,
label: '已上架'
}
]
// 采购审核状态
export const groundingCheckStatusList = [
{
id: 1,
label: '待审核'
},
{
id: 2,
label: '已审核'
},
{
id: 3,
label: '已取消'
},
{
id: 4,
label: '已驳回'
}
]
// 商品来源
export const goodsSourceOptions = [
{
id: 0,
label: '嘀加'
},
{
id: 1,
label: '自营'
}
]
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<div class="purchase"> <div class="purchase">
<div class="container"> <div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header"> <div class="table-header">
<h2>发货单列表</h2> <h2>发货单列表</h2>
<div> <div>
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
fn: '入库' fn: '入库'
}, },
condition: row => { condition: row => {
return row.putStatus == 1 && row.operatorStatus == 1 || row.putStatus == 3 && row.operatorStatus == 1 return row.putStatus == 1 || row.putStatus == 3
}, },
listeners: { listeners: {
click: this.handleWarehousing click: this.handleWarehousing
...@@ -167,7 +167,9 @@ export default { ...@@ -167,7 +167,9 @@ export default {
getListApi: this.$apis.delivery.getDeliveryList, getListApi: this.$apis.delivery.getDeliveryList,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: {
width: '110px'
},
tableColumns: [ tableColumns: [
{ {
label: '商品名称', label: '商品名称',
...@@ -235,11 +237,6 @@ export default { ...@@ -235,11 +237,6 @@ export default {
label: '状态', label: '状态',
prop: 'putStatus', prop: 'putStatus',
addHtml: 'putStatus' addHtml: 'putStatus'
},
{
label: '操作',
width: '180px',
addHtml: 'auth-button'
} }
] ]
}, },
......
<!-- 采购审核 -->
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<h2>采购审核列表</h2>
<div>
<GLButton size="small" @click="handleExport" fn="导出">导出</GLButton>
</div>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="orderRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<template slot="status" slot-scope="scope">
<div>
<span :class="Spot[scope.scope.status-1]"></span>
<span>{{ scope.scope.status | purchaseCheckStatus }}</span>
</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<rejectDialog v-if="rejectDialogVisible" :visible.sync="rejectDialogVisible" @handleRejectConfirm="handleRejectConfirm"></rejectDialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import rejectDialog from './rejectDialog'
import { groundingCheckStatusList, goodsSourceOptions } from '@/utils/constants.js'
export default {
name: 'purchaseCheck',
components: {
rejectDialog
},
data() {
return {
size: 'small',
url: url,
Spot:['yellowSpot','greenSpot','ashSpot','redSpot'],
searchForm: {
sortType: 2,
orderTimeStr: [],
merchantName: '',
upgradeGoodsName: '',
type: '',
goodsName: '',
goodsType: '',
goodsSource: '',
status: '',
purchaseOrderCode: '',
placeOrderTimeStr: []
},
tableSearchForm: {},
paramsObj: {},
// 查看门店
detailVisible: false,
showFormData: [
{
label: '下单时间',
name: 'placeOrderTimeStr',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '下单商户',
name: 'merchantName',
type: 'input',
isClear: true
},
{
label: '商品名称',
name: 'upgradeGoodsName',
type: 'input',
isClear: true
},
{
label: '商品编码',
name: 'type',
type: 'input',
isClear: true
},
{
label: '所属系列',
name: 'goodsName',
type: 'input',
maxlength: 20,
isClear: true
},
{
label: '所属分类',
name: 'goodsType',
type: 'select',
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName',
optionsName: 'classificationOptions'
},
{
label: '商品来源',
name: 'goodsSource',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'goodsSourceOptions'
},
{
label: '状态',
name: 'status',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'groundingCheckStatusList'
},
{
label: '采购订单',
name: 'purchaseOrderCode',
type: 'input',
isClear: true
}
],
tableButtonList: [
{
type: 'GLButton',
name: '审核',
attrs: {
type: 'text',
fn: '审核'
},
condition: row => {
return row.status == 1
},
listeners: {
click: this.handleCheck
}
},
{
type: 'GLButton',
name: '驳回',
attrs: {
type: 'text',
fn: '驳回'
},
condition: row => {
return row.status == 1
},
listeners: {
click: this.handleReject
}
}
],
// 表格
getListApi: this.$apis.purchaseCheck.getPurchaseCheckList,
tableParams: {
listName: 'list',
tableOption: {
width: '110px'
},
tableColumns: [
{
label: '下单时间',
prop: 'orderTime',
formatter: cellValue => {
return dayjs(cellValue.orderTime).format('YYYY-MM-DD HH:mm:ss')
},
width: 180
},
{
label: '下单商户',
prop: 'merchantName',
width: 150,
line: 1,
},
{
label: '收货人',
prop: 'contactName',
width: 100
},
{
label: '收货人电话',
prop: 'contactPhone',
width: 150
},
{
label: '收货地址',
prop: 'contactAddress',
width: 180,
line: 1
},
{
label: '商品来源',
prop: 'goodsSource',
width: 100,
formatter: cellValue => {
return goodsSourceOptions.findIndex(v => v.id == cellValue.goodsSource) > -1 ? goodsSourceOptions[goodsSourceOptions.findIndex(v => v.id == cellValue.goodsSource)].label : '-'
}
},
{
label: '商品名称',
prop: 'upgradeGoodsName',
width: 100,
line: 1
},
{
label: '商品编码',
prop: 'type',
width: 150,
line: 1
},
{
label: '系列',
prop: 'goodsName',
width: 150,
line: 1
},
{
label: '所属分类',
prop: 'goodsTypeName',
width: 150,
line: 1
},
{
label: '采购数量',
prop: 'goodsNumber',
width: 100
},
{
label: '门店采购价/元',
prop: 'shopPurchasePrice',
formatter: cellValue => {
return cellValue.shopPurchasePrice ? '¥' + cellValue.shopPurchasePrice : '-'
},
width: 150
},
{
label: '嘀加采购价/元',
prop: 'upgradePurchasePrice',
formatter: cellValue => {
return cellValue.upgradePurchasePrice ? '¥' + cellValue.upgradePurchasePrice : '-'
},
width: 150
},
{
label: '采购总价/元',
prop: 'totalPrice',
formatter: cellValue => {
return cellValue.totalPrice ? '¥' + cellValue.totalPrice : '-'
},
width: 150
},
{
label: '状态',
prop: '',
addHtml: 'status',
width: 100
},
{
label: '关联采购订单',
prop: 'purchaseOrderCode',
width: 180
},
{
label: '审核人',
prop: 'reviewedBy',
width: 150,
line: 1
},
{
label: '审核时间',
prop: 'reviewedDate',
formatter: cellValue => {
return cellValue.reviewedDate ? dayjs(cellValue.reviewedDate).format('YYYY-MM-DD HH:mm:ss') : '-'
},
width: 180
},
{
label: '驳回原因',
prop: 'rejectCause',
width: 180
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
groundingCheckStatusList: groundingCheckStatusList,
goodsSourceOptions: goodsSourceOptions,
goodsSeriesList: [], // 所属系列
classificationOptions: [] // 所属分类
},
rejectDialogVisible: false,
rejectObj: {},
tipsTitleStyle: 'style="font-size: 16px;color: #333333;"',
tipsContentStyle: 'style="font-size: 14px;color: #666666;"'
}
},
mounted() {
// 获取所属分类
this.getPurchaseGroundingSearchSelectData(1)
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.placeOrderTimeStr.length) {
params.orderTimeStr[0] = new Date(this.searchForm.placeOrderTimeStr[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.orderTimeStr[1] = new Date(this.searchForm.placeOrderTimeStr[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.placeOrderTimeStr
return params
},
// 所属分类
getPurchaseGroundingSearchSelectData(num) {
this.$apis.grounding.getPurchaseGroundingSearchSelectData({ dataType: num }).then(res => {
this.baseData['classificationOptions'] = res || []
this.getOptionsList('showFormData')
})
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.placeOrderTimeStr
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '是',
cancelButtonText: '否',
dangerouslyUseHTMLString: true,
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
//审核
handleCheck(row) {
if (row?.goodsSource == 1) { // 自营商品
this.secondConfirm('审核', `<p ${this.tipsTitleStyle}>是否确定审核?</p><p ${this.tipsContentStyle}>审核通过后,系统会自动创建自采采购订单并自动入库,且无法撤回</p>`, 'purchaseCheck', 'auditPurchaseCheck', { id: row.id })
} else if (row?.goodsSource == 0) { // 嘀加商品
this.secondConfirm('审核', `<p ${this.tipsTitleStyle}>是否确定审核?</p><p ${this.tipsContentStyle}>审核通过后,系统会自动创建商城采购订单,且无法撤回</p>`, 'purchaseCheck', 'auditPurchaseCheck', { id: row.id })
}
},
//驳回
handleReject(row) {
this.rejectObj = row
this.rejectDialogVisible = true
},
// 驳回确认
handleRejectConfirm(dataForm) {
console.log(dataForm)
this.$apis.purchaseCheck.cancelPurchaseCheck({ id: this.rejectObj?.id, rejectCause: dataForm?.reason }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.rejectDialogVisible = false
this.handleSearch()
}
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.orderRef.data.length ? (this.$refs.orderRef.tableHeightValues = '') : this.$refs.orderRef.setTableHeightFun()
},
handleExport() {
var params = this.getParams()
this.$apis.purchaseCheck.exportPurchaseCheck(params).then(res => {
window.location.href = res
})
},
handleSearch() {
this.$refs.orderRef.refreshTable()
},
handleReset() {
this.searchForm = {
sortType: 2,
orderTimeStr: [],
merchantName: '',
upgradeGoodsName: '',
type: '',
goodsName: '',
goodsType: '',
goodsSource: '',
status: '',
purchaseOrderCode: '',
placeOrderTimeStr: []
}
this.handleSearch()
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
margin-top: 20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
.glbtn {
left: 46px;
position: absolute;
}
.btn {
right: 47px;
position: absolute;
}
}
.greenSpot {
@include dot;
background: $color-green;
}
.yellowSpot {
@include dot;
background: $color-yellow;
}
.ashSpot {
@include dot;
background: $color-gray;
}
.redSpot {
@include dot;
background: $color-red;
}
.table-btns /deep/.el-button--text {
min-width: 0 !important;
padding: 0;
}
}
</style>
<!-- 驳回弹窗 -->
<template>
<GLDialog title="驳回" :visible.sync="dialogVisible" class="rejectDialog" :destroy-on-close="true" :close-on-click-modal="false" :before-close="handleClose" @onOk="handleConfirm" @onCancel="handleClose">
<el-form ref="rejectForm" class="rejectForm" :model="dataForm" :rules="formRules" label-width="154px" size="small">
<el-form-item label="驳回原因:" prop="reason">
<el-input v-model.trim="dataForm.reason" placeholder="请输入驳回原因" maxlength="20" class="form-node"></el-input>
</el-form-item>
</el-form>
</GLDialog>
</template>
<script>
import { beforeRangePickerOptions } from '@/components/glsx-combi-form/common'
export default {
name: 'rejectDialog',
props: {
visible: {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => {}
}
},
data() {
return {
beforeRangePickerOptions,
dataForm: {
reason: ''
},
formRules: {
reason: [{ required: true, message: '请输入驳回原因', trigger: 'change' }]
},
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
mounted() {
this.$nextTick(() => {
this.$refs['rejectForm'].resetFields()
})
},
methods: {
handleClose() {
this.dialogVisible = false
},
handleConfirm() {
this.$refs['rejectForm'].validate(valid => {
if (valid) {
this.$emit('handleRejectConfirm', this.dataForm)
}
})
},
}
}
</script>
<style scoped lang="scss">
.rejectDialog{
.form-node{
width: 432px;
}
/deep/.el-dialog__body{
display: flex;
align-items: center;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 新建/编辑采购上架 -->
<template>
<div class="edit-purchase-grounding purchase-grounding edit-box">
<div class="container edit-container">
<p class="edit-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :pageThat="this" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectGoods">
<el-select
v-model="editForm.upgradeGoodsId"
placeholder="请选择上架商品"
@change="handleGoodsChange"
style="width: 432px"
@focus="handleGoodsFocus"
remote
reserve-keyword
@visible-change="visibleChange"
:remote-method="remoteMethod"
v-el-select-loadmore="interestsLoadmore"
filterable>
<el-option v-for="subItem in goodsList"
:key="subItem.id"
:label="subItem.upgradeGoodsName"
:value="subItem.id">
</el-option>
</el-select>
</div>
<div slot="goodsInfo">
<div class="goodsInfo-box">
<div class="item" v-for="(subItem, subIndex) in copyGoodsDetailForm" :key="subIndex">
<div v-if="subItem.addHtml" class="item_box">
<div class="label">{{ (membraneTypeList.includes(selectedGoodsInfo['goodsType']) ? subItem.label + `(元)/卷` : (subItem.label + '(元)/件')) }}:</div>
<div class="value">{{ priceFilter(selectedGoodsInfo[subItem.value]) }}</div>
</div>
<div v-else class="item_box">
<div class="label">{{ subItem.label + ':' }}</div>
<div class="value">{{ selectedGoodsInfo[subItem.value] || '-' }}</div>
</div>
</div>
</div>
</div>
</glsx-combi-form>
</div>
<div class="container edit-container">
<p class="edit-title">上架门店</p>
<glsx-combi-form class="edit-form-container" ref="editFormMerchantRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="merchantEditFormData" :formRules="editRule">
<div slot="merchantTable" :style="{ width: `calc(100% - ${defaultLabelWidth} )` }">
<div class="table-title">
上架门店列表
<el-button type="primary" plain @click="handleRelateStoreClose(scope)">选择门店</el-button>
</div>
<GLTable ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList">
<span slot="customBtn" slot-scope="scope">
<el-button class="p-0" type="text" @click="handleMerchantDelete(scope)">删除</el-button>
</span>
</GLTable>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
<!-- 新增/草稿显示 -->
<el-button v-if="editType == 'add' || editForm.status == 0" type="primary" @click="handleConfirm(true)" plain size="medium" :loading="loading">草稿</el-button>
<el-button type="primary" @click="handleConfirm(false)" size="medium" :loading="loading">保存上架</el-button>
</GLFooter>
<!-- 门店弹窗 -->
<relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="selectedList" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<el-row slot>
<el-form :model="storeSearchForm" ref="relate" :inline="true" label-width="90px">
<el-form-item label="客户名称:" prop="merchantName">
<el-input :size="size" v-model.trim="storeSearchForm.merchantName" placeholder="请输入客户名称" clearable></el-input>
</el-form-item>
<el-form-item label="商户号:" prop="merchantName">
<el-input :size="size" v-model.trim="storeSearchForm.merchantId" placeholder="请输入商户号" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleSearchStore">搜索</el-button>
<el-button :size="size" @click="handleSearchReset">重置</el-button>
</el-form-item>
</el-form>
</el-row>
</relate-store-dialog>
</div>
</template>
<script>
import { goodsSourceOptions, membraneTypeList } from '@/utils/constants.js'
import relateStoreDialog from './relateStoreDialog'
export default {
name: 'editPurchaseGrounding',
components: {
relateStoreDialog
},
data() {
var checkPrice = (rule, value, callback) => {
if (isNaN(+value)) {
callback(new Error('请输入数字值'))
} else {
if (!/^(?:\d{1,6})(?:\.\d{1,2})?$/.test(value)) {
callback(new Error('仅支持输入0~999999小数点后两位'))
} else {
callback()
}
}
}
return {
size: 'small',
editChildRef: 'editChildRef',
routeInfo: {
editType: 'add',
id: ''
},
editStatus: false,
editForm: {
goodsSource: '',
upgradeGoodsId: '',
shopPurchasePrice: '',
merchantList: [],
status: ''
},
editRule: {
goodsSource: [{ required: true, message: '请选择商品来源', trigger: 'change' }],
upgradeGoodsId: [{ required: true, message: '请选择上架商品', trigger: 'change' }],
shopPurchasePrice: [
{ required: true, message: '请输入门店采购价', trigger: 'blur' },
{ validator: checkPrice, trigger: 'blur' }
]
},
isEdit: true,
editFormData: [
{
label: '商品来源',
name: 'goodsSource',
type: 'radio',
optionList: goodsSourceOptions,
optionId: 'id',
optionLabel: 'label',
handleRadioChange: this.handleRadioChange
},
{
label: '上架商品',
name: 'upgradeGoodsId',
addHtml: 'selectGoods'
},
{
label: '门店采购价(元)/件',
name: 'shopPurchasePrice',
type: 'input'
}
],
merchantEditFormData: [
{
addHtml: 'merchantTable'
}
],
// 选择门店
relateStoreVisible: false,
storeApi: this.$apis.grounding.getSimpleMerchantListByPage,
storeSearchForm: {
merchantName: '',
merchantId: ''
},
selectedList: [],
// 门店表格
tableParams: {
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
},
{
label: '操作',
prop: '',
addHtml: 'customBtn'
}
]
},
selectedGoodsInfo: {},
goodsDetailForm: [
{
label: '商品名称',
value: 'upgradeGoodsName',
},
{
label: '商品编码',
value: 'type'
},
{
label: '嘀加采购价',
addHtml: 'DJPurchasePrice',
value: 'purchasePrice'
},
{
label: '所属分类',
value: 'goodsTypeName'
},
{
label: '所属系列',
value: 'goodsName'
}
],
membraneTypeList, // 膜类code集合
goodsList: [], // 上架商品下拉框数据
currentPage: 1,
requestFlag: true
}
},
watch: {
editForm: {
handler(val) {
this.editStatus = true
},
deep: true
},
'editForm.upgradeGoodsId': {
handler(val) {
if (val && this.editFormData[2]?.name !== 'goodsInfo') {
this.editFormData.splice(2, 0, {
name: 'goodsInfo',
addHtml: 'goodsInfo'
})
}
},
deep: true
},
goodsList: {
handler(val) {
if (val.length) {
let upgradeGoodsId = this.editForm?.upgradeGoodsId
let obj = this.editForm?.goodsSource == 0 ? val[val.findIndex(subVal => subVal.id == upgradeGoodsId)] : val[val.findIndex(subVal => subVal.id == upgradeGoodsId)]
this.selectedGoodsInfo = this.filterGoodsData(obj)
}
},
deep: true
},
selectedGoodsInfo: {
handler(val) {
this.setUnit() // 修改采购价单位
// 嘀加采购价字段
let copyGoodsDetailForm = this.$common.utils.deepClone(this.goodsDetailForm)
if (this.editForm?.goodsSource == 1) { // 自营
let index = copyGoodsDetailForm.findIndex(val => val.value == 'purchasePrice')
if (index > -1) {
copyGoodsDetailForm.splice(index, 1)
this.copyGoodsDetailForm = copyGoodsDetailForm
}
} else if (this.editForm?.goodsSource == 0) { // 嘀加
this.copyGoodsDetailForm = copyGoodsDetailForm
}
},
deep: true
}
},
directives: {
'el-select-loadmore': {
bind (el, binding) {
const SELECTWRAP_DOM = el.querySelector(
'.el-select-dropdown .el-select-dropdown__wrap'
)
SELECTWRAP_DOM.addEventListener('scroll', function () {
const condition =
this.scrollHeight - this.scrollTop <= this.clientHeight + 40
if (condition) {
binding.value()
}
})
}
}
},
mounted() {
this.keyDown()
this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : ''
},
methods: {
keyDown() {
document.onkeydown = function() {
var evt = window.event || arguments[0]
if (evt && evt.keyCode == 13) {
if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true
if (typeof evt.stopPropagation == 'function') evt.stopPropagation()
return false
}
return true
}
},
setUnit() {
let index = this.editFormData.findIndex(val => val.name == 'shopPurchasePrice')
if (this.membraneTypeList.includes(this.selectedGoodsInfo?.goodsType)) { // 所选商品是膜类 门店采购价单位修改
if(index > -1) this.editFormData[index].label = '门店采购价(元)/卷'
} else {
if(index > -1) this.editFormData[index].label = '门店采购价(元)/件'
}
},
// 获取上架数据
remoteMethod(query) {
this.goodsNameKeyword = query
this.currentPage = 1
this.goodsList = []
this.getSelectingList(this.editForm?.goodsSource) // 请求接口
},
visibleChange(data) {
// 获取焦点重新渲染下拉框数据
if (data) {
if (this.goodsNameKeyword) {
this.goodsNameKeyword = ''
this.currentPage = 1
this.goodsList = []
this.getSelectingList(this.editForm?.goodsSource)
}
}
},
handleGoodsFocus() {
if ((this.editForm?.goodsSource ?? '') === '')return this.$message.error('请选择商品来源')
if (!this.goodsList?.length && this.requestFlag) return this.$message.error('暂无商品')
},
// 获取更多上架商品
interestsLoadmore() {
setTimeout(() => {
this.currentPage = this.currentPage + 1
if (this.allPages < this.currentPage) {
this.currentPage = this.allPages
return
}
this.getSelectingList(this.editForm?.goodsSource)
}, 10)
},
handleRadioChange(val) {
this.goodsList = []
this.editForm.upgradeGoodsId = ''
this.$nextTick(() => {
this.$refs['editFormRef'].$refs['editChildRef'].clearValidate()
// 清空已选商品的附带信息
this.selectedGoodsInfo = {}
let index = this.editFormData.findIndex(subVal => subVal.name == 'goodsInfo')
if (index > -1) this.editFormData.splice(index, 1)
})
this.currentPage = 1
// 获取上架商品数据
this.getSelectingList(val)
},
filterGoodsData(obj) {
// 已选商品是拉取商品的首页数据或用于回显concat的数据适配
if (obj) {
obj.id = obj?.upgradeGoods?.id || obj?.id
obj.upgradeGoodsName = obj?.upgradeGoods?.upgradeGoodsName || obj?.upgradeGoodsName
obj.type = obj?.upgradeGoods?.type || obj?.type
obj.purchasePrice = obj?.upgradeGoods?.purchasePrice || obj?.purchasePrice
obj.goodsTypeName = obj?.goodsInfo?.goodsTypeName || obj?.goodsTypeName
obj.goodsName = obj?.goodsInfo?.goodsName || obj?.goodsName
obj.goodsType = obj?.goodsInfo?.goodsType || obj?.goodsType
}
return obj || {}
},
priceFilter(num) {
var pow = Math.pow(10, 2)
if ((num ?? '') === '') return '-'
return (Math.round(num * pow) / pow).toFixed(2)
},
// 获取上架商品数据
getSelectingList(goodsSource, defaultSelect) {
let params = {
upgradeGoodsNameOrType: this.goodsNameKeyword,
currentPage: this.currentPage,
pageSize: 10,
partnerMerchantId: goodsSource == 1 ? this.$globalState?.session?.merchantId : undefined, // 自营服务商商户号
partnerMerchantId2: goodsSource == 0 ? this.$globalState?.session?.merchantId : undefined, // 嘀加服务商商户号
shoppingMallFlag: goodsSource == 0 ? 1 : undefined, // 是否上架到采购商城 自营商品不需传
status: 1,
goodsSource,
partnerSceneType: 1
}
this.requestFlag = false
this.$apis.grounding['getGroundingGoodsList'](params).then(res => {
this.allPages = res?.pages
if (defaultSelect?.length && res?.list) res.list = res?.list.concat(defaultSelect)
this.goodsList = this.unique(this.goodsList.concat(res?.list || [])) || []
this.requestFlag = true
})
},
// 去重(回显concat数据后)
unique(arr) {
const res = new Map()
return arr.filter((a) => !res.has(a.id) && res.set(a.id, 1))
},
// 选择上架商品
handleGoodsChange(value) {
let targetItem = this.goodsList
let obj = this.editForm?.goodsSource == 0 ? targetItem[targetItem.findIndex(val => val.id == value)] : targetItem[targetItem.findIndex(val => val.id == value)]
this.selectedGoodsInfo = this.filterGoodsData(obj)
},
getInfo() {
let params = {
id: this.routeInfo?.id
}
this.$apis.grounding.getPurchaseGroundingDetail(params).then(res => {
const defaultSelect = [this.filterGoodsData(this.$common.utils.deepClone(res))]
let resData = {
id: res.id,
goodsSource: res?.goodsSource,
upgradeGoodsId: res?.upgradeGoods?.id || '',
shopPurchasePrice: res?.shopPurchasePrice || '',
merchantList: res?.merchantList || [],
status: res?.status
}
this.editForm = resData
this.getSelectingList(res.goodsSource, defaultSelect)
this.$nextTick(() => {
this.editStatus = false
})
})
},
// 选择门店
handleRelateStoreClose() {
this.selectedList = this.$common.utils.deepClone(this.editForm.merchantList)
this.relateStoreVisible = !this.relateStoreVisible
},
handleRelateStoreConfirm(selectedData) {
this.editForm.merchantList = selectedData
this.selectedList = selectedData
this.handleRelateStoreClose()
this.$refs.editFormMerchantRef.$refs[this.editChildRef].validateField('merchantList')
},
handleSearchStore() {
this.$refs.relateStore.handleCurrentChange(1)
},
handleSearchReset() {
this.storeSearchForm = {
merchantName: '',
merchantId: ''
}
this.$nextTick(() => {
this.$refs.relateStore.handleCurrentChange(1)
})
},
handleMerchantDelete(obj) {
this.$messageBox.confirm('是否删除该门店?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
var idx = this.editForm.merchantList.findIndex(item => item.merchantId == obj.scope.merchantId)
this.editForm.merchantList.splice(idx--, 1)
}
}
})
},
handleConfirm(isDraft = false) {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
if (!params?.merchantList?.length) return this.$message.error('请选择上架门店')
const arr = []
params?.merchantList?.forEach(val => { // 上架门店组合数据 防止请求参数过长
arr.push({
merchantId: val.merchantId,
merchantName: val.merchantName
})
})
params.merchantList = arr
params.status = isDraft ? 0 : params.status ? params.status : 2 // 是否存草稿
this.$apis.grounding.addOrUpdatePurchaseGrounding(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
}
})
},
cancelJump() {
this.$router.push({
path: '/purchaseGrounding/index'
})
},
handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.cancelJump()
})
.catch(() => {})
} else {
this.cancelJump()
}
}
}
}
</script>
<style scoped lang="scss">
.purchase-grounding{
.container{
padding: 0 0 20px;
background: #fff;
.edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
.goodsInfo-box{
margin: 0 70px 0 154px;
background: #F9F9F9;
display: flex;
flex-wrap: wrap;
padding: 15px 0;
.item{
flex: 0 0 33%;
.item_box{
display: flex;
align-items: start;
.label{
flex-shrink: 0;
color: #666666;
width: 150px;
text-align: right;
}
}
}
}
}
.edit-container{
margin-bottom: 16px;
}
.edit-form-container {
margin:20px 20px 0 0;
.table-title {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
}
}
.purchase-grounding.edit-purchase-grounding .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.merchant-table {
margin: 0 20px;
}
</style>
<!-- 采购上架详情 -->
<template>
<div class="purchase-grounding-detail purchase-grounding edit-box">
<div class="container edit-container">
<p class="edit-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :pageThat="this" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="sourceStrSpan">{{ editForm['goodsSourceStr'] }}</div>
<div slot="groundingGoodsInfo">
<div class="goodsInfo-box">
<div class="item" v-for="(subItem, subIndex) in goodsDetailForm" :key="subIndex">
<div v-if="subItem.addHtml" class="item_box">
<div class="label">{{ (membraneTypeList.includes(editForm.groundingGoodsInfo['goodsType']) ? subItem.label + `(元)/卷` : (subItem.label + '(元)/件')) }}:</div>
<div class="value">{{ priceFilter(editForm.groundingGoodsInfo[subItem.value]) }}</div>
</div>
<div v-else class="item_box">
<div class="label">{{ subItem.label + ':' }}</div>
<div class="value">{{ editForm.groundingGoodsInfo[subItem.value] || '-' }}</div>
</div>
</div>
</div>
</div>
<div slot="purchasePriceSpan">{{ priceFilter(editForm['shopPurchasePrice']) }}</div>
</glsx-combi-form>
</div>
<div class="container edit-container">
<p class="edit-title">上架门店</p>
<glsx-combi-form class="edit-form-container" ref="editFormMerchantRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="merchantEditFormData" :formRules="editRule">
<div slot="merchantTable" :style="{ width: `calc(100% - ${defaultLabelWidth} )` }">
<div class="table-title">
上架门店列表
</div>
<GLTable ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList"></GLTable>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button type="primary" @click="cancelJump" size="medium" :loading="loading">返回</el-button>
</GLFooter>
</div>
</template>
<script>
import { goodsSourceOptions, membraneTypeList } from '@/utils/constants.js'
export default {
name: 'purchaseGroundingDetail',
data() {
return {
editChildRef: 'editChildRef',
routeInfo: {},
editForm: {
goodsSourceStr: '',
groundingGoodsInfo: {},
shopPurchasePrice: '',
merchantList: []
},
isEdit: true,
editRule: {
goodsSourceStr: [{ required: true, message: '请选择商品来源', trigger: 'change' }],
upgradeGoodsId: [{ required: true, message: '请选择上架商品', trigger: 'change' }],
shopPurchasePrice: [
{ required: true, message: '请输入门店采购价', trigger: 'blur' }
]
},
editFormData: [
{
label: '商品来源',
name: 'goodsSourceStr',
addHtml: 'sourceStrSpan'
},
{
label: '上架商品',
name: 'upgradeGoodsId',
addHtml: 'groundingGoodsInfo'
},
{
label: '门店采购价(元)/件',
name: 'shopPurchasePrice',
addHtml: 'purchasePriceSpan'
}
],
merchantEditFormData: [
{
addHtml: 'merchantTable'
}
],
// 门店表格
tableParams: {
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
}
]
},
goodsDetailForm: [
{
label: '商品名称',
value: 'upgradeGoodsName',
},
{
label: '商品编码',
value: 'type'
},
{
label: '嘀加采购价',
addHtml: 'DJPurchasePrice',
value: 'purchasePrice'
},
{
label: '所属分类',
value: 'goodsTypeName'
},
{
label: '所属系列',
value: 'goodsName'
}
],
membraneTypeList // 膜类code集合
}
},
mounted() {
this.keyDown()
this.routeInfo = this.$route.query
this.getInfo()
},
methods: {
keyDown() {
document.onkeydown = function() {
var evt = window.event || arguments[0]
if (evt && evt.keyCode == 13) {
if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true
if (typeof evt.stopPropagation == 'function') evt.stopPropagation()
return false
}
return true
}
},
priceFilter(num) {
var pow = Math.pow(10, 2)
if ((num ?? '') === '') return '-'
return (Math.round(num * pow) / pow).toFixed(2)
},
getInfo() {
let params = {
id: this.routeInfo?.id
}
this.$apis.grounding.getPurchaseGroundingDetail(params).then(res => {
res.goodsSourceStr = !((res.goodsSource ?? '') === '') ? goodsSourceOptions[res.goodsSource - 0]?.label : '-'
let index = this.editFormData.findIndex(val => val.name == 'shopPurchasePrice')
if (this.membraneTypeList?.includes(res?.goodsInfo?.goodsType)) { // 膜类商品 单位是卷
if(index > -1) this.editFormData[index].label = '门店采购价(元)/卷'
}
if (res?.goodsSource == 1) { // 自营
let index = this.goodsDetailForm.findIndex(val => val.value == 'purchasePrice')
if (index > -1) {
this.goodsDetailForm.splice(index, 1)
}
}
res.groundingGoodsInfo = {
...res.goodsInfo,
...res.upgradeGoods
}
this.editForm = res
})
},
cancelJump() {
this.$router.push({
path: '/purchaseGrounding/index'
})
}
}
}
</script>
<style scoped lang="scss">
.purchase-grounding{
.container{
padding: 0 0 20px;
background: #fff;
.edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
.goodsInfo-box{
background: #F9F9F9;
display: flex;
flex-wrap: wrap;
padding: 15px 0;
.item{
flex: 0 0 33%;
.item_box{
display: flex;
align-items: start;
.label{
flex-shrink: 0;
color: #666666;
width: 150px;
text-align: right;
}
}
}
}
}
.edit-container{
margin-bottom: 16px;
}
.edit-form-container {
margin:20px 20px 0 0;
.table-title {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
}
.m-r-20 {
/deep/.glsx-combi-form-block{
color: #666666;
&:nth-child(1){
.el-form-item__content{
width: calc(100% - 154px);
}
}
}
}
}
.purchase-grounding.purchase-grounding-detail .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.merchant-table {
margin: 0 20px;
}
</style>
<!-- 采购上架 -->
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<h2>采购上架列表</h2>
<div>
<GLButton type="primary" plain size="small" @click="handleEdit('add')" fn="新增上架">新增上架</GLButton>
<GLButton size="small" @click="exportExcel" fn="导出">导出</GLButton>
</div>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="orderRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="merchantName" slot-scope="scope">
<el-tooltip v-if="scope.scope.merchantList && scope.scope.merchantList.length > 0" placement="top" effect="light">
<div slot="content">
<div class="text-3 font-12 weight-6" style="line-height:24px">上架门店</div>
<div class="merchant-wrap">
<div class="text-6 font-12" style="line-height:24px" v-for="item in scope.scope.merchantList" :key="item">{{ item.merchantName }}</div>
</div>
</div>
<div class="use-store">
<img src="@/assets/store.png" />
x {{ scope.scope.merchantList.length }}
</div>
</el-tooltip>
<span v-else>--</span>
</div>
<template slot="status" slot-scope="scope">
<div>
<span :class="Spot[scope.scope.status]"></span>
<span >{{ scope.scope.status | groundingStatus }}</span>
</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { purchaseGroundingStatusList, goodsSourceOptions } from '@/utils/constants.js'
export default {
name: 'purchaseGroundingIndex',
data() {
return {
size: 'small',
url: url,
Spot:['yellowSpot','ashSpot','greenSpot'],
searchForm: {
upgradeGoodsName: '',
type: '',
shopMerchantIdList: '',
goodsName: '',
goodsType: '',
goodsSource: '',
status: '',
merchantId: this.$globalState?.session?.merchantId
},
tableSearchForm: {},
paramsObj: {},
// 查看门店
detailVisible: false,
showFormData: [
{
label: '商品名称',
name: 'upgradeGoodsName',
type: 'input',
isClear: true
},
{
label: '商品编码',
name: 'type',
type: 'input',
isClear: true
},
{
label: '所属系列',
name: 'goodsName',
type: 'input',
maxlength: 20,
isClear: true
},
{
label: '所属分类',
name: 'goodsType',
type: 'select',
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName',
optionsName: 'classificationOptions'
},
{
label: '商品来源',
name: 'goodsSource',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'goodsSourceOptions'
},
{
label: '上架门店',
name: 'shopMerchantIdList',
type: 'select',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'merchantList'
},
{
label: '状态',
name: 'status',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'purchaseGroundingStatusList'
}
],
tableButtonList: [
{
type: 'GLButton',
name: '查看',
attrs: {
type: 'text',
fn: '查看'
},
condition: row => {
return row.status == 2 || row.status == 1 // 已上架/已下架
},
listeners: {
click: this.handleDetail
}
},
{
type: 'GLButton',
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.handleEdit('edit', row)
}
},
{
type: 'GLButton',
name: '下架',
attrs: {
type: 'text',
fn: '上下架'
},
condition: row => {
return row.status == 2
},
listeners: {
click: this.handleUpDown
}
},
{
type: 'GLButton',
name: '上架',
attrs: {
type: 'text',
fn: '上下架'
},
condition: row => {
return row.status == 1
},
listeners: {
click: this.handleUpDown
}
},
{
type: 'GLButton',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
condition: row => {
return row.status == 0 // 草稿状态
},
listeners: {
click: this.handleDelete
}
}
],
// 表格
getListApi: this.$apis.grounding.getPurchaseGroundingList,
tableParams: {
listName: 'list',
tableOption: {
width: '150px'
},
tableColumns: [
{
label: '商品来源',
prop: 'goodsSource',
width: '200',
formatter: cellValue => {
return goodsSourceOptions.findIndex(v => v.id == cellValue.goodsSource) > -1 ? goodsSourceOptions[goodsSourceOptions.findIndex(v => v.id == cellValue.goodsSource)].label : '-'
}
},
{
label: '商品名称',
prop: 'createdDate',
formatter: cellValue => {
return cellValue?.upgradeGoods?.upgradeGoodsName || cellValue?.upgradeGoodsName
}
},
{
label: '商品编码',
prop: 'type',
formatter: cellValue => {
return cellValue?.upgradeGoods?.type || cellValue?.type
}
},
{
label: '系列',
prop: 'goodsName',
formatter: cellValue => {
return cellValue?.goodsInfo?.goodsName || cellValue?.goodsName
}
},
{
label: '所属分类',
prop: 'goodsTypeName',
formatter: cellValue => {
return cellValue?.goodsInfo?.goodsTypeName || cellValue?.goodsTypeName
}
},
{
label: '门店采购价/元',
prop: 'shopPurchasePrice',
formatter: cellValue => {
return cellValue.shopPurchasePrice ? '¥' + cellValue.shopPurchasePrice : '-'
}
},
{
label: '嘀加采购价/元',
prop: 'purchasePrice',
formatter: cellValue => {
return cellValue?.upgradeGoods?.purchasePrice ? '¥' + cellValue?.upgradeGoods?.purchasePrice : '-'
}
},
{
label: '上架门店',
prop: '',
addHtml: 'merchantName'
},
{
label: '状态',
prop: '',
addHtml: 'status'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
purchaseGroundingStatusList: purchaseGroundingStatusList, // 状态
goodsSourceOptions: goodsSourceOptions, // 商品来源
merchantList: [], // 上架门店
goodsSeriesList: [], // 所属系列
classificationOptions: [] // 所属分类
},
tipsTitleStyle: 'style="font-size: 16px;color: #333333;"',
tipsContentStyle: 'style="font-size: 14px;color: #666666;"'
}
},
mounted() {
// 获取所属分类
this.getPurchaseGroundingSearchSelectData(1)
// 获取上架门店
this.getMerchantList()
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (params.shopMerchantIdList) params.shopMerchantIdList = [params.shopMerchantIdList]
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
// 所属系列 所属分类
getPurchaseGroundingSearchSelectData(num) {
this.$apis.grounding.getPurchaseGroundingSearchSelectData({ dataType: num }).then(res => {
this.baseData['classificationOptions'] = res || []
this.getOptionsList('showFormData')
})
},
// 上架门店
getMerchantList() {
this.$apis.grounding.getSimpleMerchantList({scene: 1, merchantId: this.$globalState?.session?.merchantId}).then(res => {
this.baseData.merchantList = res || []
this.getOptionsList('showFormData')
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '是',
cancelButtonText: '否',
dangerouslyUseHTMLString: true,
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
// 查看详情
handleDetail(row) {
this.$router.push({
path: '/purchaseGrounding/detail',
query: row
})
},
//新增-编辑
handleEdit(editType, row) {
let params = {
editType,
id: row?.id,
$title: encodeURI(editType == 'add' ? '新增上架' : '编辑上架')
}
this.$router.push({
path: '/purchaseGrounding/add',
query: params
})
},
//删除
handleDelete(row) {
this.secondConfirm('删除', `<p ${this.tipsTitleStyle}>是否确定删除?</p><p ${this.tipsContentStyle}>删除后不可恢复</p>`, 'grounding', 'delPurchaseGrounding', { id: row.id })
},
//上下架
handleUpDown(row) {
if (row.status == 2) { // 已上架
this.secondConfirm('下架', `<p ${this.tipsTitleStyle}>是否确定下架?</p><p ${this.tipsContentStyle}>下架后,门店无法再对该商品进行采购</p>`, 'grounding', 'updatePurchaseGroundingStatus', { id: row.id, status: 1 })
} else if (row.status == 1) { // 已下架
this.secondConfirm('上架', `<p ${this.tipsTitleStyle}>是否确定上架?</p><p ${this.tipsContentStyle}>上架后,门店可对该商品进行采购</p>`, 'grounding', 'updatePurchaseGroundingStatus', { id: row.id, status: 2 })
}
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.orderRef.data.length ? (this.$refs.orderRef.tableHeightValues = '') : this.$refs.orderRef.setTableHeightFun()
},
// 创建采购上架
handleCreatePurchase() {
this.$router.push('/purchaseGrounding/add')
},
exportExcel() {
var params = this.getParams()
this.$apis.grounding.exportPurchaseGrounding(params).then(res => {
window.location.href = res
})
},
handleSearch() {
this.$refs.orderRef.refreshTable()
},
handleReset() {
this.searchForm = {
upgradeGoodsName: '',
type: '',
shopMerchantIdList: '',
goodsName: '',
goodsType: '',
goodsSource: '',
status: '',
merchantId: this.$globalState?.session?.merchantId
}
this.handleSearch()
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
margin-top: 20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
.glbtn {
left: 46px;
position: absolute;
}
.btn {
right: 47px;
position: absolute;
}
}
.greenSpot {
@include dot;
background: $color-green;
}
.yellowSpot {
@include dot;
background: $color-yellow;
}
.ashSpot {
@include dot;
background: $color-gray;
}
.redSpot {
@include dot;
background: $color-red;
}
.table-btns /deep/.el-button--text {
min-width: 0 !important;
padding: 0;
}
.use-store{
display: flex;
font-size: 14px;
color: #5850ff;
align-items: center;
img {
width: 14px;
height: 12.98px;
margin-right: 8px;
}
}
}
.merchant-wrap{
max-height:200px;
overflow: scroll;
}
</style>
<style>
.el-tooltip__popper.is-light {
background: #ffffff;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08);
border: 1px solid #e4e7ed !important;
width: 177px;
box-sizing: border-box;
}
.el-tooltip__popper[x-placement^='top'] .popper__arrow {
border-color: #e4e7ed !important;
}
.el-tooltip__popper[x-placement^='top'] .popper__arrow:after {
border-bottom-color: #e4e7ed !important;
}
</style>
<!-- 关联门店弹窗 -->
<template>
<GLDialog bigTitle="选择门店" mode="big" :visible.sync="relateStoreVisible" okText="关联" :before-close="handleRelateStoreClose" @onOk="handleRelateStoreConfirm" @onCancel="handleRelateStoreClose" class="relateStore">
<slot></slot>
<el-row>
<el-col :span="16">
<div class="title">客户列表</div>
<el-table ref="seletingTable" class="table hightline" :data="selectingData" height="460px" @select="handleChange" @select-all="handleAll">
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column>
<el-table-column prop="merchantName" label="客户名称" align="center"></el-table-column>
<el-table-column prop="merchantId" label="商户号" align="center"></el-table-column>
</el-table>
<el-pagination v-if="hasPage" small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination>
</el-col>
<el-col :span="8">
<div class="title mar_l10">已选客户</div>
<div class="selected_box">
<div class="box_top">
<span>已选</span>
<el-button type="text" @click="handelClearStore">清空</el-button>
</div>
<div class="box_content">
<div class="select_item" v-for="(subItem, subIndex) in selectedData" :key="subIndex">
<div class="text_value">{{ subItem.merchantName }}({{subItem.merchantId}})</div>
<div class="select_clear" @click="handleDelete(subItem)"><i class="el-icon-error"></i></div>
</div>
</div>
</div>
</el-col>
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
pageNum: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
hasPage: {
type: Boolean,
default: true
},
// 页面来源
// sourcePage: {
// type: String,
// default: ''
// },
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
this.selectedData = this.storeSelected
this.selectedData.forEach(item => {
item.merchantId = item.merchantId ? item.merchantId + '' : item.merchantId
})
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId + '')
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantId + '')) {
this.$refs.seletingTable.toggleRowSelection(item, true)
} else {
this.$refs.seletingTable.toggleRowSelection(item, false)
}
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.pageNum,
pageSize: this.hasPage ? this.pageSize : 99999,
scene: 1,
partnerMerchantId: this.$globalState?.session?.merchantId
}).then(res => {
this.selectingData = res.list || []
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => +item.merchantId === +row.merchantId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData?.forEach(item => {
let isExit = this.selectedData.findIndex(subItem => +subItem.merchantId === +item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => +item.merchantId !== +row.merchantId)
this.recoverySelection()
},
handelClearStore() {
this.selectedData = []
this.recoverySelection()
},
handleCurrentChange(val) {
this.pageNum = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
if (!this.selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true,
customClass: 'message-Z-zinde'
})
return true
}
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style lang="scss" scoped>
.relateStore{
.title{
font-size: 16px;
margin-bottom: 10px;
}
.mar_l10{
margin-left: 10px;
}
.selected_box{
margin-left: 10px;
border: 1px solid #E5E5E5;
height: 460px;
.box_top{
font-size: 16px;
padding: 11px 26px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #E5E5E5;
}
.box_content{
padding: 12px 8px;
overflow-y: scroll;
height: calc(100% - 40px);
box-sizing: border-box;
.select_item{
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
padding: 0 8px;
cursor: pointer;
.text_value{
width: calc(100% - 50px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.select_clear{
width: 12px;
height: 12px;
i{
color: #A6A6A6;
}
}
}
.select_item:hover{
background: #F2F1FF;
}
}
}
}
</style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<div class="purchase"> <div class="purchase">
<div class="container"> <div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header"> <div class="table-header">
<h2>采购订单列表</h2> <h2>采购订单列表</h2>
<div> <div>
...@@ -205,7 +205,9 @@ export default { ...@@ -205,7 +205,9 @@ export default {
getListApi: this.$apis.purchaseShopping.getPurchaseOrderList, getListApi: this.$apis.purchaseShopping.getPurchaseOrderList,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: {
width: '150px'
},
tableColumns: [ tableColumns: [
{ {
label: '订单编号', label: '订单编号',
...@@ -287,11 +289,6 @@ export default { ...@@ -287,11 +289,6 @@ export default {
label: '订单状态', label: '订单状态',
prop: 'status', prop: 'status',
addHtml: 'status' addHtml: 'status'
},
{
label: '操作',
width: '180px',
addHtml: 'auth-button'
} }
] ]
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!