Commit d857e241 by cwq0219

验证+样式

1 parent 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-18 15:19:52 * @Last Modified time: 2020-11-19 11:14:42
*/ */
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account' // import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
......
...@@ -98,9 +98,10 @@ ...@@ -98,9 +98,10 @@
> >
<span>{{subItem.merchantName}}</span> <span>{{subItem.merchantName}}</span>
<span <span
class="icon-delete" class="el-icon-delete"
style="margin-left: 20px;"
@click="handleDelete(item, subItem)" @click="handleDelete(item, subItem)"
>×</span> ></span>
</div> </div>
</div> </div>
<el-button @click="handleClick(item.handleName)">{{item.btnTxt}}</el-button> <el-button @click="handleClick(item.handleName)">{{item.btnTxt}}</el-button>
...@@ -109,32 +110,36 @@ ...@@ -109,32 +110,36 @@
<div <div
v-for="(subItem, subIndex) in formData[item.name]" v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex" :key="subIndex"
style="margin-bottom: 20px;"
> >
<p> <p class="pro-block">
<span>{{subItem.goodsName}}&nbsp;</span> <span class="pro-name">{{subItem.goodsName}}</span>
<span>已配置建议升级价&nbsp;¥{{subItem.upgradePrice}}元</span> <span class="pro-price">已配置建议升级价&nbsp;¥{{subItem.upgradePrice}}元</span>
<el-button <el-button
type="text" type="text"
class="pro-btn"
@click="handleProChange(subItem, subIndex)" @click="handleProChange(subItem, subIndex)"
>点击修改</el-button> >点击修改</el-button>
<span <span
class="icon-delete" class="el-icon-delete pro-delete"
@click="handleDelete(item, subItem)" @click="handleDelete(item, subItem, subIndex)"
>×</span> ></span>
</p> </p>
<p> <p class="pro-block">
<img <img
src="./image/relateIcon.png" src="./image/relateIcon.png"
alt="关联" alt="关联"
/> />
配置分账规则&nbsp;订单最大可分配比例 &nbsp;&nbsp;配置分账规则&nbsp;&nbsp;&nbsp;订单最大可分配比例
<el-input <el-input
class="pro-item" class="pro-item"
v-model="subItem.profitValue" v-model="subItem.profitValue"
@input="handleProfitInput(subItem.profitValue, subIndex)"
></el-input>% ></el-input>%
<el-select <el-select
v-model="subItem.profitType" v-model="subItem.profitType"
size="small" size="mini"
style="width: 85px; margin: 0 6px;"
> >
<el-option <el-option
v-for="x in separateOpt" v-for="x in separateOpt"
...@@ -145,9 +150,14 @@ ...@@ -145,9 +150,14 @@
</el-select>分账 </el-select>分账
</p> </p>
<p <p
v-show="!formData[item.name][subIndex].profitValue" v-show="!subItem.profitValue"
class="error" class="error"
>分账规则不能为空</p> >分账规则不能为空{{subItem.profitValue}}</p>
<!-- v-show="!(/^\d{0,2}$/.test(formData[item.name][subIndex].profitValue)) || (formData[item.name][subIndex].profitValue == 100)" -->
<!-- <p
v-show="formData[item.name][subIndex].profitValue && profitFlag[subIndex]"
class="error"
>请输入0-100整数的分账规则</p> -->
<!-- <el-form-item <!-- <el-form-item
label="配置分账规则订单最大可分配比例" label="配置分账规则订单最大可分配比例"
:prop="'formData.upgradeGoods' + subIndex + '.profitValue'" :prop="'formData.upgradeGoods' + subIndex + '.profitValue'"
...@@ -332,6 +342,7 @@ import relateProDialog from './relateProDialog' ...@@ -332,6 +342,7 @@ import relateProDialog from './relateProDialog'
import relateStoreDialog from './relateStoreDialog' import relateStoreDialog from './relateStoreDialog'
import { getGoodsList } from '@/api/commodity' import { getGoodsList } from '@/api/commodity'
import { uploadImg } from '@/api/sys.base' import { uploadImg } from '@/api/sys.base'
import { limitPrice } from '@/common/constants'
export default { export default {
name: 'd2-form', name: 'd2-form',
data() { data() {
...@@ -351,7 +362,8 @@ export default { ...@@ -351,7 +362,8 @@ export default {
}, { }, {
confId: 2, confId: 2,
confLabel: '收入' confLabel: '收入'
}] }],
profitOldVal: []
} }
}, },
...@@ -405,6 +417,9 @@ export default { ...@@ -405,6 +417,9 @@ export default {
mounted() { mounted() {
this.formData = _.cloneDeep(this.originData) this.formData = _.cloneDeep(this.originData)
if (this.formData.hasOwnProperty('upgradeGoods')) {
this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue)
}
this.getGoodsList() this.getGoodsList()
}, },
...@@ -475,8 +490,10 @@ export default { ...@@ -475,8 +490,10 @@ export default {
} else { } else {
proInfo = { proInfo = {
...proInfo, ...proInfo,
profitType: 1 profitType: 1,
profitValue: '0'
} }
this.profitOldVal.push('0')
this.formData.upgradeGoods.push(proInfo) this.formData.upgradeGoods.push(proInfo)
console.log(this.formData.upgradeGoods[this.proIndex]) console.log(this.formData.upgradeGoods[this.proIndex])
this.judgeIsDisable() this.judgeIsDisable()
...@@ -514,12 +531,15 @@ export default { ...@@ -514,12 +531,15 @@ export default {
break break
} }
}, },
handleDelete(formItem, item) { handleDelete(formItem, item, index) {
var formDataName = formItem.name var formDataName = formItem.name
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue]) var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr this.formData[formDataName] = filterArr
// console.log(this.formData) // console.log(this.formData)
// console.log(formDataName) // console.log(formDataName)
if (formItem.name === 'upgradeGoods') {
this.profitOldVal.splice(index, 1)
}
this.judgeIsDisable() this.judgeIsDisable()
}, },
// 图片 // 图片
...@@ -564,6 +584,11 @@ export default { ...@@ -564,6 +584,11 @@ export default {
this.lookImgVisible = true this.lookImgVisible = true
this.imageUrl = src this.imageUrl = src
}, },
// 验证分账比例
handleProfitInput(value, index) {
this.formData.upgradeGoods[index].profitValue = limitPrice(value, this.profitOldVal[index], 3, 0, 0, 100)
this.profitOldVal[index] = this.formData.upgradeGoods[index].profitValue
},
// 描述 1-图片;2-文字 // 描述 1-图片;2-文字
handleAddDesc(resType, targetItem) { handleAddDesc(resType, targetItem) {
// console.log(this.formData[targetItem.name]) // console.log(this.formData[targetItem.name])
...@@ -598,12 +623,12 @@ export default { ...@@ -598,12 +623,12 @@ export default {
if (valid) { if (valid) {
// const flag = true // const flag = true
if (this.formData.hasOwnProperty('upgradeGoods')) { if (this.formData.hasOwnProperty('upgradeGoods')) {
this.formData.upgradeGoods.forEach(item => { for (var i in this.formData.upgradeGoods) {
const item = this.formData.upgradeGoods[i]
if (!item.profitValue) { if (!item.profitValue) {
// flag = false
return true return true
} }
}) }
if (!this.formData.linkMerchantIds.length) { if (!this.formData.linkMerchantIds.length) {
// flag = false // flag = false
return true return true
...@@ -660,8 +685,9 @@ export default { ...@@ -660,8 +685,9 @@ export default {
cursor: pointer; cursor: pointer;
} }
.d2-form .pro-item { .d2-form .pro-item {
width: 50px; width: 30px;
display: inline-block; display: inline-block;
margin: 0 6px;
} }
.d2-form .photo-top-tips { .d2-form .photo-top-tips {
height: 36px; height: 36px;
...@@ -757,6 +783,25 @@ export default { ...@@ -757,6 +783,25 @@ export default {
.d2-form .desc-btns { .d2-form .desc-btns {
margin-bottom: 6px; margin-bottom: 6px;
} }
.d2-form .pro-block {
height: 35px;
margin: 4px 0;
}
.d2-form .pro-block img {
vertical-align: text-bottom;
width: 20px;
}
.d2-form .pro-name {
}
.d2-form .pro-price {
margin: 0 10px;
}
.d2-form .pro-btn {
}
.d2-form .pro-delete {
float: right;
padding-top: 8px;
}
.d2-form .pro-item.el-input--medium .el-input__inner, .d2-form .pro-item.el-input--medium .el-input__inner,
.d2-form .pro-item .el-input--medium .el-input__inner { .d2-form .pro-item .el-input--medium .el-input__inner {
padding: 0 2px; padding: 0 2px;
......
...@@ -163,6 +163,7 @@ export default { ...@@ -163,6 +163,7 @@ export default {
upgradeGoods: res.upgradeGoodsList.map(item => { upgradeGoods: res.upgradeGoodsList.map(item => {
item['goodsName'] = item.goodsInfo.goodsName item['goodsName'] = item.goodsInfo.goodsName
item['thumbUrl'] = item.goodsInfo.thumbUrl item['thumbUrl'] = item.goodsInfo.thumbUrl
item.profitValue = item.profitValue + ''
return item return item
}), }),
linkMerchantIds: res.merchantRefList.length ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : [] linkMerchantIds: res.merchantRefList.length ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : []
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!