Commit d857e241 by cwq0219

验证+样式

1 parent e594ef08
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @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'
......
......@@ -98,9 +98,10 @@
>
<span>{{subItem.merchantName}}</span>
<span
class="icon-delete"
class="el-icon-delete"
style="margin-left: 20px;"
@click="handleDelete(item, subItem)"
>×</span>
></span>
</div>
</div>
<el-button @click="handleClick(item.handleName)">{{item.btnTxt}}</el-button>
......@@ -109,32 +110,36 @@
<div
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
style="margin-bottom: 20px;"
>
<p>
<span>{{subItem.goodsName}}&nbsp;</span>
<span>已配置建议升级价&nbsp;¥{{subItem.upgradePrice}}元</span>
<p class="pro-block">
<span class="pro-name">{{subItem.goodsName}}</span>
<span class="pro-price">已配置建议升级价&nbsp;¥{{subItem.upgradePrice}}元</span>
<el-button
type="text"
class="pro-btn"
@click="handleProChange(subItem, subIndex)"
>点击修改</el-button>
<span
class="icon-delete"
@click="handleDelete(item, subItem)"
>×</span>
class="el-icon-delete pro-delete"
@click="handleDelete(item, subItem, subIndex)"
></span>
</p>
<p>
<p class="pro-block">
<img
src="./image/relateIcon.png"
alt="关联"
/>
配置分账规则&nbsp;订单最大可分配比例
&nbsp;&nbsp;配置分账规则&nbsp;&nbsp;&nbsp;订单最大可分配比例
<el-input
class="pro-item"
v-model="subItem.profitValue"
@input="handleProfitInput(subItem.profitValue, subIndex)"
></el-input>%
<el-select
v-model="subItem.profitType"
size="small"
size="mini"
style="width: 85px; margin: 0 6px;"
>
<el-option
v-for="x in separateOpt"
......@@ -145,9 +150,14 @@
</el-select>分账
</p>
<p
v-show="!formData[item.name][subIndex].profitValue"
v-show="!subItem.profitValue"
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
label="配置分账规则订单最大可分配比例"
:prop="'formData.upgradeGoods' + subIndex + '.profitValue'"
......@@ -332,6 +342,7 @@ import relateProDialog from './relateProDialog'
import relateStoreDialog from './relateStoreDialog'
import { getGoodsList } from '@/api/commodity'
import { uploadImg } from '@/api/sys.base'
import { limitPrice } from '@/common/constants'
export default {
name: 'd2-form',
data() {
......@@ -351,7 +362,8 @@ export default {
}, {
confId: 2,
confLabel: '收入'
}]
}],
profitOldVal: []
}
},
......@@ -405,6 +417,9 @@ export default {
mounted() {
this.formData = _.cloneDeep(this.originData)
if (this.formData.hasOwnProperty('upgradeGoods')) {
this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue)
}
this.getGoodsList()
},
......@@ -475,8 +490,10 @@ export default {
} else {
proInfo = {
...proInfo,
profitType: 1
profitType: 1,
profitValue: '0'
}
this.profitOldVal.push('0')
this.formData.upgradeGoods.push(proInfo)
console.log(this.formData.upgradeGoods[this.proIndex])
this.judgeIsDisable()
......@@ -514,12 +531,15 @@ export default {
break
}
},
handleDelete(formItem, item) {
handleDelete(formItem, item, index) {
var formDataName = formItem.name
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr
// console.log(this.formData)
// console.log(formDataName)
if (formItem.name === 'upgradeGoods') {
this.profitOldVal.splice(index, 1)
}
this.judgeIsDisable()
},
// 图片
......@@ -564,6 +584,11 @@ export default {
this.lookImgVisible = true
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-文字
handleAddDesc(resType, targetItem) {
// console.log(this.formData[targetItem.name])
......@@ -598,12 +623,12 @@ export default {
if (valid) {
// const flag = true
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) {
// flag = false
return true
}
})
}
if (!this.formData.linkMerchantIds.length) {
// flag = false
return true
......@@ -660,8 +685,9 @@ export default {
cursor: pointer;
}
.d2-form .pro-item {
width: 50px;
width: 30px;
display: inline-block;
margin: 0 6px;
}
.d2-form .photo-top-tips {
height: 36px;
......@@ -757,6 +783,25 @@ export default {
.d2-form .desc-btns {
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 {
padding: 0 2px;
......
......@@ -163,6 +163,7 @@ export default {
upgradeGoods: res.upgradeGoodsList.map(item => {
item['goodsName'] = item.goodsInfo.goodsName
item['thumbUrl'] = item.goodsInfo.thumbUrl
item.profitValue = item.profitValue + ''
return item
}),
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!