Commit 680b44a7 authored by xieyishang's avatar xieyishang

~~

parent 59085910
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"name" : "鹿马商家助手", "name" : "鹿马商家助手",
"appid" : "__UNI__1EA80F1", //这个是 web "appid" : "__UNI__1EA80F1", //这个是 web
"description" : "商家", "description" : "商家",
"versionName" : "1.197", "versionName" : "1.199",
"versionCode" : 1197, "versionCode" : 1199,
"transformPx" : false, "transformPx" : false,
"compatible" : { "compatible" : {
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持 "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
......
...@@ -3,56 +3,61 @@ ...@@ -3,56 +3,61 @@
<!-- 卡券 --> <!-- 卡券 -->
<view class="CardSend yicode"> <view class="CardSend yicode">
<view class="cardhead flex ali-c "> <view class="cardhead flex ali-c ">
<view class="tabitems flex1" :class="{active:tabactive==1}" @tap="taggleTab(1)" > <view class="tabitems flex1" :class="{active:tabactive==1}" @tap="taggleTab(1)">
<view class="titles">卡券发放</view> <view class="titles">卡券发放</view>
</view> </view>
<view class="tabitems flex1 " :class="{active:tabactive==2}" @tap="taggleTab(2)" > <view class="tabitems flex1 " :class="{active:tabactive==2}" @tap="taggleTab(2)">
<view class="titles ">已发卡券</view> <view class="titles ">已发卡券</view>
</view> </view>
</view> </view>
<!-- tab切换 --> <!-- tab切换 -->
<!-- 卡券发放 --> <!-- 卡券发放 -->
<view class="mainboxs" v-show="tabactive==1 && showshare==false"> <view class="mainboxs" v-show="tabactive==1 && showshare==false">
<!-- 输入框列表 --> <!-- 输入框列表 -->
<view class="inoutlist"> <view class="inoutlist">
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">优惠券名称</view> <view class="names">优惠券名称</view>
<input type="text" placeholder="请填写优惠券名称" v-model="parameter.coupon_name" class="inputs" placeholder-class="plclass" > <input type="text" placeholder="请填写优惠券名称" v-model="parameter.coupon_name" class="inputs"
placeholder-class="plclass">
</view> </view>
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">优惠金额</view> <view class="names">优惠金额</view>
<input type="number" placeholder="请填写优惠金额" v-model="parameter.money" class="inputs" placeholder-class="plclass" > <input type="number" placeholder="请填写优惠金额" v-model="parameter.money" class="inputs"
placeholder-class="plclass">
</view> </view>
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">每人最大领取数</view> <view class="names">每人最大领取数</view>
<input type="number" placeholder="请填写领取数 " v-model="parameter.max_fetch" class="inputs" placeholder-class="plclass" > <input type="number" placeholder="请填写领取数 " v-model="parameter.max_fetch" class="inputs"
placeholder-class="plclass">
</view> </view>
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">满多少元可以使用</view> <view class="names">满多少元可以使用</view>
<input type="number" placeholder="请填写满多少元可以使用" v-model="parameter.at_least" class="inputs" placeholder-class="plclass"> <input type="number" placeholder="请填写满多少元可以使用" v-model="parameter.at_least" class="inputs"
placeholder-class="plclass">
</view> </view>
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">发放数量</view> <view class="names">发放数量</view>
<input type="number" placeholder="请填写发放的数量" v-model="parameter.count" class="inputs" placeholder-class="plclass"> <input type="number" placeholder="请填写发放的数量" v-model="parameter.count" class="inputs"
placeholder-class="plclass">
</view> </view>
</view> </view>
<!-- 第一块结束 --> <!-- 第一块结束 -->
<!-- 发放范围 --> <!-- 发放范围 -->
<view class="Range Range1"> <view class="Range Range1">
<view class="title">发放范围</view> <view class="title">发放范围</view>
<view class="chilidlist flex"> <view class="chilidlist flex">
<radio-group class="flex ali-c jus-b chilidlistbox" @change="radioChange"> <radio-group class="flex ali-c jus-b chilidlistbox" @change="radioChange">
<label class="flex ali-c" > <label class="flex ali-c">
<view> <view>
<radio color="#FF6900" value="1" :checked="parameter.give_type==1" /> <radio color="#FF6900" value="1" :checked="parameter.give_type==1" />
</view> </view>
...@@ -77,9 +82,9 @@ ...@@ -77,9 +82,9 @@
<view class="title" @tap="togglePopup">参与商品</view> <view class="title" @tap="togglePopup">参与商品</view>
<view class="chilidlist flex"> <view class="chilidlist flex">
<radio-group class="flex ali-c chilidlistbox" @change="radioChange1"> <radio-group class="flex ali-c chilidlistbox" @change="radioChange1">
<label class="flex ali-c mr_130" > <label class="flex ali-c mr_130">
<view> <view>
<radio color="#FF6900" value="1" :checked="parameter.range_type==1" /> <radio color="#FF6900" value="1" :checked="parameter.range_type==1" />
</view> </view>
<view class="itemname">全部商品</view> <view class="itemname">全部商品</view>
</label> </label>
...@@ -93,7 +98,7 @@ ...@@ -93,7 +98,7 @@
</view> </view>
</view> </view>
<!-- 单选endn --> <!-- 单选endn -->
<!-- //表单提交的参数 <!-- //表单提交的参数
parameter:{ parameter:{
at_least: "10",//满多少可以用 at_least: "10",//满多少可以用
...@@ -107,32 +112,37 @@ ...@@ -107,32 +112,37 @@
money: "9.9",//金额 money: "9.9",//金额
range_type: "0",//参与的商品 1全部 0部分 range_type: "0",//参与的商品 1全部 0部分
}--> }-->
<!-- timebox 时间选择 --> <!-- timebox 时间选择 -->
<view class="timeboxs flex ali-c"> <view class="timeboxs flex ali-c">
<view class="title">发放时间</view> <view class="title">发放时间</view>
<view class="inputbox" @tap="showtime(1)"> <view class="inputbox" @tap="showtime(1)">
<input type="text" class="inputs" value="" v-model="parameter.start_time" disabled="disabled" placeholder="投放时间" placeholder-class="plclass" /> <input type="text" class="inputs" value="" v-model="parameter.start_time" disabled="disabled"
<image class="jiantouicon" v-show="parameter.start_time==''" src="/static/news/xiamassfd.png" mode=""></image> placeholder="投放时间" placeholder-class="plclass" />
<image class="jiantouicon" v-show="parameter.start_time==''" src="/static/news/xiamassfd.png"
mode=""></image>
</view> </view>
<view style="margin-left: 10;">-</view> <view style="margin-left: 10;">-</view>
<view class="inputbox" style="margin-left: 0;" @tap="showtime(2)"> <view class="inputbox" style="margin-left: 0;" @tap="showtime(2)">
<input type="text" class="inputs" value="" v-model="parameter.end_time" disabled="disabled" placeholder="到期时间" placeholder-class="plclass" /> <input type="text" class="inputs" value="" v-model="parameter.end_time" disabled="disabled"
<image class="jiantouicon" v-show="parameter.start_time==''" src="/static/news/xiamassfd.png" mode=""></image> placeholder="到期时间" placeholder-class="plclass" />
<image class="jiantouicon" v-show="parameter.start_time==''" src="/static/news/xiamassfd.png"
mode=""></image>
</view> </view>
</view>
<view class="submitbtns flexc" v-show="!parameter.id" :class="{active:istruesub}" @tap="coupons">确定发放</view>
<view class="submitbtns flexc" v-show="parameter.id" :class="{active:istruesub}" @tap="coupons">编辑提交</view>
<view class="submitbtns flexc" v-show="parameter.id" :class="{active:istruesub}" @tap="colesedit">取消编辑
</view> </view>
<view class="submitbtns flexc" v-show="!parameter.id" :class="{active:istruesub}" @tap="coupons" >确定发放</view>
<view class="submitbtns flexc" v-show="parameter.id" :class="{active:istruesub}" @tap="coupons" >编辑提交</view>
<view class="submitbtns flexc" v-show="parameter.id" :class="{active:istruesub}" @tap="colesedit" >取消编辑</view>
</view> </view>
<!-- 已发卡券 --> <!-- 已发卡券 -->
<view class="yfcardlist" v-show="tabactive==2"> <view class="yfcardlist" v-show="tabactive==2">
<view class="yfcardItem flex" v-for="(item,index) in cardlist" :key="index"> <view class="yfcardItem flex" v-for="(item,index) in cardlist" :key="index">
<view class="cardleft"> <view class="cardleft">
<view class="kaiguanbox flex jus-b ali-c"> <view class="kaiguanbox flex jus-b ali-c">
...@@ -141,48 +151,50 @@ ...@@ -141,48 +151,50 @@
<view class="status">当前状态:{{item.status==0?'投放中':'未投放'}}</view> <view class="status">当前状态:{{item.status==0?'投放中':'未投放'}}</view>
</view> </view>
<view class="kaiguan flex ali-c"> <view class="kaiguan flex ali-c">
<view class="kai kgitem flexc" @tap="switch_couponsFun(item,2,index)" :class="{active:item.status==0}">开启</view> <view class="kai kgitem flexc" @tap="switch_couponsFun(item,2,index)"
<view class="kai kgitem flexc" @tap="switch_couponsFun(item,0,index)" :class="{active:item.status==2}">关闭</view> :class="{active:item.status==0}">开启</view>
<view class="kai kgitem flexc" @tap="switch_couponsFun(item,0,index)"
:class="{active:item.status==2}">关闭</view>
</view> </view>
</view> </view>
<view class="quaninfos"> <view class="quaninfos">
<view class="text">每人领取{{item.max_fetch}} 发放{{item.count}} 已领取{{item.get_num}}</view> <view class="text">每人领取{{item.max_fetch}}发放{{item.count}} 已领取{{item.get_num}}</view>
<view class="text">发放范围 <view class="text">发放范围
<text class="ml-10 mr-10" v-if="item.give_type==3">全网</text> <text class="ml-10 mr-10" v-if="item.give_type==3">全网</text>
<text class="ml-10 mr-10" v-else-if="item.give_type==2">本地区</text> <text class="ml-10 mr-10" v-else-if="item.give_type==2">本地区</text>
<text class="ml-10 mr-10" v-else>本店</text> <text class="ml-10 mr-10" v-else>本店</text>
参与商品 <text class="ml-10 mr-10" v-if="item.range_type==1">全部</text> 参与商品 <text class="ml-10 mr-10" v-if="item.range_type==1">全部</text>
<text class="ml-10 mr-10" v-else>部分商品</text> <text class="ml-10 mr-10" v-else>部分商品</text>
{{item.at_least}}元使用 {{item.at_least}}元使用
</view> </view>
<view class="text flex ali-c jus-b"> <view class="text flex ali-c jus-b">
<text>有效期:{{item.start_time}}{{item.end_time}}</text> <text>有效期:{{item.start_time}}{{item.end_time}}</text>
<!-- <text v-if="item.get_num==0" class="bj pr-10" @tap="detailsFun(item)">编辑</text> --> <!-- <text v-if="item.get_num==0" class="bj pr-10" @tap="detailsFun(item)">编辑</text> -->
</view> </view>
</view> </view>
</view> </view>
<view class="cardright flexc"> <view class="cardright flexc">
<view> <view>
<text class="bj pr-10" @tap="detailsFun(item)">编辑</text> <text class="bj pr-10" style="color:#2196F3;" @tap="detailsFun(item)">编辑</text>
<view class="text">优惠</view> <view class="text">优惠</view>
<view class="prcie mb-20">{{item.money}}</view> <view class="prcie mb-20">{{item.money}}</view>
<text class="bj pr-10" @tap="deleteFun(item)">删除</text> <text class="bj pr-10" style="color:#2196F3;" @tap="deleteFun(item)">删除</text>
</view> </view>
</view> </view>
</view> </view>
<empty v-if="cardlist.length==0"></empty> <empty v-if="cardlist.length==0"></empty>
</view> </view>
<!-- 选择参与活动的商品的弹出 --> <!-- 选择参与活动的商品的弹出 -->
<!-- 底部分享弹窗 --> <!-- 底部分享弹窗 -->
<uni-popup :show="showshare" style="z-index: 99;" :type="type" @change="change"> <uni-popup :show="showshare" style="z-index: 99;" :type="type" @change="change">
...@@ -192,370 +204,360 @@ ...@@ -192,370 +204,360 @@
<view class="title">选择参与优惠的商品</view> <view class="title">选择参与优惠的商品</view>
<image class="imgs" @tap="showshare=false" src="/static/news/plicons.png" mode=""></image> <image class="imgs" @tap="showshare=false" src="/static/news/plicons.png" mode=""></image>
</view> </view>
<input class="sousuo" @input="onKeyInput" placeholder="请输入搜索内容" /> <input class="sousuo" @input="onKeyInput" placeholder="请输入搜索内容" />
</view> </view>
<!-- scroll scroll-left="120" --> <!-- scroll scroll-left="120" -->
<!-- @scroll="" --> <!-- @scroll="" -->
<scroll-view class="scroll-view_H" style="height: 50vh;" scroll-y="true" > <scroll-view class="scroll-view_H" style="height: 50vh;" scroll-y="true">
<view class="chindlist "> <view class="chindlist ">
<radio-group class="flex ali-c flex-wrap chilidlistbox" @change="radioChange2" v-model="parameter.goods_id"> <!-- v-model="parameter.goods_id" -->
<checkbox-group class="flex ali-c flex-wrap chilidlistbox" @change="radioChange2">
<label class="flex ali-c jus-b itemlable" v-for="(item,index) in shoplist" :key="index"> <label class="flex ali-c jus-b itemlable" v-for="(item,index) in shoplist" :key="index">
<view class="itemname">{{item.product_name}}</view> <view class="itemname">{{item.product_name}}</view>
<view class="checkbox"> <view class="checkbox">
<radio color="#FF6900" @change="radioChange2" :value="item.product_id" :checked="item.checked" /> <!-- <radio color="#FF6900" @change="radioChange2" :value="item.product_id" :checked="item.checked" /> -->
<!-- :value="item.product_id" :checked="item.checked" -->
<!-- @change="radioChange2" -->
<checkbox color="#FF6900" :value="item.product_id" :checked="item.checked" />
</view> </view>
</label> </label>
</radio-group> </checkbox-group>
<view class="xiayiye title" @tap="nextPage" v-if="xianshi" >下一页>>></view> <view class="xiayiye title" @tap="nextPage" v-if="xianshi">下一页>>></view>
<view class="xiayiye title" @tap="nextPage" v-else >没有更多了~</view> <view class="xiayiye title" @tap="nextPage" v-else>没有更多了~</view>
</view> </view>
</scroll-view> </scroll-view>
<view class="submitbtns active" @tap="showshare=false" >确定</view> <view class="submitbtns active" @tap="showshare=false">确定</view>
<!-- 提交确认 --> <!-- 提交确认 -->
</view> </view>
</uni-popup> </uni-popup>
<!-- 时间弹窗 --> <!-- 时间弹窗 -->
<w-picker <w-picker mode="range" startYear="2019" endYear="2025" :defaultVal="defaultVal" :current="true"
mode="range" @confirm="onConfirm" :selectList="[]" themeColor="#ff6900" ref="picker"></w-picker>
startYear="2019"
endYear="2025"
:defaultVal="defaultVal"
:current="true"
@confirm="onConfirm"
:selectList="[]"
themeColor="#ff6900"
ref="picker"
></w-picker>
</view> </view>
</template> </template>
<script> <script>
import uniPopup from '@/components/uni-popup/uni-popup.vue' import uniPopup from '@/components/uni-popup/uni-popup.vue'
import wPicker from "@/components/w-picker/w-picker.vue";//时间弹窗 import wPicker from "@/components/w-picker/w-picker.vue"; //时间弹窗
import { couponList, closedCoupons,couponGoods,addEditCoupons,couponsDetails,deleteCoupons} from "@/utils/api/coupon.js" import {
couponList,
closedCoupons,
couponGoods,
addEditCoupons,
couponsDetails,
deleteCoupons
} from "@/utils/api/coupon.js"
import empty from "@/components/empty/empty.vue" import empty from "@/components/empty/empty.vue"
export default { export default {
components:{ components: {
uniPopup, uniPopup,
wPicker, wPicker,
empty, empty,
}, },
data() { data() {
return { return {
keywords:'', keywords: '',
xianshi:true, xianshi: true,
istruesub:true, istruesub: true,
tabactive:1, tabactive: 1,
showshare: false,//弹窗 showshare: false, //弹窗
type:"bottom", type: "bottom",
shoplist:[],//自己店铺的商品列表 shoplist: [], //自己店铺的商品列表
//表单提交的参数 //表单提交的参数
parameter:{ parameter: {
at_least: "",//满多少可以用 at_least: "", //满多少可以用
count: "",//发放数量 count: "", //发放数量
coupon_name: "",//优惠券名称 coupon_name: "", //优惠券名称
end_time: "",//结束时间 end_time: "", //结束时间
start_time: "",//开始时间 start_time: "", //开始时间
give_type: "1",//发放范围 1本地 2本地区 3全网 give_type: "1", //发放范围 1本地 2本地区 3全网
goods_id: [],//可用商品 "1810", "5905", "5910" goods_id: [], //可用商品 "1810", "5905", "5910"
max_fetch: "",//每人最大可以使用 max_fetch: "", //每人最大可以使用
money: "",//金额 money: "", //金额
range_type: "1",//参与的商品 1全部 0部分 range_type: "1", //参与的商品 1全部 0部分
action:"add",//编辑必传 方式(添加add,修改edit) action: "add", //编辑必传 方式(添加add,修改edit)
},
parameter1:{
at_least: "10",//满多少可以用
count: "100",//发放数量
coupon_name: "测试优惠券",//优惠券名称
end_time: "2019-12-03",//结束时间
start_time: "2019-12-03",//开始时间
give_type: "1",//发放范围 1本地 2本地区 3全网
goods_id: [],//可用商品 "1810", "5905", "5910"
max_fetch: "2",//每人最大可以使用
money: "9.9",//金额
range_type: "1",//参与的商品 1全部 0部分
}, },
//时间弹窗 //时间弹窗
defaultVal:[], defaultVal: [],
selectList:[], selectList: [],
timetype:1, timetype: 1,
cardlist:[],//已发的卡券 cardlist: [], //已发的卡券
isallshow:false, isallshow: false,
page:0, page: 0,
pages:0, pages: 0,
}; };
}, },
onLoad(){ onLoad() {
//获取商品列表 //获取商品列表
this.shop_goodsFun(); this.shop_goodsFun();
}, },
//滚动到最底部 //滚动到最底部
onReachBottom(){ onReachBottom() {
if(!this.isallshow && this.tabactive==2){ if (!this.isallshow && this.tabactive == 2) {
this.shop_couponFun(); this.shop_couponFun();
} }
}, },
methods:{ methods: {
// 搜索 // 搜索
onKeyInput: function(event) { onKeyInput: function(event) {
this.keywords = event.target.value this.keywords = event.target.value
this.pages = 0; this.pages = 0;
this.shoplist=[]; this.shoplist = [];
this.shop_goodsFun(); this.shop_goodsFun();
}, },
nextPage:function(){ nextPage: function() {
this.pages++; this.pages++;
this.shop_goodsFun(); this.shop_goodsFun();
}, },
//取消编辑 //取消编辑
colesedit(){ colesedit() {
this.parameter={ this.parameter = {
at_least: "",//满多少可以用 at_least: "", //满多少可以用
count: "",//发放数量 count: "", //发放数量
coupon_name: "",//优惠券名称 coupon_name: "", //优惠券名称
end_time: "",//结束时间 end_time: "", //结束时间
start_time: "",//开始时间 start_time: "", //开始时间
give_type: "1",//发放范围 1本地 2本地区 3全网 give_type: "1", //发放范围 1本地 2本地区 3全网
goods_id: [],//可用商品 "1810", "5905", "5910" goods_id: [], //可用商品 "1810", "5905", "5910"
max_fetch: "",//每人最大可以使用 max_fetch: "", //每人最大可以使用
money: "",//金额 money: "", //金额
range_type: "1",//参与的商品 1全部 0部分 range_type: "1", //参与的商品 1全部 0部分
//id:"", //优惠劵id 编辑必传 //id:"", //优惠劵id 编辑必传
action:"add",//编辑必传 方式(添加add,修改edit) action: "add", //编辑必传 方式(添加add,修改edit)
} }
let list = this.shoplist let list = this.shoplist
list.map((item,index)=>{ list.map((item, index) => {
item.checked = false; item.checked = false;
return item; return item;
}) })
this.shoplist = list; this.shoplist = list;
}, },
//接口start //接口start
//获取商城商品 //获取商城商品
async shop_goodsFun(keywords){ async shop_goodsFun(keywords) {
let res = await couponGoods({ let res = await couponGoods({
page:this.pages, page: this.pages,
keywords:this.keywords keywords: this.keywords
}); });
let list = res.data; let list = res.data;
list.map((item,index)=>{ list.map((item, index) => {
if(item.goods_id){ if (item.goods_id) {
item.product_id = item.goods_id.toString(); item.product_id = item.goods_id.toString();
item.product_name = item.title; item.product_name = item.title;
}else if(item.room_id){ } else if (item.room_id) {
item.product_id = item.room_id.toString(); item.product_id = item.room_id.toString();
item.product_name = item.title; item.product_name = item.title;
}else if(item.product_id){ } else if (item.product_id) {
item.product_id = item.product_id.toString(); item.product_id = item.product_id.toString();
} }
item.checked = false; item.checked = false;
return item; return item;
}) })
// this.shoplist = list; // this.shoplist = list;
if(res.code==0){ if (res.code == 0) {
if( list.length!=0){ if (list.length != 0) {
this.shoplist = [...this.shoplist,...list]; this.shoplist = [...this.shoplist, ...list];
this.xianshi = true; this.xianshi = true;
}else{ } else {
// this.$api.msg("没有更多了~"); // this.$api.msg("没有更多了~");
this.isallshow = true; this.isallshow = true;
this.xianshi = false; this.xianshi = false;
} }
}else{ } else {
this.parameter.range_type= 1; this.parameter.range_type = 1;
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//coupons 商户发放卡券 提交发放卡券的方法 submit //coupons 商户发放卡券 提交发放卡券的方法 submit
async coupons(){ async coupons() {
let can = this.parameter; let {
// can.goods_id = can.goods_id.join(";"); parameter
let res = await addEditCoupons(can); } = this;
let can = {...parameter};
if(res.code==0){ can.goods_id = can.goods_id.join(",");
let res = await addEditCoupons(can);
if (res.code == 0) {
this.$api.msg(res.msg); this.$api.msg(res.msg);
setTimeout(()=>{ setTimeout(() => {
this.chongzhi();//重置 this.chongzhi(); //重置
this.tabactive = 2; this.tabactive = 2;
},1000) }, 1000)
}else{ } else {
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//已发卡券 //已发卡券
async shop_couponFun(){ async shop_couponFun() {
this.page++; this.page++;
let res = await couponList({ let res = await couponList({
page:this.page, page: this.page,
}); });
if(res.code==0){ if (res.code == 0) {
if( res.data.length!=0){ if (res.data.length != 0) {
this.cardlist = [...this.cardlist,...res.data]; this.cardlist = [...this.cardlist, ...res.data];
}else{ } else {
this.$api.msg("没有更多了~"); this.$api.msg("没有更多了~");
this.isallshow = true; this.isallshow = true;
} }
}else{ } else {
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//卡券单个的开关 //卡券单个的开关
async switch_couponsFun(item,valse,index){ async switch_couponsFun(item, valse, index) {
let res = await closedCoupons({ let res = await closedCoupons({
id:item.id, id: item.id,
status:item.status==0?2:0,//开启(0),关闭 2 //valse,//valse,// status: item.status == 0 ? 2 : 0, //开启(0),关闭 2 //valse,//valse,//
}); });
if(res.code==0){ if (res.code == 0) {
this.$api.msg(res.msg); this.$api.msg(res.msg);
this.cardlist[index].status = item.status==0?2:0; this.cardlist[index].status = item.status == 0 ? 2 : 0;
}else{ } else {
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//删除 //删除
async deleteFun(item){ async deleteFun(item) {
let res = await deleteCoupons({ let res = await deleteCoupons({
id:item.id id: item.id
}); });
this.$api.msg(res.msg); this.$api.msg(res.msg);
if(res.code == 1){ if (res.code == 1) {
//已发卡券 //已发卡券
this.page = 0; this.page = 0;
this.cardlist = []; this.cardlist = [];
this.isallshow = false; this.isallshow = false;
this.shop_couponFun(); this.shop_couponFun();
} }
}, },
//优惠券详情 编辑使用 //优惠券详情 编辑使用
async detailsFun(item){ async detailsFun(item) {
let res = await couponsDetails({ let res = await couponsDetails({
id:item.id id: item.id
}); });
if(item){ if (item) {
//this.shoplist = res.data.coupons_goods; //this.shoplist = res.data.coupons_goods;
let parameter = { let parameter = {
at_least:item.at_least, at_least: item.at_least,
count:item.count, count: item.count,
coupon_name:item.coupon_name, coupon_name: item.coupon_name,
end_time:item.end_time, end_time: item.end_time,
start_time:item.start_time, start_time: item.start_time,
give_type:item.give_type, give_type: item.give_type,
goods_id:item.goods_id, goods_id: item.goods_id,
max_fetch:item.max_fetch, max_fetch: item.max_fetch,
money:item.money, money: item.money,
range_type:item.range_type, range_type: item.range_type,
id:item.id, id: item.id,
action:"edit", action: "edit",
} }
// let iddata = []; // let iddata = [];
this.shoplist = this.shoplist.map((item1,index)=>{//参与的商品默认选中的 this.shoplist = this.shoplist.map((item1, index) => { //参与的商品默认选中的
// if(){ console.info("res.data.goods_ids",res.data.goods_ids,item1.product_id);
if (res.data.goods_ids.indexOf(String(item1.product_id)) != -1 || res.data.goods_ids.indexOf(parseInt(item1.product_id)) != -1) {
// } console.info("checked true");
if(res.data.goods_ids.indexOf(item1.product_id)!=-1){
item1.checked = true; item1.checked = true;
}else{ } else {
item1.checked = false; item1.checked = false;
} }
return item1 return item1
}) })
parameter.goods_id = res.data.goods_ids; parameter.goods_id = res.data.goods_ids;
this.parameter = parameter; this.parameter = parameter;
this.tabactive = 1; this.tabactive = 1;
}else{ } else {
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//接口end //接口end
chongzhi(){ chongzhi() {
this.parameter = { this.parameter = {
at_least: "",//满多少可以用 at_least: "", //满多少可以用
count: "",//发放数量 count: "", //发放数量
coupon_name: "",//优惠券名称 coupon_name: "", //优惠券名称
end_time: "",//结束时间 end_time: "", //结束时间
start_time: "",//开始时间 start_time: "", //开始时间
give_type: "1",//发放范围 1本地 2本地区 3全网 give_type: "1", //发放范围 1本地 2本地区 3全网
goods_id: [],//可用商品 goods_id: [], //可用商品
max_fetch: "",//每人最大可以使用 max_fetch: "", //每人最大可以使用
money: "",//金额 money: "", //金额
range_type: "1",//参与的商品 1全部 0部分 range_type: "1", //参与的商品 1全部 0部分
action:'add' action: 'add'
}; };
}, },
taggleTab(inde){ taggleTab(inde) {
this.tabactive = inde; this.tabactive = inde;
}, },
//发放范围 //发放范围
radioChange(e){ radioChange(e) {
this.parameter.give_type = e.detail.value; this.parameter.give_type = e.detail.value;
}, },
//参与的商品 //参与的商品
radioChange1(e){ radioChange1(e) {
this.parameter.range_type = e.detail.value; this.parameter.range_type = e.detail.value;
}, },
radioChange2(e){ //选择产品的 多选
//选择产品的单选 radioChange2(e) {
console.info("e", e);
this.parameter.goods_id = e.detail.value; this.parameter.goods_id = e.detail.value;
this.shoplist = this.shoplist.map((item1,index)=>{//参与的商品默认选中的 this.shoplist = this.shoplist.map((item1, index) => { //参与的商品默认选中的
if(this.parameter.goods_id.indexOf(item1.product_id)!=-1){ if (this.parameter.goods_id.indexOf(String(item1.product_id)) != -1 || this.parameter.goods_id.indexOf(parseInt(item1.product_id)) != -1) {
item1.checked = true; item1.checked = true;
}else{ } else {
item1.checked = false; item1.checked = false;
} }
return item1 return item1
}) })
}, },
//弹窗里面的方法 //弹窗里面的方法
togglePopup(type, open) { togglePopup(type, open) {
...@@ -571,28 +573,29 @@ ...@@ -571,28 +573,29 @@
} }
}, },
//时间组件事件 //时间组件事件
onConfirm(e){ onConfirm(e) {
// this.parameter.start_time = e.checkArr[0]+"年"+e.checkArr[1]+"月"+e.checkArr[2]+"日"; // this.parameter.start_time = e.checkArr[0]+"年"+e.checkArr[1]+"月"+e.checkArr[2]+"日";
// this.parameter.end_time = e.checkArr[3]+"年"+e.checkArr[4]+"月"+e.checkArr[5]+"日"; // this.parameter.end_time = e.checkArr[3]+"年"+e.checkArr[4]+"月"+e.checkArr[5]+"日";
this.parameter.start_time = e.checkArr[0]+"-"+e.checkArr[1]+"-"+e.checkArr[2]; this.parameter.start_time = e.checkArr[0] + "-" + e.checkArr[1] + "-" + e.checkArr[2];
this.parameter.end_time = e.checkArr[3]+"-"+e.checkArr[4]+"-"+e.checkArr[5]; this.parameter.end_time = e.checkArr[3] + "-" + e.checkArr[4] + "-" + e.checkArr[5];
}, },
//显示时间选中
showtime(){ showtime() {
this.$refs.picker.show() this.$refs.picker.show()
}, },
hiddetime(){ //隐藏时间选中
hiddetime() {
this.$refs.picker.hide() this.$refs.picker.hide()
}, },
//显示商品列表 //显示商品列表
showmodles(){ showmodles() {
this.showshare = true; this.showshare = true;
} }
}, },
watch:{ watch: {
tabactive(e){ tabactive(e) {
if(e==2){ if (e == 2) {
//已发卡券 //已发卡券
this.page = 0; this.page = 0;
this.cardlist = []; this.cardlist = [];
...@@ -605,5 +608,5 @@ ...@@ -605,5 +608,5 @@
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./CardSend.scss" @import "./CardSend.scss"
</style> </style>
\ No newline at end of file
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