Commit d1381c1e by cwq0219

晒单

1 parent 1744f15f
...@@ -44,14 +44,14 @@ const getMerchantList = params => { ...@@ -44,14 +44,14 @@ const getMerchantList = params => {
}) })
} }
// const getZoneList = params => { const getZoneListApi = params => {
// params.method = `${defaultPath}get.zone.list` params.method = 'scrm.api.shopmall.zoneInfo.listCurMerchantId'
// return http({ return http({
// url: 'rop-scrm-live/router', url: 'rop-scrm-shopmall/router',
// method: 'POST', method: 'POST',
// data: params, data: params,
// sign: true sign: true
// }) })
// } }
export default { getMerchantGoodsListApi, getGoodsListApi, uploadImgApi, getMerchantList } export default { getMerchantGoodsListApi, getGoodsListApi, uploadImgApi, getMerchantList, getZoneListApi }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</span> </span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot> <slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<div v-else-if="item.type === 'input'"> <div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)"></el-input> <el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)"></el-input>
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
</div> </div>
<!-- 选择-输入框 --> <!-- 选择-输入框 -->
...@@ -64,11 +64,11 @@ ...@@ -64,11 +64,11 @@
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]"> <div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]">
<span v-if="Array.isArray(formObj[item.name])"> <span v-if="Array.isArray(formObj[item.name])">
<span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h"> <span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h">
<img class="img-w-h" :src="subItem.content" /> <img class="img-w-h" :src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns"> <span class="img-btns">
<span class="btn-item"> <span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i> <i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.content)"></i> <i class="el-icon-zoom-in" @click="handleImgLook(typeof subItem == 'object' ? subItem.content : subItem)"></i>
</span> </span>
</span> </span>
</span> </span>
...@@ -193,7 +193,6 @@ export default { ...@@ -193,7 +193,6 @@ export default {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素') this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else { } else {
targetItem.handleUpload(e, file, targetItem) targetItem.handleUpload(e, file, targetItem)
// this.$emit('handleUpload', { e: e, file: file, targetItem: targetItem })
} }
} }
} }
......
...@@ -32,64 +32,112 @@ export default { ...@@ -32,64 +32,112 @@ export default {
id: '' id: ''
}, },
editForm: { editForm: {
// 专区类型(1发现频道,2商城专区) imgUrls: [],
zoneType: '2', shareContent: ''
zoneName: '',
zoneImg: '',
merchantList: []
}, },
editRule: { editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }], shareContent: [{ required: true, message: '请输入专区名称', trigger: 'change' }],
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }], zoneId: [{ required: true, message: '请选择发现频道', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }] imgUrls: [{ required: true, message: '请上传照片', trigger: 'change' }]
}, },
editFormData: [ editFormData: [
{ {
label: '专区名称', label: '照片上传',
name: 'zoneName', name: 'imgUrls',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '专区图片',
name: 'zoneImg',
type: 'upload', type: 'upload',
width: '320px', width: '320px',
limitSize: 10, limitSize: 10,
maxPhotoNum: 1, maxPhotoNum: 8,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => { this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res this.editForm[targetItem.name].push(res)
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name) this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
}) })
} }
},
{
label: '发现频道选择',
name: 'zoneId',
type: 'select',
width: '320px',
optionList: [],
optionId: 'id',
optionLabel: 'zoneName',
optionsName: 'zoneList'
},
{
label: '种草心得',
name: 'shareContent',
width: '320px',
type: 'input',
inputType: 'textarea',
rows: 5,
// showLimit: true,
maxlength: 200
} }
] ],
baseData: {
zoneList: []
}
} }
}, },
mounted() { mounted() {
this.userInfo = this.$globalState.session
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit] this.title = this.titleObj[this.routeInfo.addOrEdit]
this.getZoneList()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}, },
methods: { methods: {
getZoneList() {
this.$apis.common.getZoneListApi({ zoneType: 1, merchantId: this.userInfo.merchantId }).then(res => {
this.baseData.zoneList = res
this.getOptionsList('editFormData', false, 'zoneId')
})
},
getInfo() { getInfo() {
this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm.zoneName = res.zoneName // this.editForm.zoneName = res.zoneName
this.editForm.zoneImg = res.zoneImg // this.editForm.zoneImg = res.zoneImg
this.editForm.merchantList = res.merchantRefList // this.editForm.merchantList = res.merchantRefList
this.editForm.merchantList.forEach(item => { // this.editForm.merchantList.forEach(item => {
item.merchantNo = item.merchantId // item.merchantNo = item.merchantId
}) // })
}) })
}, },
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleConfirm() { handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!