Commit 1ea7e354 by 萱草

update: 礼品管理

parent 8bd0d381
......@@ -58,6 +58,10 @@ let realGift = {
getPickupList: '/pickup/get-pickup-list', // 获取自提点列表
getGiftShopList: '/gift/get-gift-shop-list', // 获取当前礼品的自提点
updateName: '/gift/update-name', // 修改礼品名称
virtualGiftUpload: {
url: '/gift/vir-gift-upload',
useFormData: true,
}, // 虚拟礼品卡密卡号上传
};
realGift = getFetch(realGift, welfarePrefix);
......
......@@ -22,8 +22,8 @@
<script>
// import request from '../service/request.js';
import api from '@/api/gift.js';
const { virtualCardList } = api;
// import api from '@/api/gift.js';
// const { virtualCardList } = api;
export default {
data() {
return {
......@@ -51,26 +51,27 @@ export default {
},
methods: {
getTableList(){
this.loading = true;
let params = {
id: '',
key: ''
};
virtualCardList(params).then(res =>{
console.log(res);
}).finally(() => this.loading = false);
console.log('查看内容');
// this.loading = true;
// let params = {
// id: '',
// key: ''
// };
// virtualCardList(params).then(res =>{
// console.log(res);
// }).finally(() => this.loading = false);
},
submitProNanme() {
this.dialogVisible = false;
// setInterval(() => {
// this.$emit('closeUpdateCost');
this.$emit('closeUploadDetail');
// }, 10);
},
// 取消修改
cancelSubmit() {
this.dialogVisible = false;
// setInterval(() => {
// this.$emit('closeUpdateCost');
this.$emit('closeUploadDetail');
// }, 10);
}
}
......
......@@ -335,9 +335,9 @@ export default {
checkList: [],
refundFlag: 0,
operatorAuth: '', // 操作人权限
shopCodeList: [],
deliveryType: [], // 配送方式 1物流发货 2门店自提 3文本券码
stockUseType: '', // 库存使用类型(0:占用,1:动态 , 2占用+动态)
shopCodeList: '', // 门店code
},
validateTime,
pickerOptions: {
......@@ -400,7 +400,7 @@ export default {
this.$emit('updateBread', this.bread);
this.$emit('showAside', true);
this.getLoginUser();
this.goodsType = this.$route.query.goodsType;
// this.goodsType = this.$route.query.goodsType;
this.giftId = this.$route.query.giftId;
// this.goodsId = this.$route.query.goodsId;
if (this.giftId) {
......@@ -528,6 +528,9 @@ export default {
this.goodsForm.spuList[0].costPrice = resResult.costPrice; // 成本价
this.goodsForm.spuList[0].stock = resResult.stock; // 库存
this.goodsForm.marketPrice = resResult.marketPrice; // 市场价
this.goodsForm.operatorAuth = resResult.operatorAuth; // 操作人权限
// this.goodsForm.shopCodeList = resResult.shopId; // 操作人权限code
this.goodsForm.checkList = resResult.stockUseType == 2 ? [ 1, 2 ] : (resResult.stockUseType == 1 ? [ 1 ] : [ 0 ]); // 库存消耗方式
let img = resResult.giftImages.split(',');
// this.goodsForm.giftImages = [];
if (img.length) {
......@@ -596,9 +599,9 @@ export default {
}).finally(() => this.$emit('updateLoading'));
console.log(222);
},
handleChangeRdio() {
this.goodsForm.spuList[0].stock = 0;
},
// handleChangeRdio() {
// this.goodsForm.spuList[0].stock = 0;
// },
// 上传前
beforeUpload(file) {
if (file.size > 2 * 1024 * 1024) {
......
......@@ -73,15 +73,19 @@
<el-form-item label="发货内容" required>
<template>
<div style="display:flex;">
<dm-editor width="500" height="300" :value="goodsForm.giftDescrption" @change="handleChange2"></dm-editor>
<dm-editor width="500" height="300" :value="goodsForm.template" @change="handleChange2" :readonly="readonly"></dm-editor>
<div class="ml20">
<p>用户申请履约后,发货内容将自动发送</p>
<p>第一步:编辑发货内容,变量使用大括号标记"{}"</p>
<p>第一步:保存内容,并下载模板。<el-button type="text">点击下载</el-button></p>
<p>第一步:编辑发货内容,变量使用大括号标记"{}"<el-button type="text" @click="generateTemplate">点击生成模板</el-button></p>
<p>第一步:保存内容,并下载模板。<el-button type="text" @click="downloadTemplate">点击下载</el-button></p>
<p>第一步:上传模板。</p>
<div class="upload-btn">
<el-upload class="upload-ele" show-file-list :action="uploadAction" :on-success="uploadFile" with-credentials>
<el-button><i class="el-icon-upload2" style="margin-right:5px"></i>点击上传</el-button>
<!-- <el-upload class="upload-ele" show-file-list :action="uploadAction" :on-success="uploadFile" :before-upload="beforeUpload" :on-change="uploadChange" with-credentials> -->
<el-upload class="upload-ele" :action="uploadAction" :show-file-list="false" :on-change="beforeUploadFile" with-credentials>
<!-- <div class="upload-ele"> -->
<el-button @click="templateUpload"><i class="el-icon-upload2" style="margin-right:5px"></i>点击上传</el-button>
<span>{{fileName}}</span>
<!-- </div> -->
</el-upload>
</div>
<div style="display:flex;justify-content:space-between;width:400px"><span>导入说明:</span><el-button type="text" @click="checkUploadDetail">查看内容</el-button></div>
......@@ -147,7 +151,8 @@ import { request } from '../../utils/request';
// import { deepClone } from '../../utils/index';
import api from '@/api/gift.js';
import uploadUrl from '@/api/common.js';
const { giftGet, giftUpdate, giftSave } = api;
const { giftGet, giftUpdate, giftSave, virtualGiftUpload } = api;
// const { giftGet, giftUpdate, giftSave } = api;
import checkUploadDetail from './module/check-upload-detail';
export default {
components: {
......@@ -193,16 +198,17 @@ export default {
checkList: [],
refundFlag: 0,
operatorAuth: '', // 操作人权限
shopCodeList: [],
deliveryType: [], // 配送方式 1物流发货 2门店自提 3文本券码
stockUseType: '', // 库存使用类型(0:占用,1:动态 , 2占用+动态)
shopCodeList: '', // 门店code
tableData: [
{
giftNo: '',
stock: undefined,
giftBarNo: ''
}
]
],
template: '',
},
goodsRules: {
giftName: [ { required: true, message: '请输入礼品名称', trigger: 'blur' } ],
......@@ -231,7 +237,10 @@ export default {
skuBarCode: ''
},
dialogVisible: false,
description: ''
description: '',
fileName: '',
readonly: false,
isSave: false
};
},
mounted() {
......@@ -239,7 +248,11 @@ export default {
this.$emit('showAside', true);
this.getLoginUser();
this.giftId = this.$route.query.giftId;
this.goodsForm.template = `示例1:<br>卡号:{01}<br>卡密:{02}<br><br>示例2:<br>点击卡密链接,使用星巴克电子券二维码直接在门店核销。
<br>{卡密链接}<br> 使用条款:<br>本电子代金券需一次性使用完毕,不可兑换现金,不找零,不与其他优惠同享。<br>
您可凭以上所示二维码在有效期内前往中国大陆地区星巴克门店购买商品`;
if (this.giftId) {
this.readonly = true;
this.bread[2].breadName = '编辑礼品';
this.getMess();
}
......@@ -252,9 +265,40 @@ export default {
checkUploadDetail(){
this.dialogVisible = true;
},
uploadFile(file){
closeUploadDetail(){
this.dialogVisible = false;
},
// uploadFile(file){
// console.log(file);
// },
beforeUploadFile(file, fileList){
console.log(file);
console.log(fileList);
this.fileName = file.name;
console.log(file.response);
let result = file.response.result;
console.log(result);
let fileUrl = result.url;
console.log(fileUrl);
let params = {
giftId: this.giftId,
file: fileUrl
};
virtualGiftUpload(params).then(res =>{
console.log(res);
});
},
// uploadChange(file){
// console.log(file);
// let params = {
// giftId: this.giftId,
// file: this.fileName
// };
// virtualGiftUpload(params).then(res =>{
// console.log(res);
// });
// },
// templateUpload(){},
// 表头添加必填标识符
starAdd(obj){
if(obj.column.label === '库存' || obj.column.label === '成本价(元)') {
......@@ -265,6 +309,7 @@ export default {
this.description = value;
console.log(this.goodsForm.giftDescrption);
},
// 保存发货内容 校验
saveDescription(){
console.log(this.description);
let index = this.description.indexOf('{'); // 字符出现的位置
......@@ -282,6 +327,7 @@ export default {
console.log(index - indexCopy == 1);
if(index - indexCopy == 1){
this.$message.error('{}不能嵌套出现');
this.isSave = false;
}
}
while(index2 !== -1) {
......@@ -292,8 +338,22 @@ export default {
console.log(num, num2);
if(num !== num2 || num > 3 || num2 > 3){
this.$message.error('请填写正确的格式');
this.isSave = false;
};
this.isSave = true;
},
// 生成模板
generateTemplate(){
if(this.isSave){
console.log('生成模板');
}else{
this.$message.error('请先保存发货内容');
}
},
// 下载模板
downloadTemplate(){
console.log('下载模板');
},
changeDelivery(value){
console.log(value);
},
......@@ -304,6 +364,7 @@ export default {
}else{
this.goodsForm.stockUseType = value[0];
};
console.log(value);
},
// 获取商户信息
getLoginUser(){
......@@ -396,10 +457,14 @@ export default {
let resResult = res.result;
this.goodsForm.changeDelivery = resResult.changeDelivery; // 兑换方式
this.goodsForm.giftName = resResult.giftName; // 礼品名称
this.goodsForm.tableData.giftNo = resResult.giftNo;
this.tableData.stock = resResult.stock;
this.tableData.giftBarNo = resResult.giftBarNo;
this.goodsForm.tableData[0].giftNo = resResult.giftNo;
this.goodsForm.tableData[0].stock = resResult.stock;
this.goodsForm.tableData[0].giftBarNo = resResult.giftBarNo;
this.goodsForm.marketPrice = resResult.marketPrice; // 市场价
this.goodsForm.operatorAuth = resResult.operatorAuth; // 操作人权限
// this.goodsForm.shopCodeList = resResult.shopId; // 操作人权限code
this.goodsForm.template = resResult.template; // 虚拟礼品模板
this.goodsForm.checkList = resResult.stockUseType == 2 ? [ 1, 2 ] : (resResult.stockUseType == 1 ? [ 1 ] : [ 0 ]); // 库存消耗方式
let img = resResult.giftImages.split(',');
// this.goodsForm.giftImages = [];
if (img.length) {
......@@ -478,7 +543,7 @@ export default {
this.$emit('updateLoading');
let params = {
// giftId: this.giftId,
giftType: 1, // 实物礼品
giftType: 2, // 实物礼品
// shopId: '', // 门店id
giftName: this.goodsForm.giftName, // 礼品名称
marketPrice: this.goodsForm.marketPrice, // 市场价
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment