Commit 63ac1305 by chenwq

fix(商品管理): 修复商品编辑页规格值显示问题并优化样式

- 修复规格值显示换行问题并调整样式
- 优化商品编辑页表单验证逻辑
- 调整批量操作商品数量限制为100件
- 修复价格输入框禁用状态及验证提示
- 优化专场商品选择弹窗宽度及样式
1 parent fb2055e6
......@@ -285,7 +285,7 @@ export default {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content {
width: 100%;
width: 100% !important;
}
.glsx-combi-form .el-form-item--small.el-form-item {
......
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<div class="flex">
<GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj" :formData="goodsFormData"></GLCombiForm>
</div>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="1380px" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="goodsFormObj" :formData="goodsFormData"></GLCombiForm>
<GLTable class="pointTable" @setTableFinishFun="setTableFinishFun" ref="tableRef" :pageConf="pageConf" @sortChange="sortChange" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<span class="unedited">{{ scope.scope.redeemPoints }}积分 + {{ scope.scope.salePrice }}元</span>
......@@ -135,9 +133,9 @@ export default {
})
},
setTableFinishFun() {
this.recoverySelected()
},
setTableFinishFun() {
this.recoverySelected()
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
......@@ -178,17 +176,21 @@ export default {
recoverySelected() {
if (this.selectedProList.length) {
this.selectedProList.forEach(row => {
const obj = this.productList.find(item => item.id == row.id)
const obj = this.productList.find(item => item.id == row.id)
this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row, true)
})
}
},
handleMutiSelectConfirm() {
var selectedData = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName]
if(selectedData && selectedData.length > 10) {
this.$message.error('最多选择10件商品')
return true
}
if (selectedData && selectedData.length > 100) {
this.$message({
message: '最多选择100件商品',
type: 'error',
customClass: 'msgHierarchy'
})
return true
}
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
......
......@@ -132,6 +132,12 @@ export default {
isClear: true
},
{
label: '门店字段',
name: 'merchantName',
type: 'input',
isClear: true
},
{
label: '下单时间',
name: 'time',
type: 'datePicker',
......@@ -196,7 +202,7 @@ export default {
formatter: cell => {
let price = 0
if (cell.payStatus == 1002) {
price = cell.goodsSource ? cell.redeemPoints + '积分' : (cell.businessType == 1 || cell.businessType == 2 ? (cell.redeemPoints * cell.sellQty) + '积分' + '+' + +(cell.salePrice * cell.sellQty).toFixed(2) + '元' : +(cell.salePrice * cell.sellQty).toFixed(2) + '元')
price = cell.goodsSource ? (cell.redeemPoints * cell.sellQty).toFixed(0) + '积分' : (cell.businessType == 1 || cell.businessType == 2 ? (cell.redeemPoints * cell.sellQty) + '积分' + '+' + +(cell.salePrice * cell.sellQty).toFixed(2) + '元' : +(cell.salePrice * cell.sellQty).toFixed(2) + '元')
}
return price
// return cell.businessType == 1 || cell.businessType == 2 ? (cell.redeemPoints * cell.sellQty) + '积分' + '+' + +(cell.salePrice * cell.sellQty).toFixed(2) + '元' : +(cell.salePrice * cell.sellQty).toFixed(2) + '元'
......@@ -226,6 +232,11 @@ export default {
addHtml: 'orderNoSlot'
},
{
label: '门店字段',
width: 300,
prop: 'merchantName'
},
{
label: '下单时间',
width: 200,
formatter: cellValue => {
......
......@@ -16,7 +16,7 @@
</template>
<template slot="specialEvents">
<div class="banner-box">
<el-button type="primary" plain class="add-banner-btn" :size="size" @click="handleBannerAdd" @change="handleBannerChange">新增banner</el-button>
<el-button type="primary" plain class="add-banner-btn" :size="size" @click="handleBannerAdd" @change="handleBannerChange">+ 新增专场</el-button>
<el-tabs v-if="editForm.specialEvents.length" v-model="bannerIdx" type="card" class="home-set-tabs" closable @tab-remove="handleBannerDelete">
<el-tab-pane v-for="(subItem, subIndex) in editForm.specialEvents" :key="subIndex" :label="subItem.eventName" :name="subIndex">
<div class="item-box">
......@@ -32,7 +32,7 @@
<el-button type="default" @click="handleMutiProClose(scope)">{{ editForm.specialEvents[bannerIdx].specialEventGoodsList.length ? '更换商品' : '+选择商品' }}</el-button>
</div>
<div slot="proTable" v-if="editForm.specialEvents[bannerIdx].specialEventGoodsList.length" class="select-pro" :style="{ 'margin-left': defaultLabelWidth, width: `calc(100% - ${defaultLabelWidth} )` }">
<GLTable :hasPage="false" :tableParams="tableParams" :tableData="editForm.specialEvents[bannerIdx].specialEventGoodsList">
<GLTable class="proTable" :hasPage="false" :tableParams="tableParams" :tableData="editForm.specialEvents[bannerIdx].specialEventGoodsList">
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<span class="unedited">{{ scope.scope.redeemPoints }}积分 + {{ scope.scope.salePrice }}元</span>
</div>
......@@ -41,10 +41,10 @@
<el-button class="p-0 m-l-10" type="text" @click="handleProTop(scope)">置顶</el-button>
</span>
</GLTable>
<el-button style="margin-top: 20px;" type="primary" plain :size="size" @click="handleUpEvent(subIndex)">置顶专场</el-button>
</div>
</glsx-combi-form>
</div>
<el-button type="primary" plain :size="size" @click="handleUpEvent(subIndex)">置顶专场</el-button>
</div>
</el-tab-pane>
</el-tabs>
......@@ -439,7 +439,7 @@ export default {
border: 1px solid #e5e5e5;
border-radius: 0 4px 4px 4px;
border-top: none;
padding: 20px;
/* padding: 20px; */
}
.home-set .banner-img {
display: flex;
......@@ -450,6 +450,26 @@ export default {
font-weight: 400;
color: #666;
}
.home-set .banner-box {
position: relative;
width: calc(100vw - 100px);
}
.home-set .add-banner-btn {
position: absolute;
right: 0px;
top: 0px;
width: 114px;
height: 40px;
border-radius: 4px 4px 0 0;
color: #666666;
font-size: 14px;
border: 1px solid #e8e8ea;
background: #fafafa;
z-index: 999;
}
.home-set .proTable {
width: calc(100vw - 300px);
}
.home-set .home-set-form .item-box .home-set-tabs.el-tabs--card > .el-tabs__header .el-tabs__nav {
border: none !important;
}
......
......@@ -163,7 +163,8 @@ export default {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
type: res.code == '0' ? 'success' : 'error',
customClass: 'msgHierarchy'
})
if (res.code == '0') {
fn && fn()
......
......@@ -44,7 +44,7 @@
<span>+</span>
<!-- v-focus-->
<el-input size="small" clearable v-model="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"
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" disabled
@blur="setPriceFn">
<span slot="append">元</span>
</el-input>
......@@ -68,7 +68,7 @@
<el-button type="primary" :disabled="goodsInfo.shelvesStatus == 1002" v-if="goodsInfo.goodsPosition==1"
@click="handleSale">上架销售
</el-button>
<el-button type="primary" v-if="goodsInfo.goodsPosition==2" plain @click="handleOff">下架</el-button>
<!-- <el-button type="primary" v-if="goodsInfo.goodsPosition==2" plain @click="handleOff">下架</el-button> -->
<el-button type="primary" v-if="goodsInfo.goodsPosition==1" plain @click="handleRemove">移出</el-button>
</div>
</div>
......@@ -101,6 +101,7 @@
</template>
<script>
import { limitPrice } from '@/common/constant'
const attrList = [
// {
// label:'商品特点',
......@@ -158,6 +159,11 @@ export default {
},
},
},
watch: {
redeemPoints(newValue, oldValue) {
this.redeemPoints = limitPrice(newValue, oldValue, 5, 0, 1, 99999)
}
},
mounted() {
},
......@@ -215,9 +221,9 @@ export default {
handleSale() {
this.operateFn('batchSaleApi', '上架销售')
},
handleOff() {
this.operateFn('batchOffApi', '下架')
},
// handleOff() {
// this.operateFn('batchOffApi', '下架')
// },
handleRemove() {
this.operateFn('batchRemoveApi', '移出')
},
......
......@@ -59,17 +59,17 @@
<div>
<span class="specs-title">规格名:</span>
<span class="specs-item">{{ subItem.specificationName }}</span>
<div style="position: absolute; right: 10px; top: 10px;">
<el-button v-show="!isDisabled" type="text" @click="handleSpecsEdit(2, subItem, subIndex)">编辑</el-button>
<el-button v-show="!isDisabled" type="text" @click="handleSpecsDelete(subIndex)">删除</el-button>
<div style="position: absolute; right: -50px; top: 50%;">
<el-button class="el-icon-edit-outline" style="padding: 0 0" v-show="!isDisabled" type="text" @click="handleSpecsEdit(2, subItem, subIndex)"></el-button>
<el-button class="el-icon-delete" style="padding: 0; margin-left: 8px" v-show="!isDisabled" type="text" @click="handleSpecsDelete(subIndex)"></el-button>
</div>
</div>
<div class="flex">
<span style="width: 56px;">规格值:</span>
<div style="width: calc(100% - 56px);">
<div>
<span class="specs-item" v-for="(n, idx) in subItem.platformSpecificationValueList" :key="idx">{{ n.specificationValue }}</span>
</div>
<div class="flex-default" style="width: calc(100% - 56px); flex-wrap: wrap;">
<!-- <div> -->
<div class="specs-item" style="display: inline-block; margin-bottom: 12px;" v-for="(n, idx) in subItem.platformSpecificationValueList" :key="idx">{{ n.specificationValue }}</div>
<!-- </div> -->
</div>
</div>
</div>
......@@ -92,7 +92,11 @@
<tr style="border-bottom: 1px solid rgb(235, 235, 235); height: 54px; line-height: 54px;" v-for="(subItem, subIndex) in nameToValSpecsList" :key="subIndex">
<td :style="{ width: specsWidth }" v-for="(n, idx) in subItem.specsValueList" :key="idx" :title="n">{{ n }}</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" class="w-100-per" placeholder="供货价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)" @blur="handleRetailPriceBlur"></el-input>
<el-input :disabled="isDisabled" :class="{ 'w-100-per': true, 'border-red': !(subItem.retailPrice + '') && submitted }" placeholder="供货价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)" @blur="handleRetailPriceBlur">
<el-popover v-show="!(subItem.retailPrice + '') && submitted" slot="suffix" placement="top" title width="90" trigger="hover" content="供货价是必填项">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="库存" v-model="subItem.stock" :class="{ 'w-100-per': true, 'border-red': !(subItem.stock + '') && submitted }" @input.native="e => handleStockInput(e, subIndex)">
......@@ -111,7 +115,7 @@
<p class="edit-tips">作为商品划线展示的价格</p>
</template>
<template slot="serviceDescHtml">
<el-input type="textarea" v-model="editForm.serviceDesc" placeholder="请输入服务说明" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="30" :disabled="isDisabled" />
<el-input type="textarea" v-model="editForm.serviceDesc" placeholder="请输入服务说明" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" :disabled="isDisabled" />
</template>
</glsx-combi-form>
</div>
......@@ -830,6 +834,7 @@ export default {
...res,
sellPrice: res.sellPrice + '',
stockNum: res.goodsStock + '',
expressFee: res.expressFee + '',
describeTxt: '',
descImgList: [],
// businessType: [],
......@@ -839,7 +844,7 @@ export default {
specificationList: this.$common.utils.deepClone(res.platformGlGoodsSpecificationList),
specificationDetailList: this.$common.utils.deepClone(res.platformGlGoodsSpecifications)
}
console.log(this.editForm, 'editform')
// console.log(this.editForm, 'editform')
// 规格
if (this.editForm.specificationList.length) {
this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
......@@ -945,9 +950,6 @@ export default {
var isJump = false
this.submitted = true
for (var i = 0; i < this.externalFormList.length; i++) {
if (isJump) {
return true
}
this.$refs.editFormRef[i].$refs['editProRef' + i].validate((valid, errorObj) => {
// 规格值验证
if (i == 1) {
......@@ -965,6 +967,9 @@ export default {
this.whereToGo(Object.keys(errorObj)[0])
}
})
if (isJump) {
return true
}
}
var params = this.$common.utils.deepClone(this.editForm)
var deleteAttrList = ['descImgList', 'describeTxt', 'specificationList', 'goodsDetailImageList']
......@@ -1000,7 +1005,6 @@ export default {
})
params.specificationDetailList.push({
specificationData: specificationData,
// retailPrice: (item.retailPrice * 100).toFixed(0),
retailPrice: item.retailPrice,
stock: item.stock
})
......@@ -1100,6 +1104,8 @@ export default {
padding: 2px 6px;
vertical-align: center;
text-align: center;
word-break: break-all;
line-height: 20px;
}
.edit-pro .table-spesc .el-input--small .el-input__inner {
text-align: center !important;
......@@ -1213,10 +1219,12 @@ export default {
}
.edit-pro .sepce-box {
position: relative;
padding: 30px 34px;
box-sizing: border-box;
width: 684px;
padding: 22px 20px;
color: #3a3a3a;
background: #f7f7f7;
border: 1px solid #dcdfe6;
background: #f9f9f9;
border: 1px solid #f9f9f9;
margin-bottom: 10px;
}
.edit-pro .sepce-box .specs-title {
......@@ -1224,11 +1232,12 @@ export default {
line-height: 60px;
}
.edit-pro .sepce-box .specs-item {
background: #e6e9ff;
background: #fafbfe;
border-radius: 4px;
padding: 9px 16px;
color: #717171;
margin-right: 12px;
padding: 6px 12px;
color: #666666;
margin-right: 8px;
border: 1px solid #e8e8ea;
}
.color-red {
color: #eb4e4e;
......
......@@ -438,10 +438,10 @@ export default {
let list = this.getAllData()
params = {
modifyPriceRequestList: list.map(item => {
let curPrice = Math.ceil(item.sellPrice) || 0
// let curPrice = Math.ceil(item.sellPrice) || 0
let disposePrice = this.batchPrice || 0
let count = this.batchCount || 0
let disposeCount = Number(((+count) + (+curPrice)).toFixed(2))
// let count = this.batchCount || 0
let disposeCount = Number((+this.batchCount || 0).toFixed(2))
// let addPrice = this.batchPrice || 0
// let priceAmount = Number(((+curPrice) + (+addPrice)).toFixed(2))
......@@ -555,7 +555,7 @@ export default {
goDetaillPage(row) {
if (row.goodsSource == 2) {
this.$router.push({
path: '/pointProducts/editProduct',
path: '/pointProducts/editProductSJZ',
query: {
backPath: '/pointProducts/index',
addOrEdit: 'detail',
......
......@@ -48,7 +48,7 @@ export default {
},
watch: {
batchCount(newValue, oldValue) {
this.batchCount = limitPrice(newValue, oldValue, 4, 0, 0, 1000)
this.batchCount = limitPrice(newValue, oldValue, 5, 0, 1, 99999)
}
},
......
......@@ -66,9 +66,9 @@ export default {
},
{
label: '浏览次数',
prop: 'visitorCount',
prop: 'browseCount',
formatter: cellValue => {
return cellValue.visitorCount + '次'
return cellValue.browseCount + '次'
}
},
{
......
......@@ -40,7 +40,7 @@
<span>+</span>
<!-- v-focus-->
<el-input size="small" clearable v-model="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"
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" disabled
@blur="setPriceFn('salePrice')">
<span slot="append">元</span>
</el-input>
......@@ -98,6 +98,7 @@
</template>
<script>
import { limitPrice } from '@/common/constant'
const attrList = [
// {
// label:'商品特点',
......@@ -154,6 +155,11 @@ export default {
},
},
},
watch: {
redeemPoints(newValue, oldValue) {
this.redeemPoints = limitPrice(newValue, oldValue, 5, 0, 1, 99999)
}
},
mounted() {
},
......
......@@ -392,10 +392,10 @@ export default {
let list = this.getAllData()
params = {
modifyPriceRequestList: list.map(item => {
let curPrice = Math.ceil(item.sellPrice) || 0
// let curPrice = Math.ceil(item.sellPrice) || 0
let disposePrice = this.batchPrice || 0
let count = this.batchCount || 0
let disposeCount = Number(((+count) + (+curPrice)).toFixed(2))
// let count = this.batchCount || 0
let disposeCount = Number((+this.batchCount || 0).toFixed(2))
// let addPrice = this.batchPrice || 0
// let priceAmount = Number(((+curPrice) + (+addPrice)).toFixed(2))
......@@ -425,8 +425,8 @@ export default {
}
})
},
judgeCategory(item) {
const list = item ? [item] : this.getAllData()
judgeCategory(item, isAll) {
const list = !isAll ? [item] : this.getAllData()
for (let i = 0; i < list.length; i++) {
if (!list[i].fronCategoryId) {
return true
......@@ -438,7 +438,7 @@ export default {
// 点击批量上架
batchSale(item, isAll) {
// 有未设置前端分类的
if (this.judgeCategory(item)) {
if (this.judgeCategory(item, isAll)) {
!isAll ? this.editCategory(item) : this.$message.error('有商品未设置前端分类')
return true
}
......
......@@ -36,7 +36,7 @@
</div>
</div>
<GLDialog :title="dialogConfig.title" mode="mid" :visible.sync="isSelectVisible" :show-close="true" :before-close="selectVisible" @onOk="handleAllowOrRefuse('allow')" @onCancel="dialogConfig.btnOpt == 'check' ? handleAllowOrRefuse('refuse') : selectVisible()" :okText="dialogConfig.okText" :cancelText="dialogConfig.cancelText">
<div class="dialog-wrap" v-loading="batchLoading">
<div v-loading="batchLoading">
<glsxCombiForm ref="editFormRef" isEdit="true" :formObj="batchForm" :formData="batchEditForm" :formRules="batchEditRules" formRef="editChildRef"></glsxCombiForm>
</div>
</GLDialog>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!