Commit 88c42399 by zhangquan

商品库联调

1 parent eb55ff79
......@@ -1895,6 +1895,51 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"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": {
"version": "8.0.1",
"resolved": "https://registry.npmmirror.com/ssri/-/ssri-8.0.1.tgz",
......@@ -1903,6 +1948,28 @@
"requires": {
"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 @@
}
}
},
"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": {
"version": "3.6.5",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz",
......
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.platform.goods.'
const defaultPath = 'scrm.api.shopmall.platform.'
const url = 'rop-scrm-shopmall/router'
// 获取平台商品分类
const getCategoryListApi = params => {
params.method = `${defaultPath}category.list`
params.method = `${defaultPath}goods.category.list`
return http({
url,
data: params,
......@@ -14,7 +14,7 @@ const getCategoryListApi = params => {
}
// 分页查询选品库商品
const getGoodsListApi = params => {
params.method = `${defaultPath}list`
params.method = `${defaultPath}goods.list`
return http({
url,
data: params,
......@@ -23,7 +23,7 @@ const getGoodsListApi = params => {
}
// 平台商品批量入库
const addWarehouseApi = params => {
params.method = `${defaultPath}batch.add`
params.method = `${defaultPath}goods.batch.add`
return http({
url,
data: params,
......@@ -32,7 +32,7 @@ const addWarehouseApi = params => {
}
// 分页查询仓库/销售中商品
const getListApi = params => {
params.method = `${defaultPath}stockroom.page`
params.method = `${defaultPath}goods.stockroom.page`
return http({
url,
data: params,
......@@ -41,7 +41,7 @@ const getListApi = params => {
}
// 平台商品批量移出仓库
const batchRemoveApi = params => {
params.method = `${defaultPath}stockroom.batch.remove`
params.method = `${defaultPath}goods.stockroom.batch.remove`
return http({
url,
data: params,
......@@ -50,7 +50,7 @@ const batchRemoveApi = params => {
}
// 平台商品批量上架销售
const batchSaleApi = params => {
params.method = `${defaultPath}stockroom.batch.sale`
params.method = `${defaultPath}goods.stockroom.batch.sale`
return http({
url,
data: params,
......@@ -66,6 +66,25 @@ const goodsDetailApi = params => {
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 {
getCategoryListApi,
......@@ -74,5 +93,7 @@ export default {
getListApi,
batchRemoveApi,
batchSaleApi,
goodsDetailApi
goodsDetailApi,
modifyPriceApi,
getOrderList
}
......@@ -8,7 +8,7 @@
<span v-for="(item,index) in titleList" :key="item" :class="['title', {'curTitleCla': curTitleIdx==index}]" @click="changeTable(index)">{{item}}</span>
</div>
<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">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
......@@ -19,7 +19,8 @@
</template>
<script>
export default {
import { utils } from 'glsx-common'
export default {
name: 'goodsOrderIndex',
data() {
return {
......@@ -39,16 +40,18 @@
}
}
],
searchForm: {},
orderFormObj: {
info: '',
customerInfo: '',
searchOrderCode: '',
goodsInfo: '',
orderNo: '',
successDate: ''
requestType: '0',
time: ''
},
orderFormData: [
{
label: '用户信息',
name: 'info',
name: 'customerInfo',
placeholder: '请输入姓名或手机号',
type: 'input',
isClear: true
......@@ -61,20 +64,20 @@
},
{
label: '订单编号',
name: 'orderNo',
name: 'searchOrderCode',
type: 'input',
isClear: true
},
{
label: '下单时间',
name: 'successDate',
name: 'time',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
getListApi: this.$apis.goodsCouponApi.getCouponsList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
getListApi: this.$apis.platformGoods.getOrderList,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: {
listName: 'list',
tableOption: true,
......@@ -138,10 +141,20 @@
},
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(){
return new Promise((resolve, reject)=>{
this.searchForm = this.getParams()
resolve()
})
},
......
......@@ -120,9 +120,9 @@ export default {
},
handleRemove(){
const api = this.$apis.platformGoods.batchRemoveApi
this.batchFn(api, '移出仓库')
this.batchFn('batchRemoveApi', '移出仓库')
},
operateFn(operate){
operateFn(Api, operate){
let tip = `确定把该商品${operate}吗?`
this.$confirm(tip, '提示', {
type: 'warning',
......
......@@ -16,7 +16,7 @@
<span class="table-title">销售中商品列表</span>
<div class="operate-btn">
<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>
<GLTable ref="tableRef" :pageConf="pageConf" :searchForm="goodsFormObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
......@@ -24,7 +24,8 @@
<img :src="scope.scope.goodsImgUrl" alt="">{{ scope.scope.goodsSkuName }}
</div>
<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>
{{scope.scope.salePrice}}
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice(scope.scope)">
......@@ -34,12 +35,15 @@
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<setPriceDialog v-if="isVisible" :visible="isVisible" @handleClose="handleClose" @confirm="confirmPriceChange">
</setPriceDialog>
</div>
</template>
<script>
import inputNumRange from '@/components/inputNumRange'
import categoryCascader from '@/components/categoryCascader.vue'
import setPriceDialog from './setPriceDialog.vue'
import { utils } from 'glsx-common'
export default {
name: 'warehouseIndex',
......@@ -47,11 +51,13 @@ export default {
return {
size: 'small',
curEditId: '',
isVisible: false,
batchPrice: '',
goodsFormObj: {
goodsPosition: 2,
info: '',
categoryCode: [],
shelvesStatus: '',
saleFlag: '',
startSellPrice: '',
endSellPrice: '',
startDiffPrice: '',
......@@ -72,7 +78,7 @@ export default {
},
{
label: '销售状态',
name: 'shelvesStatus',
name: 'saleFlag',
type: 'select',
optionList: [{
id: '',
......@@ -174,7 +180,8 @@ export default {
components: {
inputNumRange,
categoryCascader
categoryCascader,
setPriceDialog
},
mounted() {
......@@ -182,45 +189,64 @@ export default {
methods: {
editPrice(row){
console.log(row)
this.curEditId = row.id
},
setPriceFn(row){
},
//获取复选table数据
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
if (temp < 0) {
temp = ''
}
if (temp.length > 1 && temp.slice(0, 1) == '0' && temp.slice(1, 2) != '.') {
temp = '0'
// 取消批量改价弹框
handleClose(){
this.batchPrice = ''
this.isVisible = false
this.curEditId = ''
},
// 点击批量改价打开弹框
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, '') //清除"数字"和"."以外的字符
temp = temp.replace(/^\./g, '') //验证第一个字符是数字
temp = temp.replace(/\.{2,}/g, '') //只保留第一个, 清除多余的
temp = temp
.replace('.', '$#$')
.replace(/\./g, '')
.replace('$#$', '.')
temp = temp.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') //只能输入两个小数
this.$nextTick(() => {
const target = this.couponFormObj.selectedGoodsList.find(item => item.id == id)
target.newCost = temp
})
this.$apis.platformGoods.modifyPriceApi(params).then(res=>{
if(res){
this.$message.success('操作成功')
this.handleClose()
this.handleReset()
}
})
},
handleShelf(){
this.getAllData()
},
handleReset(){
this.goodsFormObj = {
goodsPosition: 2,
info: '',
categoryCode: [],
shelvesStatus: '',
saleFlag: '',
startSellPrice: '',
endSellPrice: '',
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
......@@ -26,26 +26,21 @@
</div>
<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('.', '$#$')
.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 slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<GLDialog title="批量改价" mode="small" :visible.sync="isVisible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消">
<div class="dialog-wrap">
<span>销售价 = 供货价 +</span>
<el-input size="small" type="text" v-model="batchPrice" placeholder="请输入金额">
<span slot="append">元</span>
</el-input>
</div>
</GLDialog>
<setPriceDialog v-if="isVisible" :visible="isVisible" @handleClose="handleClose" @confirm="confirmPriceChange">
</setPriceDialog>
</div>
</template>
<script>
import inputNumRange from '@/components/inputNumRange'
import categoryCascader from '@/components/categoryCascader.vue'
import setPriceDialog from './setPriceDialog.vue'
import { utils } from 'glsx-common'
export default {
name: 'warehouseIndex',
......@@ -192,7 +187,8 @@ export default {
components: {
inputNumRange,
categoryCascader
categoryCascader,
setPriceDialog
},
mounted() {
......@@ -204,17 +200,46 @@ export default {
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()
},
// 取消批量改价弹框
handleClose(){
this.batchPrice = ''
this.isVisible = false
},
// 点击批量改价打开弹框
batchPriceChange(){
const list = this.getAllData()
if(!list?.length) return this.$message.error(`请选择要批量改价的商品`)
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){
const api = this.$apis.platformGoods.batchSaleApi
......@@ -293,26 +318,6 @@ export default {
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>
\ 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!