Commit 255c1e60 by wangql
2 parents a48d6900 e594ef08
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 19:06:01 * @Date: 2019-09-01 19:06:01
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-15 11:24:23 * @Last Modified time: 2020-11-18 15:19:52
*/ */
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account' // import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
...@@ -106,3 +106,30 @@ export const brandMerchantList = [{ ...@@ -106,3 +106,30 @@ export const brandMerchantList = [{
confId: '10', confId: '10',
confValue: '嘀嘀虎' confValue: '嘀嘀虎'
}] }]
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
export function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
var reg = {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/
}
regRule = regRule || 'priceReg'
if (newValue && (minValue && (newValue < minValue)) || (maxValue && (newValue > maxValue))) {
return oldValue || ''
}
if (newValue && reg[regRule].test(newValue + '')) {
if ((/\./).test(newValue)) {
newValue = newValue + ''
var interger = newValue.split('.')[0]
var point = newValue.split('.')[1]
var intergerNum = interger.length > intergerDigit ? oldValue.split('.')[0] : interger
var pointNum = point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0]
} else {
newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue
}
return newValue
} else {
return newValue ? oldValue : ''
}
}
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
v-model="proInfo.upgradePrice" v-model="proInfo.upgradePrice"
placeholder="请输入建议升级价" placeholder="请输入建议升级价"
class="dis-in-block" class="dis-in-block"
@input="handleUpgradePrice"
></el-input> ></el-input>
<span>元</span> <span>元</span>
</el-form-item> </el-form-item>
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
v-model="proInfo.shopPrice" v-model="proInfo.shopPrice"
placeholder="请输入建议到店价" placeholder="请输入建议到店价"
class="dis-in-block" class="dis-in-block"
@input="handleShopPrice"
></el-input> ></el-input>
<span>元</span> <span>元</span>
</el-form-item> </el-form-item>
...@@ -69,6 +71,7 @@ ...@@ -69,6 +71,7 @@
placeholder="请输入升级最大折扣" placeholder="请输入升级最大折扣"
clearable clearable
class="dis-in-block" class="dis-in-block"
@input="handleMaxUpgradeDiscount"
></el-input> ></el-input>
<span>折</span> <span>折</span>
</el-form-item> </el-form-item>
...@@ -78,6 +81,8 @@ ...@@ -78,6 +81,8 @@
</template> </template>
<script> <script>
import _ from 'lodash'
import { limitPrice } from '@/common/constants'
export default { export default {
name: 'relateProDialog', name: 'relateProDialog',
data() { data() {
...@@ -97,10 +102,27 @@ export default { ...@@ -97,10 +102,27 @@ export default {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'blur' }], goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'blur' }],
upgradePrice: [{ required: true, message: '请输入建议升级价', trigger: 'blur' }], upgradePrice: [{ required: true, message: '请输入建议升级价', trigger: 'blur' }],
shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }] shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }]
},
oldVal: {
upgradePrice: '',
shopPrice: '',
maxUpgradeDiscount: ''
} }
} }
}, },
// watch: {
// 'proInfo.upgradePrice'(val, oldVal) {
// this.proInfo.upgradePrice = limitPrice(val, oldVal, 8, 2)
// },
// 'proInfo.shopPrice'(val, oldVal) {
// this.proInfo.shopPrice = limitPrice(val, oldVal, 6, 2)
// },
// 'proInfo.maxUpgradeDiscount'(val, oldVal) {
// this.proInfo.maxUpgradeDiscount = limitPrice(val, oldVal, 1, 1, 1)
// }
// },
props: { props: {
relateProVisible: { relateProVisible: {
type: Boolean, type: Boolean,
...@@ -117,9 +139,9 @@ export default { ...@@ -117,9 +139,9 @@ export default {
}, },
mounted() { mounted() {
this.proInfo = this.originProInfo || this.proInfo this.proInfo = _.cloneDeep(this.originProInfo) || _.cloneDeep(this.proInfo)
console.log(this.proInfo) // console.log(this.proInfo)
console.log(this.proList) // console.log(this.proList)
}, },
methods: { methods: {
...@@ -140,6 +162,18 @@ export default { ...@@ -140,6 +162,18 @@ export default {
}, },
handleRelateProClose() { handleRelateProClose() {
this.$emit('handleRelateProClose') this.$emit('handleRelateProClose')
},
handleUpgradePrice(newVal) {
this.proInfo.upgradePrice = limitPrice(newVal, this.oldVal.upgradePrice, 8, 2)
this.oldVal.upgradePrice = this.proInfo.upgradePrice
},
handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
},
handleMaxUpgradeDiscount(newVal) {
this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1)
this.oldVal.maxUpgradeDiscount = this.proInfo.maxUpgradeDiscount
} }
} }
} }
......
...@@ -35,14 +35,14 @@ export default { ...@@ -35,14 +35,14 @@ export default {
this.show = false this.show = false
this.$event.$on('e-password-dialog', res => (this.passVisible = res)) this.$event.$on('e-password-dialog', res => (this.passVisible = res))
this.getInfo() this.getInfo()
this.$nextTick(() => {
this.show = true
})
}, },
methods: { methods: {
...mapActions('d2admin/user', ['load']), ...mapActions('d2admin/user', ['load']),
async getInfo() { async getInfo() {
this.info = await this.load() this.info = await this.load()
this.$nextTick(() => {
this.show = true
})
} }
} }
} }
......
...@@ -95,7 +95,8 @@ ...@@ -95,7 +95,8 @@
title="关联门店信息" title="关联门店信息"
:className="storeDetail" :className="storeDetail"
:isVisible.sync="detailVisible" :isVisible.sync="detailVisible"
@closeDialog="handleDetailClose" noCancel="true"
@confirmDialog="handleDetailClose"
> >
<store-detail <store-detail
v-if="detailVisible" v-if="detailVisible"
...@@ -133,6 +134,9 @@ export default { ...@@ -133,6 +134,9 @@ export default {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
tableColumns: [{ tableColumns: [{
label: '序号',
prop: 'index'
}, {
label: '商品ID', label: '商品ID',
prop: 'goodsCode' prop: 'goodsCode'
}, { }, {
......
...@@ -10,16 +10,17 @@ ...@@ -10,16 +10,17 @@
:addOrEdit="addOrEdit" :addOrEdit="addOrEdit"
:originData="editData" :originData="editData"
:formList="editForm" :formList="editForm"
:formRef="comFormRef"
:headImg="headImg" :headImg="headImg"
@handleAddConfirm="handleAddConfirm" @handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose" @handleClose="handleAddClose"
></d2-form> ></d2-form>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { limitPrice } from '@/common/constants'
import { commodityAddSeviceMerchant, getGoodsList, baseGoodsAdd, baseGoodsUpdate, getGoodsInfoById } from '@/api/commodity' import { commodityAddSeviceMerchant, getGoodsList, baseGoodsAdd, baseGoodsUpdate, getGoodsInfoById } from '@/api/commodity'
export default { export default {
name: 'editCommodity', name: 'editCommodity',
...@@ -38,9 +39,14 @@ export default { ...@@ -38,9 +39,14 @@ export default {
upgradeGoods: [], upgradeGoods: [],
linkMerchantIds: [] linkMerchantIds: []
}, },
markOldVal: {
retailPrice: '',
shopPrice: '',
maxRetailDiscount: ''
},
formItemWidth: '200px', formItemWidth: '200px',
rules: { rules: {
goodsCode: [{ required: true, message: '请选择商品名称', trigger: 'blur' }], goodsCode: [{ required: true, message: '请选择商品名称', trigger: 'change' }],
shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }], shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }],
linkMerchantIds: [{ required: true, message: '请选择关联门店', trigger: 'change' }] linkMerchantIds: [{ required: true, message: '请选择关联门店', trigger: 'change' }]
}, },
...@@ -48,6 +54,7 @@ export default { ...@@ -48,6 +54,7 @@ export default {
isHas: true, isHas: true,
attr: 'thumbUrl' attr: 'thumbUrl'
}, },
comFormRef: 'com',
editForm: [{ editForm: [{
title: '商品基本信息', title: '商品基本信息',
formBlock: [{ formBlock: [{
...@@ -84,18 +91,30 @@ export default { ...@@ -84,18 +91,30 @@ export default {
label: '商品零售价', label: '商品零售价',
type: 'input', type: 'input',
unit: '元', unit: '元',
tips: '(前端展示给车主)' tips: '(前端展示给车主)',
handleInput: (newVal) => {
this.$refs.d2Form.formData.retailPrice = limitPrice(newVal, this.markOldVal.retailPrice, 6, 2)
this.markOldVal.retailPrice = this.$refs.d2Form.formData.retailPrice
}
}, { }, {
name: 'shopPrice', name: 'shopPrice',
label: '到店价', label: '到店价',
type: 'input', type: 'input',
unit: '元', unit: '元',
tips: '(商品最终交易价格)' tips: '(商品最终交易价格)',
handleInput: (newVal) => {
this.$refs.d2Form.formData.shopPrice = limitPrice(newVal, this.markOldVal.shopPrice, 6, 2)
this.markOldVal.shopPrice = this.$refs.d2Form.formData.shopPrice
}
}, { }, {
name: 'maxRetailDiscount', name: 'maxRetailDiscount',
label: '到店零售折扣', label: '到店零售折扣',
type: 'input', type: 'input',
unit: '折' unit: '折',
handleInput: (newVal) => {
this.$refs.d2Form.formData.maxRetailDiscount = limitPrice(newVal, this.markOldVal.maxRetailDiscount, 1, 1, 1)
this.markOldVal.maxRetailDiscount = this.$refs.d2Form.formData.maxRetailDiscount
}
}] }]
}, { }, {
title: '关联升级商品信息', title: '关联升级商品信息',
...@@ -103,7 +122,8 @@ export default { ...@@ -103,7 +122,8 @@ export default {
name: 'upgradeGoods', name: 'upgradeGoods',
label: '关联升级商品', label: '关联升级商品',
type: 'relatePro', type: 'relatePro',
optionValue: 'goodsCode' optionValue: 'goodsCode',
relateAttr: 'goodsCode'
}] }]
}, { }, {
title: '关联门店信息', title: '关联门店信息',
...@@ -125,6 +145,7 @@ export default { ...@@ -125,6 +145,7 @@ export default {
// console.log(this.editData) // console.log(this.editData)
// add - 新增;edit - 编辑 // add - 新增;edit - 编辑
this.addOrEdit = this.$route.params.addOrEdit this.addOrEdit = this.$route.params.addOrEdit
this.getGoodsList()
if (this.addOrEdit === 'edit') { if (this.addOrEdit === 'edit') {
getGoodsInfoById({ id: this.$route.params.row.id }).then(res => { getGoodsInfoById({ id: this.$route.params.row.id }).then(res => {
// console.log(res) // console.log(res)
...@@ -140,6 +161,7 @@ export default { ...@@ -140,6 +161,7 @@ export default {
shopPrice: res.shopPrice, shopPrice: res.shopPrice,
maxRetailDiscount: res.maxRetailDiscount, maxRetailDiscount: res.maxRetailDiscount,
upgradeGoods: res.upgradeGoodsList.map(item => { upgradeGoods: res.upgradeGoodsList.map(item => {
item['goodsName'] = item.goodsInfo.goodsName
item['thumbUrl'] = item.goodsInfo.thumbUrl item['thumbUrl'] = item.goodsInfo.thumbUrl
return item return item
}), }),
...@@ -152,7 +174,6 @@ export default { ...@@ -152,7 +174,6 @@ export default {
}) })
} else { } else {
this.editForm[0].formBlock[0].isDisabled = false this.editForm[0].formBlock[0].isDisabled = false
this.getGoodsListNoBase()
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
}) })
...@@ -162,10 +183,9 @@ export default { ...@@ -162,10 +183,9 @@ export default {
methods: { methods: {
...mapActions({ close: 'd2admin/page/close' }), ...mapActions({ close: 'd2admin/page/close' }),
// ...mapActions('d2admin/page', ['close']), // ...mapActions('d2admin/page', ['close']),
getGoodsListNoBase() { getGoodsList() {
getGoodsList({ // var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true }
exceptBase: true getGoodsList({}).then(res => {
}).then(res => {
// console.log(res) // console.log(res)
this.editForm[0].formBlock[0].optionList = res this.editForm[0].formBlock[0].optionList = res
}) })
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
addOrEdit="add" addOrEdit="add"
:originData="editData" :originData="editData"
:formList="editForm" :formList="editForm"
:formRef="proFormRef"
@handleAddConfirm="handleAddConfirm" @handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose" @handleClose="handleAddClose"
></d2-form> ></d2-form>
...@@ -27,8 +28,8 @@ export default { ...@@ -27,8 +28,8 @@ export default {
show: false, show: false,
addOrEdit: 'add', addOrEdit: 'add',
rules: { rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }], goodsName: [{ required: true, message: '请输入产品名称', trigger: 'change' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'blur' }], goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }],
// thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }], // thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }],
thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }], thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }],
goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'blur' }] goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'blur' }]
...@@ -49,6 +50,7 @@ export default { ...@@ -49,6 +50,7 @@ export default {
content: '' content: ''
}] }]
}, },
proFormRef: 'pro',
editForm: [{ editForm: [{
title: '产品基本信息', title: '产品基本信息',
formBlock: [{ formBlock: [{
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<el-form-item label="产品名称"> <el-form-item label="产品名称">
<el-input <el-input
v-model="searchForm.goodsName" v-model="searchForm.goodsName"
placeholder="请输入产品名称"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -163,11 +164,12 @@ export default { ...@@ -163,11 +164,12 @@ export default {
resolve() resolve()
}) })
}, },
handleSearch() {
console.log(this.searchForm)
},
handleReset() { handleReset() {
this.$refs.productTable.refreshTable() this.searchForm = {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
}
}, },
handleAdd(form) { handleAdd(form) {
// console.log(form) // console.log(form)
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
v-model="formLogin.userName" v-model="formLogin.userName"
placeholder="用户名" placeholder="用户名"
clearable clearable
maxlength="10"
v-focus v-focus
> >
<!-- <d2-el-icon <!-- <d2-el-icon
...@@ -65,7 +64,6 @@ ...@@ -65,7 +64,6 @@
v-model="formLogin.password" v-model="formLogin.password"
v-on:keyup.native.13="submit" v-on:keyup.native.13="submit"
clearable clearable
maxlength="12"
placeholder="密码" placeholder="密码"
> >
<!-- <d2-el-icon <!-- <d2-el-icon
...@@ -141,8 +139,7 @@ export default { ...@@ -141,8 +139,7 @@ export default {
required: true, required: true,
message: '请输入密码', message: '请输入密码',
trigger: 'submit' trigger: 'submit'
} }]
]
}) })
} }
}, },
......
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
label: '登录账户' label: '登录账户'
}, { }, {
name: 'loginPhone', name: 'loginPhone',
label: '登陆手机号' label: '登录手机号'
}, { }, {
name: 'merchantId', name: 'merchantId',
label: '商户号' label: '商户号'
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
label-width="85px" label-width="85px"
slot="header" slot="header"
> >
<el-form-item label="商品名称"> <el-form-item label="商户名称">
<el-input <el-input
v-model="searchForm.merchantName" v-model="searchForm.merchantName"
placeholder="请输入商户名称"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -192,7 +193,12 @@ export default { ...@@ -192,7 +193,12 @@ export default {
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
console.log(selectedData) console.log(selectedData)
if (!selectedData.length) { if (!selectedData.length) {
this.notice.warningTips('请选择关联门店') // this.notice.warningTips('请选择关联门店')
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true return true
} }
addServiceMerchant({ list: selectedData }).then(res => { addServiceMerchant({ list: selectedData }).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!