Commit 88c42399 by zhangquan

商品库联调

1 parent eb55ff79
...@@ -1895,6 +1895,51 @@ ...@@ -1895,6 +1895,51 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true "dev": true
}, },
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"ssri": { "ssri": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmmirror.com/ssri/-/ssri-8.0.1.tgz", "resolved": "https://registry.npmmirror.com/ssri/-/ssri-8.0.1.tgz",
...@@ -1903,6 +1948,28 @@ ...@@ -1903,6 +1948,28 @@
"requires": { "requires": {
"minipass": "^3.1.1" "minipass": "^3.1.1"
} }
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
} }
} }
}, },
...@@ -13329,75 +13396,6 @@ ...@@ -13329,75 +13396,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": { "vue-router": {
"version": "3.6.5", "version": "3.6.5",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz", "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz",
......
import { http } from '@/main' import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.platform.goods.' const defaultPath = 'scrm.api.shopmall.platform.'
const url = 'rop-scrm-shopmall/router' const url = 'rop-scrm-shopmall/router'
// 获取平台商品分类 // 获取平台商品分类
const getCategoryListApi = params => { const getCategoryListApi = params => {
params.method = `${defaultPath}category.list` params.method = `${defaultPath}goods.category.list`
return http({ return http({
url, url,
data: params, data: params,
...@@ -14,7 +14,7 @@ const getCategoryListApi = params => { ...@@ -14,7 +14,7 @@ const getCategoryListApi = params => {
} }
// 分页查询选品库商品 // 分页查询选品库商品
const getGoodsListApi = params => { const getGoodsListApi = params => {
params.method = `${defaultPath}list` params.method = `${defaultPath}goods.list`
return http({ return http({
url, url,
data: params, data: params,
...@@ -23,7 +23,7 @@ const getGoodsListApi = params => { ...@@ -23,7 +23,7 @@ const getGoodsListApi = params => {
} }
// 平台商品批量入库 // 平台商品批量入库
const addWarehouseApi = params => { const addWarehouseApi = params => {
params.method = `${defaultPath}batch.add` params.method = `${defaultPath}goods.batch.add`
return http({ return http({
url, url,
data: params, data: params,
...@@ -32,7 +32,7 @@ const addWarehouseApi = params => { ...@@ -32,7 +32,7 @@ const addWarehouseApi = params => {
} }
// 分页查询仓库/销售中商品 // 分页查询仓库/销售中商品
const getListApi = params => { const getListApi = params => {
params.method = `${defaultPath}stockroom.page` params.method = `${defaultPath}goods.stockroom.page`
return http({ return http({
url, url,
data: params, data: params,
...@@ -41,7 +41,7 @@ const getListApi = params => { ...@@ -41,7 +41,7 @@ const getListApi = params => {
} }
// 平台商品批量移出仓库 // 平台商品批量移出仓库
const batchRemoveApi = params => { const batchRemoveApi = params => {
params.method = `${defaultPath}stockroom.batch.remove` params.method = `${defaultPath}goods.stockroom.batch.remove`
return http({ return http({
url, url,
data: params, data: params,
...@@ -50,7 +50,7 @@ const batchRemoveApi = params => { ...@@ -50,7 +50,7 @@ const batchRemoveApi = params => {
} }
// 平台商品批量上架销售 // 平台商品批量上架销售
const batchSaleApi = params => { const batchSaleApi = params => {
params.method = `${defaultPath}stockroom.batch.sale` params.method = `${defaultPath}goods.stockroom.batch.sale`
return http({ return http({
url, url,
data: params, data: params,
...@@ -66,6 +66,25 @@ const goodsDetailApi = params => { ...@@ -66,6 +66,25 @@ const goodsDetailApi = params => {
sign: true sign: true
}) })
} }
// 平台商品批量改价
const modifyPriceApi = params => {
params.method = `${defaultPath}goods.stockroom.batch.modify.price`
return http({
url,
data: params,
sign: true
})
}
// 订单列表
const getOrderList = params => {
params.method = `${defaultPath}order.page`
return http({
url,
data: params,
sign: true
})
}
export default { export default {
getCategoryListApi, getCategoryListApi,
...@@ -74,5 +93,7 @@ export default { ...@@ -74,5 +93,7 @@ export default {
getListApi, getListApi,
batchRemoveApi, batchRemoveApi,
batchSaleApi, batchSaleApi,
goodsDetailApi goodsDetailApi,
modifyPriceApi,
getOrderList
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<span v-for="(item,index) in titleList" :key="item" :class="['title', {'curTitleCla': curTitleIdx==index}]" @click="changeTable(index)">{{item}}</span> <span v-for="(item,index) in titleList" :key="item" :class="['title', {'curTitleCla': curTitleIdx==index}]" @click="changeTable(index)">{{item}}</span>
</div> </div>
<div class="table-wrap"> <div class="table-wrap">
<GLTable ref="tableRef" :pageConf="pageConf" :searchForm="orderFormObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn"> <GLTable ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div> </div>
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
</template> </template>
<script> <script>
export default { import { utils } from 'glsx-common'
export default {
name: 'goodsOrderIndex', name: 'goodsOrderIndex',
data() { data() {
return { return {
...@@ -39,16 +40,18 @@ ...@@ -39,16 +40,18 @@
} }
} }
], ],
searchForm: {},
orderFormObj: { orderFormObj: {
info: '', customerInfo: '',
searchOrderCode: '',
goodsInfo: '', goodsInfo: '',
orderNo: '', requestType: '0',
successDate: '' time: ''
}, },
orderFormData: [ orderFormData: [
{ {
label: '用户信息', label: '用户信息',
name: 'info', name: 'customerInfo',
placeholder: '请输入姓名或手机号', placeholder: '请输入姓名或手机号',
type: 'input', type: 'input',
isClear: true isClear: true
...@@ -61,20 +64,20 @@ ...@@ -61,20 +64,20 @@
}, },
{ {
label: '订单编号', label: '订单编号',
name: 'orderNo', name: 'searchOrderCode',
type: 'input', type: 'input',
isClear: true isClear: true
}, },
{ {
label: '下单时间', label: '下单时间',
name: 'successDate', name: 'time',
type: 'datePicker', type: 'datePicker',
isClear: true, isClear: true,
pickerOptions: 'beforeRangePickerOptions' pickerOptions: 'beforeRangePickerOptions'
} }
], ],
getListApi: this.$apis.goodsCouponApi.getCouponsList, getListApi: this.$apis.platformGoods.getOrderList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
...@@ -138,10 +141,20 @@ ...@@ -138,10 +141,20 @@
}, },
handleSearch(){ handleSearch(){
this.$refs.tableRef.refreshTable()
},
getParams(){
let params = utils.deepClone(this.orderFormObj)
if(params?.time?.length){
params.createdStartTime = new Date(params.time[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createdEndTime = new Date(params.time[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.time
return params
}, },
beforeSearchFn(){ beforeSearchFn(){
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
this.searchForm = this.getParams()
resolve() resolve()
}) })
}, },
......
...@@ -120,9 +120,9 @@ export default { ...@@ -120,9 +120,9 @@ export default {
}, },
handleRemove(){ handleRemove(){
const api = this.$apis.platformGoods.batchRemoveApi const api = this.$apis.platformGoods.batchRemoveApi
this.batchFn(api, '移出仓库') this.batchFn('batchRemoveApi', '移出仓库')
}, },
operateFn(operate){ operateFn(Api, operate){
let tip = `确定把该商品${operate}吗?` let tip = `确定把该商品${operate}吗?`
this.$confirm(tip, '提示', { this.$confirm(tip, '提示', {
type: 'warning', type: 'warning',
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<span class="table-title">销售中商品列表</span> <span class="table-title">销售中商品列表</span>
<div class="operate-btn"> <div class="operate-btn">
<el-button :size="size" type="primary" plain @click="handleShelf">批量下架</el-button> <el-button :size="size" type="primary" plain @click="handleShelf">批量下架</el-button>
<el-button :size="size" type="primary" plain>批量改价</el-button> <el-button :size="size" type="primary" plain @click="batchPriceChange">批量改价</el-button>
</div> </div>
</div> </div>
<GLTable ref="tableRef" :pageConf="pageConf" :searchForm="goodsFormObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn"> <GLTable ref="tableRef" :pageConf="pageConf" :searchForm="goodsFormObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<img :src="scope.scope.goodsImgUrl" alt="">{{ scope.scope.goodsSkuName }} <img :src="scope.scope.goodsImgUrl" alt="">{{ scope.scope.goodsSkuName }}
</div> </div>
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope"> <div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<el-input v-if="curEditId==scope.scope.id" :value="scope.scope.salePrice" type="text" clearable @blur="setPriceFn(scope.scope)"></el-input> <el-input v-if="curEditId==scope.scope.id" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" clearable @blur="setPriceFn($event, scope.scope)"></el-input>
<span class="unedited" v-else> <span class="unedited" v-else>
{{scope.scope.salePrice}} {{scope.scope.salePrice}}
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice(scope.scope)"> <img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice(scope.scope)">
...@@ -34,12 +35,15 @@ ...@@ -34,12 +35,15 @@
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div> </div>
</GLTable> </GLTable>
<setPriceDialog v-if="isVisible" :visible="isVisible" @handleClose="handleClose" @confirm="confirmPriceChange">
</setPriceDialog>
</div> </div>
</template> </template>
<script> <script>
import inputNumRange from '@/components/inputNumRange' import inputNumRange from '@/components/inputNumRange'
import categoryCascader from '@/components/categoryCascader.vue' import categoryCascader from '@/components/categoryCascader.vue'
import setPriceDialog from './setPriceDialog.vue'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
export default { export default {
name: 'warehouseIndex', name: 'warehouseIndex',
...@@ -47,11 +51,13 @@ export default { ...@@ -47,11 +51,13 @@ export default {
return { return {
size: 'small', size: 'small',
curEditId: '', curEditId: '',
isVisible: false,
batchPrice: '',
goodsFormObj: { goodsFormObj: {
goodsPosition: 2, goodsPosition: 2,
info: '', info: '',
categoryCode: [], categoryCode: [],
shelvesStatus: '', saleFlag: '',
startSellPrice: '', startSellPrice: '',
endSellPrice: '', endSellPrice: '',
startDiffPrice: '', startDiffPrice: '',
...@@ -72,7 +78,7 @@ export default { ...@@ -72,7 +78,7 @@ export default {
}, },
{ {
label: '销售状态', label: '销售状态',
name: 'shelvesStatus', name: 'saleFlag',
type: 'select', type: 'select',
optionList: [{ optionList: [{
id: '', id: '',
...@@ -174,7 +180,8 @@ export default { ...@@ -174,7 +180,8 @@ export default {
components: { components: {
inputNumRange, inputNumRange,
categoryCascader categoryCascader,
setPriceDialog
}, },
mounted() { mounted() {
...@@ -182,45 +189,64 @@ export default { ...@@ -182,45 +189,64 @@ export default {
methods: { methods: {
editPrice(row){ editPrice(row){
console.log(row)
this.curEditId = row.id this.curEditId = row.id
}, },
setPriceFn(row){ //获取复选table数据
},
getAllData(){ getAllData(){
console.log(this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName]) return this.$refs?.tableRef?.mutiSelectArr[this.tableParams.mutiSelectName] || []
}, },
handleShelf(){ // 确认批量改价弹框
this.getAllData() confirmPriceChange(e){
this.batchPrice = e
if(!this.batchPrice) return this.$message.error('请输入大于0的金额')
this.setPriceFn({}, {}, true)
this.handleClose()
}, },
formatNum(id, val) { // 取消批量改价弹框
let temp = val handleClose(){
if (temp < 0) { this.batchPrice = ''
temp = '' this.isVisible = false
} this.curEditId = ''
if (temp.length > 1 && temp.slice(0, 1) == '0' && temp.slice(1, 2) != '.') { },
temp = '0' // 点击批量改价打开弹框
batchPriceChange(){
const list = this.getAllData()
if(!list?.length) return this.$message.error(`请选择要批量改价的商品`)
this.isVisible = true
console.log( this.isVisible)
},
setPriceFn(e, item, isAll){
let params = {}
if(isAll){
let list = this.getAllData()
params = {
modifyPriceRequestList : list.map(item => {return { id: item.id, salePrice: this.batchPrice}})
}
}else{
params = {
modifyPriceRequestList: [{
id: item.id,
salePrice: e.target.value
}],
}
} }
temp = temp.replace(/[^\d.]/g, '') //清除"数字"和"."以外的字符 this.$apis.platformGoods.modifyPriceApi(params).then(res=>{
temp = temp.replace(/^\./g, '') //验证第一个字符是数字 if(res){
temp = temp.replace(/\.{2,}/g, '') //只保留第一个, 清除多余的 this.$message.success('操作成功')
temp = temp this.handleClose()
.replace('.', '$#$') this.handleReset()
.replace(/\./g, '') }
.replace('$#$', '.') })
temp = temp.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') //只能输入两个小数 },
this.$nextTick(() => { handleShelf(){
const target = this.couponFormObj.selectedGoodsList.find(item => item.id == id) this.getAllData()
target.newCost = temp
})
}, },
handleReset(){ handleReset(){
this.goodsFormObj = { this.goodsFormObj = {
goodsPosition: 2, goodsPosition: 2,
info: '', info: '',
categoryCode: [], categoryCode: [],
shelvesStatus: '', saleFlag: '',
startSellPrice: '', startSellPrice: '',
endSellPrice: '', endSellPrice: '',
startDiffPrice: '', startDiffPrice: '',
......
<template>
<GLDialog title="批量改价" mode="small" :visible.sync="visible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消">
<div class="dialog-wrap">
<span>销售价 = 供货价 +</span>
<el-input size="small" type="text" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" v-model="batchPrice" placeholder="请输入金额">
<span slot="append">元</span>
</el-input>
</div>
</GLDialog>
</template>
<script>
export default {
name: 'setPriceDialog',
props: {
visible:{
type: Boolean,
default: false
}
},
data() {
return {
batchPrice: ''
}
},
methods: {
confirmPriceChange(){
this.$emit('confirm', this.batchPrice)
},
handleClose(){
this.$emit('handleClose')
}
}
}
</script>
<style lang="scss" scoped>
.dialog-wrap{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
span{
white-space: nowrap;
margin-right: 8px;
}
/deep/ .el-input{
&, .el-input__inner{
width: 222px;
}
.el-input-group__append{
box-sizing: border-box;
padding: 0 20px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -26,26 +26,21 @@ ...@@ -26,26 +26,21 @@
</div> </div>
<div slot="setPriceSlot" slot-scope="scope"> <div slot="setPriceSlot" slot-scope="scope">
<el-input type="text" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input type="text" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value"></el-input> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" @blur="setPriceFn($event, scope.scope)"></el-input>
</div> </div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div> </div>
</GLTable> </GLTable>
<GLDialog title="批量改价" mode="small" :visible.sync="isVisible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消"> <setPriceDialog v-if="isVisible" :visible="isVisible" @handleClose="handleClose" @confirm="confirmPriceChange">
<div class="dialog-wrap"> </setPriceDialog>
<span>销售价 = 供货价 +</span>
<el-input size="small" type="text" v-model="batchPrice" placeholder="请输入金额">
<span slot="append">元</span>
</el-input>
</div>
</GLDialog>
</div> </div>
</template> </template>
<script> <script>
import inputNumRange from '@/components/inputNumRange' import inputNumRange from '@/components/inputNumRange'
import categoryCascader from '@/components/categoryCascader.vue' import categoryCascader from '@/components/categoryCascader.vue'
import setPriceDialog from './setPriceDialog.vue'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
export default { export default {
name: 'warehouseIndex', name: 'warehouseIndex',
...@@ -192,7 +187,8 @@ export default { ...@@ -192,7 +187,8 @@ export default {
components: { components: {
inputNumRange, inputNumRange,
categoryCascader categoryCascader,
setPriceDialog
}, },
mounted() { mounted() {
...@@ -204,17 +200,46 @@ export default { ...@@ -204,17 +200,46 @@ export default {
return this.$refs?.tableRef?.mutiSelectArr[this.tableParams.mutiSelectName] || [] return this.$refs?.tableRef?.mutiSelectArr[this.tableParams.mutiSelectName] || []
}, },
// 确认批量改价弹框 // 确认批量改价弹框
confirmPriceChange(){ confirmPriceChange(e){
this.batchPrice = e
if(!this.batchPrice) return this.$message.error('请输入大于0的金额')
this.setPriceFn({}, {}, true)
this.handleClose() this.handleClose()
}, },
// 取消批量改价弹框 // 取消批量改价弹框
handleClose(){ handleClose(){
this.batchPrice = ''
this.isVisible = false this.isVisible = false
}, },
// 点击批量改价打开弹框 // 点击批量改价打开弹框
batchPriceChange(){ batchPriceChange(){
const list = this.getAllData()
if(!list?.length) return this.$message.error(`请选择要批量改价的商品`)
this.isVisible = true this.isVisible = true
}, },
setPriceFn(e, item, isAll){
let params = {}
if(isAll){
let list = this.getAllData()
params = {
modifyPriceRequestList : list.map(item => {return { id: item.id, salePrice: this.batchPrice}})
}
}else{
params = {
modifyPriceRequestList: [{
id: item.id,
salePrice: e.target.value
}],
}
}
this.$apis.platformGoods.modifyPriceApi(params).then(res=>{
if(res){
this.$message.success('操作成功')
this.handleClose()
this.handleReset()
}
})
},
// 点击批量上架 // 点击批量上架
batchSale(item, isAll){ batchSale(item, isAll){
const api = this.$apis.platformGoods.batchSaleApi const api = this.$apis.platformGoods.batchSaleApi
...@@ -293,26 +318,6 @@ export default { ...@@ -293,26 +318,6 @@ export default {
margin-right: 8px; margin-right: 8px;
} }
} }
.dialog-wrap{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
span{
white-space: nowrap;
margin-right: 8px;
}
/deep/ .el-input{
&, .el-input__inner{
width: 222px;
}
.el-input-group__append{
box-sizing: border-box;
padding: 0 20px;
}
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!