Commit 6f310530 by 李伟康

commit

1 parent f3738f7c
import util from '@/utils/util'
import { Notify } from 'vant'
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
const url = '/rop-scrm-wechat/router'
const WxConfig = {
init(jsApiList) {
......@@ -48,8 +47,9 @@ const WxConfig = {
},
/**生成小程序短链 */
createMiniprogramUrlLink(data = {}) {
const { envVersion } = window.$fetchConfig
data.method = 'scrm.api.wechat.miniprogram.geturllink'
data.envVersion = IS_PROD ? 'release' : 'trial'
data.envVersion = envVersion
/**path 页面路径
* query 页面参数
* isExpire 过期类型 到期失效:true,永久有效:false
......
......@@ -227,6 +227,9 @@
box-sizing: border-box;
height: 100px;
}
.van-field--min-height .van-field__control{
height: 82px;
}
}
}
......
......@@ -14,10 +14,7 @@
@change="change"
/>
</div>
<div
class="modal-content"
:key="updata"
>
<div class="modal-content">
<template v-if="flag">
<template v-if="couponList.length">
<template v-for="(i,index) in couponList">
......@@ -35,7 +32,7 @@
<div class="right">
<div class="title text-hide">{{i.couponName}}</div>
<div class="text flex">库存:{{i.residueAmount}}<span class="line" />预估成本:{{centsToyuan(i.anticipatedCost)}}元</div>
<div class="text flex">
<div class="text flex text-tips">
<template v-if="tabIndex == 0">
<template v-if="i.useType == 0">
不限次数
......@@ -54,7 +51,7 @@
<template v-else>
有效期:
<template v-if="i.effectiveType == 1">
{{i.receiveEndTime}}
领取后{{i.effectiveDays}}天
</template>
<template v-if="i.effectiveType == 2">
{{i.effectiveStartTime}}-{{i.effectiveEndTime}}
......@@ -63,14 +60,16 @@
无限期
</template>
<span class="tips text-center">
<template v-if="i.useType == 0">
无限制次数
<template v-if="tabIndex == 1">
<template v-if="i.useBarriers == 1">
无限制次数
</template>
<template v-if="i.useBarriers == 2">
订单满{{centsToyuan(i.full)}}元可用
</template>
</template>
<template v-if="i.useType == 1">
可用{{i.useAmount}}次
</template>
<template v-if="i.useType == 2">
{{i.useLimitDays}}天可用{{i.useAmount}}次
<template v-else>
可用1次
</template>
</span>
</template>
......@@ -142,7 +141,6 @@ export default {
tab: ['门店服务', '代金券', '折扣券', '兑换券'],
tabIndex: 0,
couponList: [],
updata: new Date().getTime(),
chooseItems: [],
}
},
......@@ -168,9 +166,10 @@ export default {
},
getCouponList (callBack) {
// 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务
let { merchantId, uuid } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex } = this
let discountType = [7, 3, 2, 4][tabIndex]
giftApi.getCouponList({ discountType }).then(res => {
giftApi.getCouponList({ discountType, merchantId, staffUUID: uuid }).then(res => {
this.couponList = res.list
this.flag = true
if (callBack) callBack()
......@@ -192,27 +191,13 @@ export default {
})
},
choose (index) {
let { couponList, tabIndex, chooseItems } = this
if (tabIndex == 0) {
couponList[index].active = !couponList[index].active
} else {
if (couponList[index].active) couponList[index].active = false
else {
couponList.map(e => e.active = false)
couponList[index].active = true
}
couponList.map(e => {
chooseItems.map((i, ind) => {
if (!e.active && e.id == i.couponId) delete chooseItems[ind]
})
})
}
let { couponList, chooseItems } = this
couponList[index].active = !couponList[index].active
if (!couponList[index].active) {
chooseItems.map((e, ind) => {
if (e.couponId == couponList[index].id) delete chooseItems[ind]
})
}
this.updata = new Date().getTime()
this.setChooseItems()
},
setChooseItems () {
......@@ -251,6 +236,10 @@ export default {
},
confirm () {
let { chooseItems } = this
if(chooseItems.length == 0) {
this.showToast('请至少选择一项')
return
}
this.$emit('confirm', { chooseItems })
this.toggle()
}
......@@ -386,6 +375,9 @@ export default {
flex-shrink: 0;
}
}
.text-tips {
padding-right: 16px;
}
}
}
.active {
......
......@@ -90,11 +90,11 @@
<template v-if="i.active">
<div class="radio-input">
<van-field
v-model="obj.receiveDetails"
v-model="obj[i.key]"
:type="i.type || 'text'"
:maxlength="i.maxlength"
:placeholder="i.placeholder"
@input="input"
@input="input(i,$event)"
/>
</div>
</template>
......@@ -143,8 +143,8 @@ export default {
couponList: []
},
radioObj: [
{ name: '指定手机号', type: 'tel', placeholder: '客户需输入指定的手机号,才能成功领取礼包', maxlength: 11, active: true },
{ name: '指定车架号后6位', placeholder: '客户需输入指定的车架号,才能成功领取礼包', maxlength: 6 },
{ name: '指定手机号', type: 'tel', placeholder: '客户需输入指定的手机号,才能成功领取礼包', maxlength: 11, active: true, key: 'phone' },
{ name: '指定车架号后6位', placeholder: '客户需输入指定的车架号,才能成功领取礼包', maxlength: 6, key: 'vin' },
],
total: 0,
id: '',
......@@ -160,7 +160,8 @@ export default {
else this.flag = true
},
methods: {
input () {
input (i, e) {
if (i && i.key == 'vin') this.obj[i.key] = e.replace(/[^0-9a-zA-Z]/, '')
this.checkData()
},
getDetail (id) {
......@@ -179,6 +180,7 @@ export default {
radioObj.map(e => e.active = false)
radioObj[index].active = true
this.obj.receiveWay = index == 0 ? 1 : 2
this.checkData()
},
showGiftModal () {
this.$refs.GiftModal.toggle()
......@@ -192,12 +194,20 @@ export default {
},
checkData () {
let { obj } = this
let target = ['name', 'remarkName', 'couponList', 'receiveDetails']
let target = ['name', 'remarkName', 'couponList', 'phone', 'vin']
try {
target.map(key => {
if (!obj[key]) throw key
if (Array.isArray(obj[key])) {
if (!obj[key].length) throw key
if (key == 'phone' || key == 'vin') {
if (obj.receiveWay == 1) {
if (!obj.phone) throw key
} else {
if (!obj.vin) throw key
}
} else {
if (!obj[key]) throw key
if (Array.isArray(obj[key])) {
if (!obj[key].length) throw key
}
}
})
} catch (error) {
......@@ -219,12 +229,12 @@ export default {
if (disabled) return
let { obj, disabled, id } = this
if (obj.receiveWay == 1) {
if (!phoneRex.test(obj.receiveDetails)) {
if (!phoneRex.test(obj.phone)) {
this.showToast('请输入正确的手机号')
return
}
} else {
if (obj.receiveDetails.length < 6) {
if (obj.vin.length < 6) {
this.showToast('请输入车架号的后6位')
return
}
......@@ -249,9 +259,9 @@ export default {
name: obj.name,
remarkName: obj.remarkName,
receiveWay: obj.receiveWay,
receiveDetails: obj.receiveDetails,
giveReason: obj.giveReason,
couponCreateRequests
couponCreateRequests,
receiveDetails: obj.receiveWay == 1 ? obj.phone : obj.vin
}
if (id) params.id = id
this.showLoading('提交中...')
......
......@@ -32,7 +32,10 @@
<div class="value">{{obj.name}}</div>
</div>
<div class="item">
<div class="label">备注名称</div>
<div class="label">
备注名称
<span>(仅内部可见)</span>
</div>
<div class="value">{{obj.remarkName||''}}</div>
</div>
</div>
......@@ -81,7 +84,7 @@
<div class="box readonly-box">
<div class="title">赠送原因</div>
<div class="item">
{{obj.giveReason || '无'}}
{{obj.giveReason || '-'}}
</div>
</div>
<template v-if="obj.receivedFlag == 1">
......
......@@ -139,8 +139,9 @@ export default {
},
mounted () {
this.showLoading()
this.getList()
wxConfig.init(['sendChatMessage'])
wxConfig.init(['shareAppMessage'])
},
methods: {
getList () {
......@@ -193,17 +194,19 @@ export default {
this.getList()
},
send (e) {
console.log('fa')
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',
path: 'packageEquity/pages/directional/directional',
query: encodeURIComponent(query),
appId: shopmall_appid
})
.then(link => {
console.log(link)
wxConfig
.shareAppMessage({
title: e.name,
......@@ -223,8 +226,8 @@ export default {
this.$router.push({ name: 'gift.detail', query: { id } })
},
createQr (e) {
const { envVersion } = window.$fetchConfig
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
const { shopmall_appid } = window.$fetchConfig
let scene = `id=${e.id}&merchantId=${merchantId}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
......@@ -232,7 +235,7 @@ export default {
giftApi.createQr({
appId: shopmall_appid,
path: 'packageEquity/pages/directional/directional',
envVersion: IS_PROD ? 'release' : 'trial',
envVersion,
scene
}).then(res => {
this.hideLoading()
......@@ -258,6 +261,13 @@ export default {
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 10px;
/deep/.van-swipe-cell__wrapper{
width: 100.1%;
}
/deep/.van-swipe-cell__right{
border-radius: 0 4px 4px 0;
overflow: hidden;
}
}
}
.type-0 {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!