Commit f891d994 by chenwq

feat(util): 添加手机号验证和输入验证工具函数

feat(订单管理): 为快递单号和手机号添加表单验证规则
fix(商品管理): 修正运费输入限制和规格值数量限制
refactor(商品选择组件): 优化多选商品逻辑并添加数量限制
1 parent 8bb87fee
...@@ -134,6 +134,10 @@ export default { ...@@ -134,6 +134,10 @@ export default {
resolve() resolve()
}) })
}, },
setTableFinishFun() {
this.recoverySelected()
},
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) { if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle) var item = this[formName].find(k => k.name == refreshSigle)
...@@ -174,12 +178,17 @@ export default { ...@@ -174,12 +178,17 @@ export default {
recoverySelected() { recoverySelected() {
if (this.selectedProList.length) { if (this.selectedProList.length) {
this.selectedProList.forEach(row => { this.selectedProList.forEach(row => {
this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row) const obj = this.productList.find(item => item.id == row.id)
this.$refs.tableRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row, true)
}) })
} }
}, },
handleMutiSelectConfirm() { handleMutiSelectConfirm() {
var selectedData = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] var selectedData = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName]
if(selectedData && selectedData.length > 10) {
this.$message.error('最多选择10件商品')
return true
}
this.$emit('handleMutiSelectConfirm', selectedData) this.$emit('handleMutiSelectConfirm', selectedData)
}, },
handleMutiSelectClose() { handleMutiSelectClose() {
......
...@@ -86,4 +86,12 @@ util.transfStatus = function(payStatus, orderStatus, goodsSource) { ...@@ -86,4 +86,12 @@ util.transfStatus = function(payStatus, orderStatus, goodsSource) {
return { name: '售后/退款', color: '#EB4E4E' } return { name: '售后/退款', color: '#EB4E4E' }
} }
} }
util.checkPhone = function(mobile) {
const myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return myreg.test(mobile)
}
util.validationInput = function(str) {
const reg = /[^\w\.\/]/gi // eslint-disable-line
return reg.test(str)
}
export default util export default util
...@@ -245,7 +245,17 @@ export default { ...@@ -245,7 +245,17 @@ export default {
batchForm: {}, batchForm: {},
batchEditRules: { batchEditRules: {
expressName: [{ required: true, message: '请输入快递公司', trigger: 'change' }], expressName: [{ required: true, message: '请输入快递公司', trigger: 'change' }],
expressNo: [{ required: true, message: '请输入快递单号', trigger: 'change' }] expressNo: [
{ required: true, message: '请输入快递单号', trigger: 'change' },
{
validator: (rule, value, callback) => {
if (util.validationInput(value)) {
callback(new Error('请输入正确的快递单号'))
return false
}
callback()
}, trigger: 'change'
}]
}, },
batchEditForm: [ batchEditForm: [
{ {
......
...@@ -351,6 +351,12 @@ export default { ...@@ -351,6 +351,12 @@ export default {
// 商品选择-start // 商品选择-start
handleMutiProClose(targetItem) { handleMutiProClose(targetItem) {
this.selectedProList = this.$common.utils.deepClone(this.editForm.specialEvents[this.bannerIdx].specialEventGoodsList) this.selectedProList = this.$common.utils.deepClone(this.editForm.specialEvents[this.bannerIdx].specialEventGoodsList)
this.selectedProList.forEach((item, idx) => {
if (!item.id) {
this.selectedProList[idx].id = item.goodsId
}
})
console.log(this.selectedProList, 'this.selectedProList----')
this.handleMutiSelectClose() this.handleMutiSelectClose()
}, },
handleMutiSelectClose() { handleMutiSelectClose() {
......
...@@ -524,7 +524,7 @@ export default { ...@@ -524,7 +524,7 @@ export default {
}, },
// 运费 // 运费
'editForm.expressFee'(newValue, oldValue) { 'editForm.expressFee'(newValue, oldValue) {
this.editForm.expressFee = limitPrice(newValue, oldValue, 5, 2, 0, 100000) this.editForm.expressFee = limitPrice(newValue, oldValue, 5, 0, 0, 100000)
} }
}, },
...@@ -726,9 +726,9 @@ export default { ...@@ -726,9 +726,9 @@ export default {
handleInputConfirm() { handleInputConfirm() {
let spescInputVal = this.spescInputVal let spescInputVal = this.spescInputVal
if (this.spescEditForm.platformSpecificationValueList.length == 20) { if (this.spescEditForm.platformSpecificationValueList.length == 10) {
this.$message({ this.$message({
message: '规格值最多不能超过20个', message: '规格值最多不能超过10个',
type: 'error', type: 'error',
customClass: 'message-Z-zinde' customClass: 'message-Z-zinde'
}) })
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'setPriceDialog', name: 'setPriceDialog',
props: { props: {
...@@ -45,6 +46,11 @@ export default { ...@@ -45,6 +46,11 @@ export default {
batchPrice: this.isConversionRate ? this.echoParams.salePrice : '', batchPrice: this.isConversionRate ? this.echoParams.salePrice : '',
} }
}, },
watch: {
batchCount(newValue, oldValue) {
this.batchCount = limitPrice(newValue, oldValue, 4, 0, 0, 1000)
}
},
methods: { methods: {
confirmPriceChange() { confirmPriceChange() {
......
...@@ -290,7 +290,18 @@ export default { ...@@ -290,7 +290,18 @@ export default {
batchForm: {}, batchForm: {},
batchEditRules: { batchEditRules: {
receiver: [{ required: true, message: '请输入联系人', trigger: 'change' }], receiver: [{ required: true, message: '请输入联系人', trigger: 'change' }],
phone: [{ required: true, message: '请输入手机号', trigger: 'change' }], phone: [
{ required: true, message: '请输入手机号', trigger: 'change' },
{
validator: (rule, value, callback) => {
if (!util.checkPhone(value)) {
callback(new Error('请输入正确的手机号码'))
return false
}
callback()
}, trigger: 'change'
}
],
address: [{ required: true, message: '请输入退款地址', trigger: 'change' }] address: [{ required: true, message: '请输入退款地址', trigger: 'change' }]
}, },
batchEditForm: [], batchEditForm: [],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!