Commit d3754c98 by 前端

bug修复

1 parent a5d15816
<!-- 秒杀活动 --> <!-- 秒杀活动 -->
<template> <template>
<div class="ctnr"> <div class="ctnr">
<GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj" :formData="goodsFormData"> <GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj"
:formData="goodsFormData">
<div slot="categorySlot"> <div slot="categorySlot">
<categoryCascader :categoryCode.sync="goodsFormObj"></categoryCascader> <categoryCascader :checkStrictly="true" :categoryCode.sync="goodsFormObj"></categoryCascader>
</div> </div>
<div slot="supplyPriceSlot"> <div slot="supplyPriceSlot">
<inputNumRange :formData="goodsFormObj" :keyObj="{from: 'startSellPrice', to:'endSellPrice'}"></inputNumRange> <inputNumRange :formData="goodsFormObj" :keyObj="{from: 'startSellPrice', to:'endSellPrice'}"></inputNumRange>
...@@ -19,18 +20,22 @@ ...@@ -19,18 +20,22 @@
<el-button :size="size" type="primary" plain @click="batchPriceChange">批量改价</el-button> <el-button :size="size" type="primary" plain @click="batchPriceChange">批量改价</el-button>
</div> </div>
</div> </div>
<GLTable @setTableFinishFun="setTableFinishFun" ref="tableRef" :pageConf="pageConf" @sortChange="sortChange" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn"> <GLTable @setTableFinishFun="setTableFinishFun" ref="tableRef" :pageConf="pageConf" @sortChange="sortChange"
:searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi"
:beforeSearchFn="beforeSearchFn">
<div slot="goodsNameSlot" class="goodsNameSlot" slot-scope="scope"> <div slot="goodsNameSlot" class="goodsNameSlot" slot-scope="scope">
<img :src="scope.scope.goodsImgUrl" alt=""> <img :src="scope.scope.goodsImgUrl" alt="">
<el-tooltip class="item" effect="dark" :content="(scope.scope.brandName || '') + (scope.scope.goodsSkuName || '')" placement="top"> <el-tooltip class="item" effect="dark"
:content="(scope.scope.brandName || '') + (scope.scope.goodsSkuName || '')" placement="top">
<span class="name">{{ scope.scope.brandName }} {{ scope.scope.goodsSkuName }}</span> <span class="name">{{ scope.scope.brandName }} {{ scope.scope.goodsSkuName }}</span>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope"> <div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<el-input ref="priceRef" v-focus 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(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$') <el-input ref="priceRef" v-focus 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(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).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> .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)">
</span> </span>
</div> </div>
...@@ -47,8 +52,9 @@ ...@@ -47,8 +52,9 @@
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 setPriceDialog from './setPriceDialog.vue'
import { utils } from 'glsx-common' import {utils} from 'glsx-common'
import util from '@/util/util' import util from '@/util/util'
export default { export default {
name: 'warehouseIndex', name: 'warehouseIndex',
data() { data() {
...@@ -109,7 +115,7 @@ export default { ...@@ -109,7 +115,7 @@ export default {
}, },
], ],
getListApi: this.$apis.platformGoods.getListApi, getListApi: this.$apis.platformGoods.getListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'},
tableParams: { tableParams: {
listName: 'list', listName: 'list',
mutiSelectName: 'goodsIndex', mutiSelectName: 'goodsIndex',
...@@ -218,37 +224,37 @@ export default { ...@@ -218,37 +224,37 @@ export default {
methods: { methods: {
setTableFinishFun () { setTableFinishFun() {
//接收到的数据为空 //接收到的数据为空
this.$refs.tableRef.data.length ? (this.$refs.tableRef.tableHeightValues = '') : this.$refs.tableRef.setTableHeightFun() this.$refs.tableRef.data.length ? (this.$refs.tableRef.tableHeightValues = '') : this.$refs.tableRef.setTableHeightFun()
}, },
sortChange(e){ sortChange(e) {
const {order, prop} = e const {order, prop} = e
if(prop=='saleAmount'){ if (prop == 'saleAmount') {
this.goodsFormObj.orderBySaleAmount = order=='ascending' ? 1 : order=='descending' ? 2 : '' this.goodsFormObj.orderBySaleAmount = order == 'ascending' ? 1 : order == 'descending' ? 2 : ''
this.goodsFormObj.orderBySalePrice = '' this.goodsFormObj.orderBySalePrice = ''
} }
if(prop=='salePrice'){ if (prop == 'salePrice') {
this.goodsFormObj.orderBySalePrice = order=='ascending' ? 1 : order=='descending' ? 2 : '' this.goodsFormObj.orderBySalePrice = order == 'ascending' ? 1 : order == 'descending' ? 2 : ''
this.goodsFormObj.orderBySaleAmount = '' this.goodsFormObj.orderBySaleAmount = ''
} }
this.handleSearch() this.handleSearch()
}, },
editPrice(row){ editPrice(row) {
this.curEditId = row.id this.curEditId = row.id
// this.$nextTick(()=>{ // this.$nextTick(()=>{
// this.$refs.priceRef.focus() // this.$refs.priceRef.focus()
// }) // })
}, },
//获取复选table数据 //获取复选table数据
getAllData(){ getAllData() {
return this.$refs?.tableRef?.mutiSelectArr[this.tableParams.mutiSelectName] || [] return this.$refs?.tableRef?.mutiSelectArr[this.tableParams.mutiSelectName] || []
}, },
// 确认批量改价弹框 // 确认批量改价弹框
confirmPriceChange(e){ confirmPriceChange(e) {
this.batchPrice = e this.batchPrice = e
if(!this.batchPrice && this.batchPrice!==0 && this.batchPrice!=='0') return this.$message({ if (!this.batchPrice && this.batchPrice !== 0 && this.batchPrice !== '0') return this.$message({
message:'请输入金额', message: '请输入金额',
type: 'error', type: 'error',
customClass: 'msgHierarchy' customClass: 'msgHierarchy'
}); });
...@@ -256,38 +262,38 @@ export default { ...@@ -256,38 +262,38 @@ export default {
this.handleClose() this.handleClose()
}, },
// 取消批量改价弹框 // 取消批量改价弹框
handleClose(){ handleClose() {
this.batchPrice = '' this.batchPrice = ''
this.isVisible = false this.isVisible = false
this.curEditId = '' this.curEditId = ''
}, },
// 点击批量改价打开弹框 // 点击批量改价打开弹框
batchPriceChange(){ batchPriceChange() {
const list = this.getAllData() const list = this.getAllData()
if(!list?.length) return this.$message.error(`请选择要批量改价的商品`) if (!list?.length) return this.$message.error(`请选择要批量改价的商品`)
this.isVisible = true this.isVisible = true
}, },
handleShelf(item, isAll){ handleShelf(item, isAll) {
const api = this.$apis.platformGoods.batchOffApi const api = this.$apis.platformGoods.batchOffApi
this.batchFn(api, '下架至仓库', item ,isAll) this.batchFn(api, '下架至仓库', item, isAll)
}, },
batchFn(Api, operate, item, isAll){ batchFn(Api, operate, item, isAll) {
let params = { let params = {
ids: [item.id], ids: [item.id],
} }
let tip = `确定把 ${item.goodsSkuName} ${operate}?` let tip = `确定把 ${item.goodsSkuName} ${operate}?`
if(isAll){ if (isAll) {
const list = this.getAllData() const list = this.getAllData()
if(!list?.length) return this.$message.error(`请选择要${operate}的商品`) if (!list?.length) return this.$message.error(`请选择要${operate}的商品`)
params.ids = list.map(item => item.id) params.ids = list.map(item => item.id)
tip = `确定把已选的${list.length}个商品全部${operate}?` tip = `确定把已选的${list.length}个商品全部${operate}?`
} }
this.$confirm(tip, '提示', { this.$confirm(tip, '提示', {
type: 'warning', type: 'warning',
callback: action => { callback: action => {
if(action=='confirm'){ if (action == 'confirm') {
Api(params).then(res=>{ Api(params).then(res => {
if(res){ if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleSearch() this.handleSearch()
} }
...@@ -296,20 +302,20 @@ export default { ...@@ -296,20 +302,20 @@ export default {
} }
}) })
}, },
setPriceFn(e, item, isAll){ setPriceFn(e, item, isAll) {
let params = {} let params = {}
if(isAll){ if (isAll) {
let list = this.getAllData() let list = this.getAllData()
params = { params = {
modifyPriceRequestList : list.map(item => { modifyPriceRequestList: list.map(item => {
let curPrice = item.sellPrice || 0 let curPrice = item.sellPrice || 0
let addPrice = this.batchPrice || 0 let addPrice = this.batchPrice || 0
let priceAmount = Number(((+curPrice) + (+addPrice)).toFixed(2)) let priceAmount = Number(((+curPrice) + (+addPrice)).toFixed(2))
return { id: item.id, salePrice: priceAmount} return {id: item.id, salePrice: priceAmount}
}) })
} }
}else{ } else {
if(!(+e.target.value)){ if (!(+e.target.value)) {
this.handleClose() this.handleClose()
this.handleSearch() this.handleSearch()
this.$message.error('请输入大于0的金额') this.$message.error('请输入大于0的金额')
...@@ -322,15 +328,15 @@ export default { ...@@ -322,15 +328,15 @@ export default {
}], }],
} }
} }
this.$apis.platformGoods.modifyPriceApi(params).then(res=>{ this.$apis.platformGoods.modifyPriceApi(params).then(res => {
this.handleSearch() this.handleSearch()
if(res){ if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleClose() this.handleClose()
} }
}) })
}, },
handleReset(){ handleReset() {
this.goodsFormObj = { this.goodsFormObj = {
goodsPosition: 2, goodsPosition: 2,
goodsSkuName: '', goodsSkuName: '',
...@@ -344,34 +350,44 @@ export default { ...@@ -344,34 +350,44 @@ export default {
} }
this.handleSearch() this.handleSearch()
}, },
handleSearch(){ handleSearch() {
this.$refs.tableRef.refreshTable() this.$refs.tableRef.refreshTable()
}, },
beforeSearchFn(){ beforeSearchFn() {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject) => {
this.searchForm = utils.deepClone(this.goodsFormObj) this.searchForm = utils.deepClone(this.goodsFormObj)
const { categoryCode } = this.searchForm const {categoryCode} = this.searchForm
this.searchForm.categoryCode = categoryCode && categoryCode.length ? categoryCode.pop() : '' this.searchForm.categoryCode = categoryCode && categoryCode.length ? categoryCode.pop() : ''
const categoryCodeLength = this.searchForm.categoryCode.length;
if (categoryCodeLength > 0 && categoryCodeLength < 6) {
const name = categoryCodeLength === 2 ? 'categoryCode1' : 'categoryCode2';
this.searchForm[name] = this.searchForm.categoryCode;
delete this.searchForm.categoryCode;
}
resolve() resolve()
}) })
}, },
goDetaillPage(item){ goDetaillPage(item) {
this.$router.push({ path: `/goodsWarehouse/detail/${item.id}`}) this.$router.push({path: `/goodsWarehouse/detail/${item.id}`})
}
} }
} }
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.ctnr{ .ctnr {
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
.setPriceSlot{
.unedited{ .setPriceSlot {
.unedited {
display: flex; display: flex;
align-items: center; align-items: center;
} }
img{
img {
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
...@@ -381,4 +397,3 @@ export default { ...@@ -381,4 +397,3 @@ export default {
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj" <GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj"
:formData="goodsFormData"> :formData="goodsFormData">
<div slot="categorySlot"> <div slot="categorySlot">
<categoryCascader :categoryCode.sync="goodsFormObj"></categoryCascader> <categoryCascader :checkStrictly="true" :categoryCode.sync="goodsFormObj"></categoryCascader>
</div> </div>
<div slot="supplyPriceSlot"> <div slot="supplyPriceSlot">
<inputNumRange :formData="goodsFormObj" :keyObj="{from: 'startSellPrice', to:'endSellPrice'}"></inputNumRange> <inputNumRange :formData="goodsFormObj" :keyObj="{from: 'startSellPrice', to:'endSellPrice'}"></inputNumRange>
...@@ -340,6 +340,13 @@ export default { ...@@ -340,6 +340,13 @@ export default {
this.searchForm = utils.deepClone(this.goodsFormObj) this.searchForm = utils.deepClone(this.goodsFormObj)
const {categoryCode} = this.searchForm const {categoryCode} = this.searchForm
this.searchForm.categoryCode = categoryCode && categoryCode.length ? categoryCode.pop() : '' this.searchForm.categoryCode = categoryCode && categoryCode.length ? categoryCode.pop() : ''
const categoryCodeLength = this.searchForm.categoryCode.length;
if (categoryCodeLength > 0 && categoryCodeLength < 6) {
const name = categoryCodeLength === 2 ? 'categoryCode1' : 'categoryCode2';
this.searchForm[name] = this.searchForm.categoryCode;
delete this.searchForm.categoryCode;
}
resolve() resolve()
}) })
}, },
......
...@@ -262,7 +262,6 @@ export default { ...@@ -262,7 +262,6 @@ export default {
confirmPriceChange(e) { confirmPriceChange(e) {
this.batchPrice = e.batchPrice this.batchPrice = e.batchPrice
this.batchCount = e.batchCount this.batchCount = e.batchCount
console.log(this.batchCount != '0')
if (!Number(this.batchCount) && this.isConversionRate) return this.$message({ if (!Number(this.batchCount) && this.isConversionRate) return this.$message({
message: '请输入大于0的积分', message: '请输入大于0的积分',
type: 'error', type: 'error',
......
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
:formData="searchFormData" @handleOk="selConfig" @handleRest="selConfig('reset')"></GLCombiForm> :formData="searchFormData" @handleOk="selConfig" @handleRest="selConfig('reset')"></GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">白名单列表</span> <div class="table-title1">白名单列表
<p class="table-des">门店助手小程序的积分提现功能对白名单下的门店可见,其门店员工可进行积分提现。</p>
</div>
<div class="operate-btn"> <div class="operate-btn">
</div> </div>
</div> </div>
...@@ -216,6 +219,24 @@ export default { ...@@ -216,6 +219,24 @@ export default {
padding: 20px; padding: 20px;
} }
.operate-wrap{
.table-title1{
display: flex;
height: 32px;
font-weight: 600;
font-size: 16px;
color: #333;
line-height: 32px;
.table-des{
line-height: 34px;
margin-left: 8px;
font-weight: 400;
color: #666666;
font-size: 14px;
}
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!