Commit c2dd634a by cwq0219

商品编辑

1 parent 9bb534b6
...@@ -65,4 +65,14 @@ const getZoneListApi = params => { ...@@ -65,4 +65,14 @@ const getZoneListApi = params => {
}) })
} }
export default { getMerchantGoodsListApi, getGoodsListApi, uploadImgApi, uploadVideoApi, getMerchantList, getZoneListApi } const getClassifyListApi = params => {
params.method = 'scrm.api.shopmall.classify.list.curMerchant'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getMerchantGoodsListApi, getGoodsListApi, uploadImgApi, uploadVideoApi, getMerchantList, getZoneListApi, getClassifyListApi }
...@@ -5,6 +5,22 @@ ...@@ -5,6 +5,22 @@
padding: 20px; padding: 20px;
} }
.marketing .wechat-container {
width: 375px;
margin-right: 45px;
background: #ffffff;
position: relative;
}
.marketing .wechat-container .w-100-per {
width: 100%;
}
.marketing .wechat-container .wechat-box {
width: 375px;
border: 1px solid #cecece;
// width: 100%;
border-radius: 2px;
}
.marketing .edit-container { .marketing .edit-container {
margin-bottom: 84px; margin-bottom: 84px;
} }
...@@ -61,6 +77,10 @@ ...@@ -61,6 +77,10 @@
margin-top: 10px; margin-top: 10px;
} }
.marketing .m-t-20 {
margin-top: 20px;
}
.marketing .footer { .marketing .footer {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
......
...@@ -282,10 +282,8 @@ export default { ...@@ -282,10 +282,8 @@ export default {
.home-set .container { .home-set .container {
padding: 30px; padding: 30px;
} }
.wechat-container { /* .wechat-container {
width: 375px; width: 375px;
/* height: 800px; */
/* margin: 30px 45px 0 60px; */
margin-right: 45px; margin-right: 45px;
background: #ffffff; background: #ffffff;
position: relative; position: relative;
...@@ -297,7 +295,7 @@ export default { ...@@ -297,7 +295,7 @@ export default {
border: 1px solid #cecece; border: 1px solid #cecece;
width: 100%; width: 100%;
border-radius: 2px; border-radius: 2px;
} } */
.home-set .banner-upload-box { .home-set .banner-upload-box {
width: 140px; width: 140px;
margin-bottom: 10px; margin-bottom: 10px;
......
...@@ -3,7 +3,117 @@ ...@@ -3,7 +3,117 @@
<div class="edit-share marketing"> <div class="edit-share marketing">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> <div class="flex m-t-20">
<div class="wechat-container">
<div class="wechat-box">
<img class="w-100-per" src="./images/pro-header.png">
<!-- <div class="home-banner wechant-conf-box home-bg" style="border: none;margin-top: 0;">
<ul ng-show="wechatImgList.length != 0" class="home-banner-box wechant-config" ng-style="{'width':wechatImgList.length * 100 + '%'}">
<li ng-repeat="item in wechatImgList" ng-show="item.content">
<video ng-show="item.resType == 3" class="videoUpload" ng-src="{{trustUrl(formData.goodsVideo)}}" controls="controls"></video>
<img ng-show="item.resType == 1" ng-src="{{item.content}}" />
</li>
</ul>
<img ng-show="(wechatImgList.length == 1 && !wechatImgList[0].content) || wechatImgList.length == 0 || !wechatImgList" style="width: 100%;height: 100%;" src="images/upload.png" alt="">
<ul class="indicator-dots-box align-center" ng-show="wechatImgList[0].length != 0 && wechatImgList.length != 1">
<li class="indicator-dots-box-radius" ng-show="item.content" ng-class="{'active':$index == 0}" ng-click="bannerClick($index, 0)" ng-repeat="item in wechatImgList"></li>
</ul>
</div> -->
<!-- <div class="wechat-box">
<span ng-show="!specificationDetailList.length">
<span class="price">¥{{formData.retailPrice}}</span>
</span>
<span ng-show="specificationDetailList.length">
<span class="price">¥{{minRetailPrice}}</span>
<span ng-show="specificationDetailList.length > 1">起</span>
</span>
<span class="old" ng-show="formData.originalPrice">{{formData.originalPrice}}</span>
<p class="good-name txt-ellipsis">{{formData.goodsName}}</p>
<p>
<span class="txt-tips">剩余:</span>
<span class="txt-tips" style="margin-left: 20px;">销售:0</span>
</p>
</div>
<div class="wechat-box">
<div class="line right-arrow" ng-if="nameToValSpecsList.length">
<span class="line-label">已选</span>
<span class="line-txt">{{nameToValSpecsList[0].specificationData}}</span>
</div>
<div class="line right-arrow" style="display: flex;">
<span class="line-label">配送</span>
<div>
<div style="height: 25px; line-height: 30px;" class="line-txt">填写地址</div>
<div style="height: 25px; line-height: 18px;" class="line-txt">支付后,预计48小时内发货</div>
</div>
</div>
<div class="line">
<span class="line-label">运费</span>
<span ng-show="formData.deliveryType == 1" class="line-txt">免运费</span>
<span ng-show="formData.deliveryType == 2" class="line-txt">{{formData.expressFee}}元</span>
</div>
</div>
<div class="wechat-box" style="margin-bottom: 0;">
<div style="word-wrap: break-word;">{{formData.describe}}</div>
<div ng-repeat="item in textAndput">
<img ng-show="item.content" ng-src="{{item.content}}">
</div>
</div> -->
</div>
</div>
<div class="home-set-form flex-grow">
<div v-for="(item, index) in externalFormList" :key="index">
<p class="edit-sub-title">{{ item.title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule">
<template slot="bannerBtn">
<el-button type="primary" @click="handleBannerAdd">新增banner</el-button>
</template>
<div :style="{ 'margin-left': labelWidth }" slot="bannerList" slot-scope="scope">
<div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex">
<!-- 上传图片 -->
<div class="banner-upload-box">
<div class="p-t-12">
<div class="flex">
<div v-show="!subItem.bannerImg" class="activity-img img-w-h" style="margin-bottom: 11px;">
<div class="add">+</div>
<span class="number">上传</span>
<input type="file" style="opacity: 0;" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, subIndex)" />
</div>
<div v-show="!subItem.bannerImg">
<el-button type="text" class="el-icon-delete" @click="handleBannerDelete(subIndex)"></el-button>
</div>
</div>
<span v-show="subItem.bannerImg" class="muti-imgs">
<img class="img-w-h" :src="subItem.bannerImg" />
<span class="img-btns">
<span class="btn-item">
<i class="el-icon-delete" @click="handleImgDelete(scope.scope.name, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.bannerImg)"></i>
</span>
</span>
</span>
</div>
<p class="edit-tips">支持上传10MB以内的jpg,png,jpeg图片</p>
</div>
<!-- 选择商品 -->
<div v-show="subItem.bannerImg" class="flex-grow">
<div>
<span>商品链接:</span>
<el-button v-show="!subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">选择</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">更换</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleProDelete(subIndex)">删除</el-button>
</div>
<div class="show-pro-box flex" v-if="subItem.goodsId">
<img class="img-60" :src="subItem.goods.goodsImage">
<p class="pro-txt flex-grow one-line-ellipsis">{{ subItem.goods.goodsName }}</p>
</div>
</div>
</div>
</div>
</glsx-combi-form>
</div>
</div>
<!-- <glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> -->
</div>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
...@@ -29,31 +139,40 @@ export default { ...@@ -29,31 +139,40 @@ export default {
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // 1-新增;2-编辑;3-查看
addOrEdit: 1, addOrEdit: 1,
// 1-集团;2-门店
groupOrStore: '',
id: '' id: ''
}, },
editForm: { editForm: {
// 专区类型(1发现频道,2商城专区) goodsName: '',
zoneType: '2', goodsImage: '',
zoneName: '', goodsDetailImageList: [],
zoneImg: '', goodsVideo: '',
merchantList: [] classifyIdList: [],
zoneId: ''
}, },
labelWidth: '110px',
externalFormList: [
{
title: '基本信息',
editChildRef: 'editProRef1',
editRule: { editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }], goodsName: [{ required: true, message: '请输入商品名称', trigger: 'change' }],
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }], goodsImage: [{ required: true, message: '请选择商品缩略图', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }] goodsDetailImageList: [{ required: true, message: '请选择商品详图', trigger: 'change' }],
zoneId: [{ required: true, message: '请选择关联专区', trigger: 'change' }]
}, },
editFormData: [ editFormData: [
{ {
label: '专区名称', label: '商品名称',
name: 'zoneName', name: 'goodsName',
width: '320px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20,
width: '320px'
}, },
{ {
label: '专区图片', label: '商品缩略图',
name: 'zoneImg', name: 'goodsImage',
type: 'upload', type: 'upload',
width: '320px', width: '320px',
limitSize: 10, limitSize: 10,
...@@ -63,23 +182,139 @@ export default { ...@@ -63,23 +182,139 @@ export default {
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] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name) this.$refs.editFormRef.$refs.editProRef1.validateField(targetItem.name)
})
}
},
{
label: '商品详图',
name: 'goodsDetailImageList',
type: 'upload',
width: '100%',
limitSize: 20,
maxPhotoNum: 10,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name].push({
content: res,
resType: 1,
bizType: 1
})
this.$refs.editFormRef.$refs.editProRef1.validateField(targetItem.name)
})
}
},
{
label: '商品视频',
name: 'goodsVideo',
type: 'upload',
uploadType: 'video',
limitSize: 50,
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm[targetItem.name] = res
}) })
} }
},
{
label: '商品分类',
name: 'classifyIdList',
type: 'select',
multiple: true,
width: '320px',
optionList: [],
optionId: 'id',
optionLabel: 'classifyName',
optionsName: 'classifyList'
},
{
label: '关联专区',
name: 'zoneId',
type: 'select',
width: '320px',
optionList: [],
optionId: 'id',
optionLabel: 'zoneName',
optionsName: 'zoneList'
}
]
},
{
title: 'Banner管理',
editFormData: [
{
label: 'banner图片',
addHtml: 'bannerBtn'
},
{
label: '',
name: 'bannerList',
addHtml: 'bannerList'
} }
] ]
},
{
title: '公告管理',
editFormData: [
{
label: '门店公告',
name: 'noticeContent',
type: 'input',
inputType: 'textarea',
width: '320px',
maxlength: '50'
}
]
},
{
title: '新车优惠政策',
editFormData: [
{
label: '优惠政策',
name: 'police',
type: 'input',
inputType: 'textarea',
width: '320px',
maxlength: '300'
}
]
}
],
baseData: {
classifyList: [],
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.getBaseDate().then(() => {
this.getOptionsList(0, 'editFormData', false)
})
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}, },
methods: { methods: {
getBaseDate() {
return new Promise(resolve => {
Promise.all([this.$apis.common.getClassifyListApi({}), this.$apis.common.getZoneListApi({ zoneType: 2, merchantId: this.userInfo.merchantId })]).then(([classify, zone]) => {
this.baseData.classifyList = classify
this.baseData.zoneList = zone
console.log(this.baseData)
resolve()
})
})
},
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
...@@ -90,6 +325,31 @@ export default { ...@@ -90,6 +325,31 @@ export default {
// }) // })
// }) // })
}, },
getOptionsList(idx, formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this.externalFormList[idx][formName].find(k => k.name == refreshSigle)
var index = this.externalFormList[idx][formName].findIndex(k => k.name == refreshSigle)
this.$set(this.externalFormList[idx][formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.externalFormList[idx][formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this.externalFormList[idx][formName][index].optionId] = ''
temp[this.externalFormList[idx][formName][index].optionLabel] = '全部'
this.externalFormList[idx][formName][index].optionList.unshift(temp)
}
} else {
this.externalFormList[idx][formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this.externalFormList[idx][formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.externalFormList[idx][formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this.externalFormList[idx][formName][index].optionId] = ''
temp[this.externalFormList[idx][formName][index].optionLabel] = '全部'
this.externalFormList[idx][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!