Commit 42617749 by 李伟康

commit

1 parent a3359ba6
const url = '/rop-scrm-coupon/router'
const pageSize = 10
export default {
/**根据条件获取定向礼包列表(企微) */
getGiftList (data) {
data.method = 'scrm.api.coupon.weChat.directional.gift.list'
data.pageSize = pageSize
return window.$HTTP({
url,
data
})
},
/** 根据id删除定向礼包 */
deleteGift (data) {
data.method = 'scrm.api.coupon.directional.gift.delete'
return window.$HTTP({
url,
data
})
},
/**根据id获取定向礼包详情(企微) */
getGiftDetail (id) {
let data = {
method: 'scrm.api.coupon.weChat.directional.gift.detail',
id
}
return window.$HTTP({
url,
data
})
},
/**定向礼包专用优惠券列表(嘀加后台和企微) */
getCouponList (data) {
data.method = 'scrm.api.coupon.directional.gift.coupon.list'
data.pageSize = 9999
return window.$HTTP({
url,
data
})
},
/**创建或修改礼包,修改时礼包id必传 */
createOrupdataGift (data) {
data.method = 'scrm.api.coupon.directional.gift.create'
return window.$HTTP({
url,
data
})
},
/**根据定向礼包id获取二维码路径 */
createQr (data) {
data.method = 'scrm.api.coupon.directional.gift.qr.code'
return window.$HTTP({
url,
data
})
}
}
\ No newline at end of file \ No newline at end of file
...@@ -14,6 +14,7 @@ import wxConfig from './wxConfig' ...@@ -14,6 +14,7 @@ import wxConfig from './wxConfig'
import shopmallApi from './shopmallApi' import shopmallApi from './shopmallApi'
import boutiquecouponApi from './boutiquecouponApi' import boutiquecouponApi from './boutiquecouponApi'
import equityApi from './equityApi' import equityApi from './equityApi'
import giftApi from './giftApi'
export { export {
ssoApi, ssoApi,
...@@ -23,5 +24,6 @@ export { ...@@ -23,5 +24,6 @@ export {
activityApi, activityApi,
liveApi, liveApi,
boutiquecouponApi, boutiquecouponApi,
equityApi equityApi,
giftApi
} }
\ No newline at end of file \ No newline at end of file
.layout {
padding: 10px 16px 106px;
.box {
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 10px;
.item {
display: flex;
align-items: center;
min-height: 59px;
padding: 0 16px;
font-size: 14px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
&:last-of-type {
border-bottom: none;
}
}
.label {
color: #666666;
width: 80px;
flex-shrink: 0;
span {
display: block;
font-size: 10px;
transform: translateX(-7px);
}
}
.value {
color: #333;
width: calc(100% - 90px);
text-align: right;
margin-left: auto;
span {
color: #f1515c;
}
}
.detail-box {
padding: 0 12px 8px 11px;
.detail {
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
&:last-of-type {
border-bottom: none;
}
}
.detail-list {
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
font-size: 12px;
color: #333333;
padding: 12px 5px;
&:last-of-type {
border-bottom: none;
}
.name {
font-size: 14px;
&-tips {
margin-left: 8px;
width: 46px;
height: 16px;
background: #CBCBCB;
border-radius: 4px;
font-size: 10px;
color: #FFFFFF;
}
}
.num {
color: #282829;
}
.price {
color: #f1515c;
margin-left: auto;
}
}
.detail-title {
margin: 11px 0 0 5px;
height: 28px;
background: rgba(57, 117, 198, 0.15);
border-radius: 14px;
font-size: 14px;
color: #3975c6;
padding: 0 12px;
display: inline-flex;
}
.coupon-disabled {
position: relative;
.detail-list {
color: #999999;
.num {
color: #999999;
}
.price {
color: #999999;
}
}
.del{
position: absolute;
top: 8px;
right: 0;
}
}
}
}
.readonly-box {
padding: 10px 16px 20px;
color: #333333;
.title {
font-size: 14px;
margin-bottom: 20px;
color: #666666;
}
.item {
min-height: auto;
padding: 0;
}
}
.user-info {
padding: 0 12px;
height: 84px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
font-weight: 600;
font-size: 16px;
color: #333333;
.icon {
width: 44px;
height: 44px;
margin-right: 12px;
flex-shrink: 0;
}
}
.btn {
position: fixed;
bottom: 16px;
width: 175px;
height: 36px;
background: #3975c6;
box-shadow: 0px 2px 4px 0px rgba(57, 117, 198, 0.2);
border-radius: 21px;
color: #fff;
font-size: 14px;
box-sizing: border-box;
transition: all .5s;
}
.create {
width: 343px;
height: 42px;
}
.disabled-btn {
background: #A2A2A2;
}
.add-box {
height: 56px;
.add-btn {
width: 60px;
height: 24px;
background: #3975C6;
box-shadow: 0px 2px 6px 2px rgba(57, 117, 198, 0.11);
border-radius: 11px;
border: 1px solid #3975C6;
}
}
.radio-box {
color: #333;
font-size: 12px;
.title {
margin-bottom: 0;
}
.radio-item {
margin-top: 20px;
padding-left: 12px;
.radio-input {
margin-left: 16px;
padding: 10px 0 4px 0;
border-bottom: 1px solid #F8F8F8;
.van-field {
padding: 0;
font-size: 12px;
}
}
}
}
.textarea {
.title {
margin-bottom: 8px;
}
.van-field {
padding: 8px;
border: 1px solid #F1F1F1;
box-sizing: border-box;
height: 100px;
}
}
}
.radio {
width: 12px;
height: 12px;
border: 1px solid #979797;
box-sizing: border-box;
border-radius: 100%;
margin-right: 4px;
}
.radio-active {
border-color: #3975C6;
display: flex;
justify-content: center;
align-items: center;
&::after {
content: '';
display: block;
width: 6px;
height: 6px;
background: #3975C6;
box-shadow: 0px 2px 6px 2px rgba(57, 117, 198, 0.11);
border: 1px solid #3975C6;
box-sizing: border-box;
border-radius: 100%;
}
}
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 250px 212px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 290px 250px;}
.icon-coupon-0 { width: 32px; height: 32px; background-position: 0px -180px;} .icon-coupon-0 { width: 32px; height: 32px; background-position: -134px -180px;}
.icon-coupon-1 { width: 32px; height: 32px; background-position: -42px -180px;} .icon-coupon-1 { width: 32px; height: 32px; background-position: -176px -180px;}
.icon-coupon-lose { width: 70px; height: 70px; background-position: -180px 0px;} .icon-coupon-lose { width: 70px; height: 70px; background-position: -180px -90px;}
.icon-coupon-success { width: 70px; height: 70px; background-position: -180px -80px;} .icon-coupon-success { width: 70px; height: 70px; background-position: 0px -180px;}
.icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;} .icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;}
.icon-discount { width: 80px; height: 80px; background-position: -90px 0px;} .icon-discount { width: 80px; height: 80px; background-position: -90px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -170px -180px;} .icon-down { width: 12px; height: 12px; background-position: -270px -110px;}
.icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;} .icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;}
.icon-poster-close { width: 20px; height: 20px; background-position: -84px -180px;}
.icon-scan { width: 16px; height: 16px; background-position: -144px -180px;}
.icon-share { width: 20px; height: 20px; background-position: -114px -180px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
\ No newline at end of file \ No newline at end of file
.icon-gift-create { width: 16px; height: 16px; background-position: -270px -58px;}
.icon-poster-close { width: 20px; height: 20px; background-position: -218px -180px;}
.icon-scan { width: 16px; height: 16px; background-position: -270px -84px;}
.icon-share { width: 20px; height: 20px; background-position: -270px 0px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
.icon-gift-icon { width: 44px; height: 44px; background-position: -80px -180px;}
.icon-gift-add { width: 12px; height: 12px; background-position: -270px -132px;}
.icon-gift-bg { width: 80px; height: 80px; background-position: -180px 0px;}
.icon-gift-del { width: 18px; height: 18px; background-position: -270px -30px;}
\ No newline at end of file \ No newline at end of file

83.5 KB | W: | H:

122 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<div class="search-box flex"> <div :class="['search-box','flex',{'max':!showDropdown}]">
<van-search <van-search
v-model="searchValue" v-model="searchValue"
placeholder="输入客户姓名搜索" :placeholder="placeholder"
@search="onEmit($event,'search')" @search="onEmit($event,'search')"
@clear="onEmit('','search')" @clear="onEmit('','search')"
/> />
<van-dropdown-menu active-color="#3975C6"> <template v-if="showDropdown">
<van-dropdown-item <van-dropdown-menu active-color="#3975C6">
v-model="value" <van-dropdown-item
:options="option" v-model="value"
@change="onEmit($event,'change')" :options="option"
/> @change="onEmit($event,'change')"
<div class="arrow y-center"> />
<div class="sprite-icon icon-down"></div> <div class="arrow y-center">
</div> <div class="sprite-icon icon-down"></div>
</van-dropdown-menu> </div>
</van-dropdown-menu>
</template>
</div> </div>
</template> </template>
...@@ -31,14 +33,19 @@ export default { ...@@ -31,14 +33,19 @@ export default {
updata: { updata: {
type: Number, type: Number,
default: new Date().getTime() default: new Date().getTime()
} },
showDropdown: {
type: Boolean,
default: true
},
placeholder: String
}, },
data () { data () {
return { return {
value: 0, value: 0,
option: [ option: [
{ text: '优惠券', value: 0 }, { text: '优惠券', value: 0 },
{ text: '精品礼券', value: 1 }, { text: '精品礼券', value: 1 },
{ text: '商品订单', value: 2 }, { text: '商品订单', value: 2 },
{ text: '会员服务', value: 3 } { text: '会员服务', value: 3 }
], ],
...@@ -49,13 +56,13 @@ export default { ...@@ -49,13 +56,13 @@ export default {
'updata' (n) { 'updata' (n) {
this.value = this.index this.value = this.index
}, },
'keyword'(n){ 'keyword' (n) {
this.searchValue = n this.searchValue = n
} }
}, },
methods: { methods: {
onEmit (e, name) { onEmit (e, name) {
this.$emit(name, e ) this.$emit(name, e)
} }
} }
} }
...@@ -68,7 +75,6 @@ export default { ...@@ -68,7 +75,6 @@ export default {
box-shadow: 0px 1px 0px 0px #e9e9e9; box-shadow: 0px 1px 0px 0px #e9e9e9;
padding-right: 16px; padding-right: 16px;
position: relative; position: relative;
.van-search { .van-search {
width: 263px; width: 263px;
padding: 4.5px 8px; padding: 4.5px 8px;
...@@ -104,4 +110,10 @@ export default { ...@@ -104,4 +110,10 @@ export default {
} }
} }
} }
.max {
padding-right: 0;
.van-search {
width: 100%;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,16 @@ const discountType = { ...@@ -10,7 +10,16 @@ const discountType = {
export default { export default {
data() { data() {
return { return {
discountType discountType,
discountEnum: {
1: '满减券',
2: '折扣券',
3: '代金券',
4: '兑换券',
5: '购车代金券',
6: '商品折扣券',
7: '会员服务'
},
} }
}, },
mounted() { mounted() {
......
...@@ -47,7 +47,8 @@ import { ...@@ -47,7 +47,8 @@ import {
Dialog, Dialog,
ShareSheet, ShareSheet,
Overlay, Overlay,
loading loading,
SwipeCell
} from 'vant' } from 'vant'
export const components = [ export const components = [
Button, Button,
...@@ -89,5 +90,6 @@ export const components = [ ...@@ -89,5 +90,6 @@ export const components = [
Dialog, Dialog,
ShareSheet, ShareSheet,
Overlay, Overlay,
loading loading,
SwipeCell
] ]
\ No newline at end of file \ No newline at end of file
...@@ -47,6 +47,29 @@ const pages = { ...@@ -47,6 +47,29 @@ const pages = {
title: '店铺中心' title: '店铺中心'
} }
} }
],
gift:[
{
name:'index',
meta: {
title:'定向礼包',
backgroundColor: '#F7F7F7'
}
},
{
name:'detail',
meta: {
title:'定向礼包',
backgroundColor: '#F7F7F7'
}
},
{
name:'create',
meta: {
title:'定向礼包',
backgroundColor: '#F7F7F7'
}
}
] ]
} }
let routes = [ let routes = [
......
...@@ -116,9 +116,6 @@ export default { ...@@ -116,9 +116,6 @@ export default {
this.hideLoading() this.hideLoading()
}) })
}, },
centsToyuan (price) {
return Number(price / 100).toFixed(2)
},
iosTimeFormat (time) { iosTimeFormat (time) {
return time.replace(/\-/g, '/') return time.replace(/\-/g, '/')
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
:keyword="userName" :keyword="userName"
:index="type" :index="type"
:updata="updata" :updata="updata"
placeholder="输入客户姓名搜索"
></search-box> ></search-box>
<tab <tab
:list="tab[type]" :list="tab[type]"
...@@ -281,8 +282,8 @@ export default { ...@@ -281,8 +282,8 @@ export default {
userStatus: 1, userStatus: 1,
type: 0 type: 0
}) })
this.getCustomerCouponList('Y') this.getCustomerCouponList('Y')
this.getCustomerCouponList('N') this.getCustomerCouponList('N')
this.getGoodsVerficationList(1) this.getGoodsVerficationList(1)
this.getGoodsVerficationList(2) this.getGoodsVerficationList(2)
this.getVerificationList(3) this.getVerificationList(3)
......
<template>
<div class="layout">
<template v-if="flag">
<div class="box">
<div class="item">
<div class="label">礼包名称</div>
<div class="value">
<van-field
v-model="obj.name"
input-align="right"
maxlength="15"
placeholder="请输入礼包名称"
@input="input"
/>
</div>
</div>
<div class="item">
<div class="label">
备注名称
<span>(仅内部可见)</span>
</div>
<div class="value">
<van-field
v-model="obj.remarkName"
input-align="right"
maxlength="30"
placeholder="可按车主姓名+手机号形式备注"
@input="input"
/>
</div>
</div>
</div>
<div class="box">
<div class="item">
<div class="label">礼包明细</div>
<div class="value">预估成本:<span>¥{{centsToyuan(total)}}</span></div>
</div>
<template v-if="obj.couponList && obj.couponList.length">
<div class="detail-box">
<template v-for="(i,index) in obj.couponList">
<div
:class="['detail',{'coupon-disabled':i.status != 2}]"
:key="index"
>
<!-- status 优惠券状态(1:未生效,2:生效中,3:已失效) -->
<!-- 优惠券类型 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 -->
<span class="detail-title text-center">{{discountEnum[i.discountType]}}</span>
<div class="detail-list">
<div class="name flex">
{{i.couponName}}
<template v-if="i.status != 2">
<div class="name-tips text-center">{{{1:'未生效',3:'已失效'}[i.status]}}</div>
</template>
</div>
<div class="num flex">
数量:x{{i.couponAmount}}
<div class="price">¥{{centsToyuan(i.couponAnticipatedCost * i.couponAmount)}}</div>
</div>
</div>
<template v-if="i.status != 2">
<div class="del sprite-icon icon-gift-del" @click="delCoupon(index)"></div>
</template>
</div>
</template>
</div>
</template>
<div :class="['add-box text-center',{'add-line':obj.couponList.length > 0}]">
<div
class="add-btn text-center"
@click="showGiftModal"
>
<div class="sprite-icon icon-gift-add"></div>
</div>
</div>
</div>
<div class="box readonly-box radio-box">
<div class="title">领取条件</div>
<template v-for="(i,index) in radioObj">
<div
class="radio-item"
:key="index"
>
<div
class="radio-name flex"
@click="changeRadio(index)"
>
<div :class="['radio',{'radio-active':i.active}]"></div>
{{i.name}}
</div>
<template v-if="i.active">
<div class="radio-input">
<van-field
v-model="obj.receiveDetails"
:type="i.type || 'text'"
:maxlength="i.maxlength"
:placeholder="i.placeholder"
@input="input"
/>
</div>
</template>
</div>
</template>
</div>
<div class="box readonly-box textarea">
<div class="title">赠送原因</div>
<div class="textarea-box">
<van-field
v-model="obj.giveReason"
type="textarea"
placeholder="请说明赠送礼包的原因(非必填)"
maxlength="50"
@input="input"
/>
</div>
</div>
<div
:class="['btn text-center x-center create',{'disabled-btn':disabled}]"
@click="submit"
>{{id?'修改':'创建'}}</div>
</template>
<gift-modal
ref="GiftModal"
:selectedList="obj.couponList"
@confirm="couponConfirm"
/>
</div>
</template>
<script type='text/ecmascript-6'>
import GiftModal from './GiftModal.vue'
import { giftApi } from '@/api'
import { discountTypeMixin } from '@/mixins'
export default {
name: '',
components: { GiftModal },
mixins: [discountTypeMixin],
data () {
return {
flag: false,
disabled: true,
obj: {
receiveWay: 1,
couponList: []
},
radioObj: [
{ name: '指定手机号', type: 'tel', placeholder: '客户需输入指定的手机号,才能成功领取礼包', maxlength: 11, active: true },
{ name: '指定车架号后6位', placeholder: '客户需输入指定的车架号,才能成功领取礼包', maxlength: 6 },
],
total: 0,
id: '',
test: ''
}
},
mounted () {
let { id } = this.getQuery()
if (id) {
this.getDetail(id)
this.id = id
}
else this.flag = true
},
methods: {
input () {
this.checkData()
},
getDetail (id) {
let total = 0
giftApi.getGiftDetail(id).then(res => {
this.hideLoading()
res.couponList.length && res.couponList.map(e => total += e.couponAnticipatedCost * e.couponAmount)
this.flag = true
this.obj = res
this.total = total
this.checkData()
})
},
changeRadio (index) {
let { radioObj } = this
radioObj.map(e => e.active = false)
radioObj[index].active = true
this.obj.receiveWay = index == 0 ? 1 : 2
},
showGiftModal () {
this.$refs.GiftModal.toggle()
},
couponConfirm ({ chooseItems }) {
let total = 0
chooseItems.map(i => total += i.couponAnticipatedCost * i.couponAmount)
this.obj.couponList = JSON.parse(JSON.stringify(chooseItems))
this.total = total
this.checkData()
},
checkData () {
let { obj } = this
let target = ['name', 'remarkName', 'couponList', 'receiveDetails']
try {
target.map(key => {
if (!obj[key]) throw key
if (Array.isArray(obj[key])) {
if (!obj[key].length) throw key
}
})
} catch (error) {
this.disabled = true
return
}
this.disabled = false
},
delCoupon (index) {
let { obj: { couponList } } = this
let total = 0
couponList.splice(index, 1)
this.obj.couponList = couponList
couponList.map(i => total += i.couponAnticipatedCost * i.couponAmount)
this.total = total
},
submit () {
const phoneRex = /^[1]([3-9])[0-9]{9}$/
if (disabled) return
let { obj, disabled, id } = this
if (obj.receiveWay == 1) {
if (!phoneRex.test(obj.receiveDetails)) {
this.showToast('请输入正确的手机号')
return
}
} else {
if (obj.receiveDetails.length < 6) {
this.showToast('请输入车架号的后6位')
return
}
}
try {
obj.couponList.map(e => {
if (e.status != 2) throw false
})
} catch (error) {
this.showToast('礼包有失效券')
return
}
let couponCreateRequests = []
obj.couponList.map(e => {
couponCreateRequests.push({
couponId: e.couponId,
couponAmount: e.couponAmount,
couponAnticipatedCost: e.couponAnticipatedCost
})
})
let params = {
name: obj.name,
remarkName: obj.remarkName,
receiveWay: obj.receiveWay,
receiveDetails: obj.receiveDetails,
giveReason: obj.giveReason,
couponCreateRequests
}
if (id) params.id = id
this.showLoading('提交中...')
giftApi.createOrupdataGift(params).then(res => {
this.hideLoading()
this.showToast(`${id ? '修改' : '创建'}成功`, () => {
this.$router.back()
})
})
}
}
}
</script>
<style scoped lang='scss'>
@import '@/assets/css/gift-detail.scss';
.item {
.van-field {
padding: 0;
}
}
.add-line {
border-top: 1px solid rgba(195, 195, 195, 0.3);
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="layout">
<template v-if="flag">
<template v-if="obj.receivedFlag == 2">
<div class="box">
<div class="user-info flex">
<div class="icon">
<img
:src="obj.nickUrl"
v-if="obj.nickUrl"
>
<div
class="sprite-icon icon-gift-icon"
v-else
></div>
</div>
{{obj.nickName || '无'}}
</div>
<div class="item">
<div class="label">领取手机号</div>
<div class="value">{{obj.phone}}</div>
</div>
<div class="item">
<div class="label">领取时间</div>
<div class="value">{{new Date(obj.receivedDate).format('yyyy/MM/dd hh:mm')}}</div>
</div>
</div>
</template>
<div class="box">
<div class="item">
<div class="label">礼包名称</div>
<div class="value">{{obj.name}}</div>
</div>
<div class="item">
<div class="label">备注名称</div>
<div class="value">{{obj.remarkName||''}}</div>
</div>
</div>
<div class="box">
<div class="item">
<div class="label">礼包明细</div>
<div class="value">预估成本:<span>¥{{centsToyuan(total)}}</span></div>
</div>
<template v-if="obj.couponList && obj.couponList.length">
<div class="detail-box">
<template v-for="(i,index) in obj.couponList">
<div
:class="['detail',{'coupon-disabled':i.status != 2 && obj.receivedFlag != 2}]"
:key="index"
>
<!-- status 优惠券状态(1:未生效,2:生效中,3:已失效) -->
<!-- 优惠券类型 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 -->
<span class="detail-title text-center">{{discountEnum[i.discountType]}}</span>
<div class="detail-list">
<div class="name flex">
{{i.couponName}}
<template v-if="i.status != 2 && obj.receivedFlag != 2">
<div class="name-tips text-center">{{{1:'未生效',3:'已失效'}[i.status]}}</div>
</template>
</div>
<div class="num flex">
数量:x{{i.couponAmount}}
<div class="price">¥{{centsToyuan(i.couponAnticipatedCost * i.couponAmount)}}</div>
</div>
</div>
<!-- <template v-if="i.status != 2 && obj.receivedFlag != 2">
<div class="del sprite-icon icon-gift-del" @click="changeGift"></div>
</template> -->
</div>
</template>
</div>
</template>
</div>
<div class="box readonly-box">
<div class="title">领取条件</div>
<div class="item">
指定{{obj.receiveWay == 1?'手机号':'车架号'}}
<div class="value">{{obj.receiveDetails}}</div>
</div>
</div>
<div class="box readonly-box">
<div class="title">赠送原因</div>
<div class="item">
{{obj.giveReason || '无'}}
</div>
</div>
<template v-if="obj.receivedFlag == 1">
<div
class="btn text-center x-center"
@click="changeGift"
>修改</div>
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { giftApi } from '@/api'
import { discountTypeMixin } from '@/mixins'
export default {
name: '',
mixins: [discountTypeMixin],
data () {
return {
flag: false,
obj: {},
total: 0
}
},
mounted () {
this.showLoading()
this.getDetail()
},
methods: {
getDetail () {
let { id } = this.getQuery()
let total = 0
giftApi.getGiftDetail(id).then(res => {
this.hideLoading()
res.couponList.length && res.couponList.map(e => total += e.couponAnticipatedCost * e.couponAmount)
this.flag = true
this.obj = res
this.total = total
})
},
changeGift () {
let { id } = this.getQuery()
this.$router.replace({ name: 'gift.create', query: { id } })
}
}
}
</script>
<style scoped lang='scss'>
@import '@/assets/css/gift-detail.scss';
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="index">
<search-box
@search="search"
:keyword="name"
:showDropdown="false"
placeholder="请输入礼包名称、备注名称进行搜索"
></search-box>
<tab
:list="tab"
@change="change"
/>
<template v-if="flag">
<template v-if="list.length">
<scroll-view
:class="['list-box',`type-${tabIndex}`]"
@ReachBottom="onReachBottom"
ref="scrollView"
>
<template v-for="(i,index) in list">
<div
:key="index"
class="item"
@click="jump(i)"
>
<template v-if="tabIndex == 0">
<van-swipe-cell>
<div class="title flex">
{{i.name}}
<span @click.stop="send(i)">发送</span>
</div>
<div class="content">
<div class="icon">
<div class="sprite-icon icon-gift-bg"></div>
</div>
<div class="info">
<div class="text">指定领取{{i.receiveWay == 1?'手机号':'车架号'}}:{{i.receiveDetails}}</div>
<div class="text">备注名称:{{i.remarkName}}</div>
</div>
<div
class="qr-text"
@click.stop="createQr(i)"
>领取二维码</div>
</div>
<template #right>
<van-button
square
type="danger"
text="删除"
@click.stop="del(i)"
class="delete-button"
/>
</template>
</van-swipe-cell>
</template>
<template v-else>
<div class="user-box flex">
<div class="icon">
<img
:src="i.nickUrl"
v-if="i.nickUrl"
>
<div
class="sprite-icon icon-gift-icon"
v-else
></div>
</div>
<div class="info">
<div class="name">
<template v-if="i.nickName">
{{i.nickName}}<span>@微信</span>
</template>
<template v-else>无</template>
</div>
<div class="phone">领取手机号:{{i.phone}}</div>
</div>
</div>
<div class="gift-box">
<div class="title">{{i.name}}</div>
<div class="text">指定领取{{i.receiveWay == 1?'手机号':'车架号'}}:{{i.receiveDetails}}</div>
<div class="text">备注名称:{{i.remarkName}}</div>
</div>
</template>
</div>
</template>
</scroll-view>
</template>
<template v-else>
<van-empty description="暂无内容" />
</template>
</template>
<div
class="btn x-center flex"
@click="create"
>
<div class="sprite-icon icon-gift-create"></div>
创建礼包
</div>
<van-overlay
:show="showQr"
@click="showQr = false"
>
<div class="qr-content text-center">
<div
class="qr-box"
@click.stop
>
<div class="qr">
<img :src="qr.img">
</div>
<div class="name text-hide">{{qr.name}}</div>
</div>
<div
class="qr-close sprite-icon icon-poster-close"
@click.stop="showQr = false"
>
</div>
</div>
</van-overlay>
</div>
</template>
<script type='text/ecmascript-6'>
import { giftApi, wxConfig } from '@/api'
export default {
name: '',
data () {
return {
tab: ['待领取', '已领取'],
name: '',
flag: false,
tabIndex: 0,
pageNum: 0,
total: 0,
list: [],
showQr: false,
qr: {}
}
},
mounted () {
this.getList()
wxConfig.init(['sendChatMessage'])
},
methods: {
getList () {
let { pageNum, tabIndex, list, name } = this
giftApi.getGiftList({ pageNum, name, receivedFlag: tabIndex == 0 ? 1 : 2 }).then(res => {
this.hideLoading()
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
console.log(res)
})
},
search (e) {
this.name = e
this.clearData()
},
change (e) {
this.tabIndex = e
this.clearData()
},
clearData () {
this.showLoading()
this.list = []
this.flag = false
this.pageNum = 1
if (this.$refs.scrollView) this.$refs.scrollView.finished = false
this.getList()
},
del (e) {
this.dialog({
title: '删除礼包',
message: '是否确认删除该礼包',
confirmButtonColor: '#3975C6'
}).then(() => {
giftApi.deleteGift({ id: e.id }).then(() => {
this.showToast('操作成功', () => {
this.clearData()
})
})
})
},
onReachBottom () {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total || Math.ceil(total / 10) < pageNum) {
this.$refs.scrollView.finished = true
return
}
this.pageNum = pageNum + 1
this.getList()
},
send (e) {
const { shopmall_appid } = window.$fetchConfig
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
let query = `id=${e.id}&merchantId=${merchantId}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig
.createMiniprogramUrlLink({
path: 'packageMine/pages/boutique/gift/gift',
query: encodeURIComponent(query),
appId: shopmall_appid
})
.then(link => {
wxConfig
.shareAppMessage({
title: e.name,
desc: '',
link,
imgUrl: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/gift-banner.png'
})
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
})
},
jump ({ id }) {
this.$router.push({ name: 'gift.detail', query: { id } })
},
createQr (e) {
this.showQr = true
this.qr.name = e.name
// giftApi.createQr({ id: e.id }).then(res => {
// console.log(res)
// })
},
create () {
this.$router.push({ name: 'gift.create' })
}
}
}
</script>
<style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
.item {
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 10px;
}
}
.type-0 {
.item {
.delete-button {
height: 100%;
}
.title {
min-height: 19px;
font-size: 14px;
font-weight: 500;
color: #282829;
padding: 10px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
span {
margin-left: auto;
flex-shrink: 0;
width: 44px;
font-size: 12px;
color: #3975c6;
text-align: right;
}
}
.content {
padding: 12px 10px 16px;
display: flex;
position: relative;
.icon {
width: 80px;
height: 80px;
margin-right: 10px;
flex-shrink: 0;
}
.info {
font-size: 12px;
color: #999999;
.text {
line-height: 16px;
margin-bottom: 8px;
}
}
.qr-text {
font-size: 12px;
right: 10px;
bottom: 16px;
color: #3975c6;
position: absolute;
}
}
}
}
.type-1 {
.user-box {
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
box-sizing: border-box;
padding: 16px 10px 15px;
.icon {
width: 44px;
height: 44px;
margin-right: 16px;
flex-shrink: 0;
}
.info {
color: #333333;
font-size: 14px;
.name {
font-size: 16px;
font-weight: 600;
span {
color: #3975c6;
margin-left: 6px;
}
}
.phone {
margin-top: 4px;
}
}
}
.gift-box {
padding: 12px 10px 16px 13px;
font-size: 12px;
color: #999999;
.title {
font-size: 14px;
color: #282829;
font-weight: 500;
}
.text {
margin-top: 12px;
}
}
}
.btn {
position: fixed;
bottom: 40px;
width: 175px;
height: 36px;
background: #3975c6;
box-shadow: 0px 2px 4px 0px rgba(57, 117, 198, 0.2);
border-radius: 21px;
color: #fff;
font-size: 14px;
justify-content: center;
.sprite-icon {
margin-right: 8px;
}
}
.qr-content {
width: 100%;
height: 100%;
flex-direction: column;
.qr-box {
width: 200px;
height: 220px;
background: #ffffff;
border-radius: 4px;
box-sizing: border-box;
padding: 16px 0 12px;
color: #282829;
font-weight: 500;
font-size: 14px;
.qr {
width: 160px;
height: 160px;
margin: 0 auto 12px;
}
.name {
text-align: center;
}
}
.qr-close {
margin-top: 16px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!