Commit ab9d69e6 by 李伟康

修改新用户购买相关BUG

1 parent 909e46e1
...@@ -27,7 +27,8 @@ export default { ...@@ -27,7 +27,8 @@ export default {
data.method = 'scrm.api.shopmall.weapp.order.create' data.method = 'scrm.api.shopmall.weapp.order.create'
return window.$HTTP({ return window.$HTTP({
url, url,
data data,
returnAll: true
}) })
}, },
/**创建支付订单(去付款) */ /**创建支付订单(去付款) */
......
<template> <template>
<div :class="['action isFullSucreen flex', { bgBlack: bgBlack }]" <div
v-if="show"> :class="['action isFullSucreen flex', { bgBlack: bgBlack }]"
<div class="btn-box flex" v-if="show"
v-show="!bgBlack"> >
<div class="item" <div
@click="getPoster"> class="btn-box flex"
v-show="!bgBlack"
>
<div
class="item"
@click="getPoster"
>
<div class="sprite-icon icon-poster"></div> <div class="sprite-icon icon-poster"></div>
海报 海报
</div> </div>
...@@ -14,10 +20,12 @@ ...@@ -14,10 +20,12 @@
{{ detail.price }} {{ detail.price }}
<span>.{{ detail.decimal }}</span> <span>.{{ detail.decimal }}</span>
</div> </div>
<div :class="['btn text-center', { disabled: iSMiniprogram || detail.activityStatus == 3 || detail.buyFlag == 2 }, { short: detail.buyFlag == 3 }]" <div
@click="submit" :class="['btn text-center', { disabled: iSMiniprogram || detail.activityStatus == 3 || detail.buyFlag == 2 }, { short: detail.buyFlag == 3 }]"
@touchstart="touchstart" @click="submit"
@touchend="touchend"> @touchstart="touchstart"
@touchend="touchend"
>
<template v-if="detail.activityStatus == 1 && detail.buyFlag != 2">预热下单</template> <template v-if="detail.activityStatus == 1 && detail.buyFlag != 2">预热下单</template>
<template v-else-if="detail.activityStatus == 3">活动已结束</template> <template v-else-if="detail.activityStatus == 3">活动已结束</template>
<template v-else> <template v-else>
...@@ -26,22 +34,32 @@ ...@@ -26,22 +34,32 @@
<template v-else>立即参团</template> <template v-else>立即参团</template>
</template> </template>
</div> </div>
<pay-modal v-model="showModal" <pay-modal
:list="formList" v-model="showModal"
@cancel="showModal = false" :list="formList"
@pay="checkOut" @cancel="showModal = false"
:payStatus="payStatus" @pay="checkOut"
:carInfo="carInfo" /> :payStatus="payStatus"
<van-overlay :show="showPoster" :carInfo="carInfo"
@click.self="showPoster = false"> />
<div class="wrapper" <van-overlay
@click.stop> :show="showPoster"
<van-image :src="posterImg" @click.self="showPoster = false"
width="100%" >
height="100%"> <div
class="wrapper"
@click.stop
>
<van-image
:src="posterImg"
width="100%"
height="100%"
>
<template v-slot:loading> <template v-slot:loading>
<van-loading type="spinner" <van-loading
size="20" /> type="spinner"
size="20"
/>
</template> </template>
</van-image> </van-image>
</div> </div>
...@@ -57,7 +75,7 @@ export default { ...@@ -57,7 +75,7 @@ export default {
watch: { watch: {
watchUpdataCarInfo: { watchUpdataCarInfo: {
immediate: true, immediate: true,
handler(n) { handler (n) {
let { let {
activityInfo: { carInfo }, activityInfo: { carInfo },
activityInfo } activityInfo }
...@@ -68,7 +86,7 @@ export default { ...@@ -68,7 +86,7 @@ export default {
}, },
watchInfo: { watchInfo: {
immediate: true, immediate: true,
handler(n) { handler (n) {
if (n.id) { if (n.id) {
let [price, decimal] = this.centsToyuan(n.retailPrice).toString().split('.') let [price, decimal] = this.centsToyuan(n.retailPrice).toString().split('.')
if (!decimal) decimal = '00' if (!decimal) decimal = '00'
...@@ -121,14 +139,14 @@ export default { ...@@ -121,14 +139,14 @@ export default {
} }
}, },
computed: { computed: {
watchInfo() { watchInfo () {
return this.$store.state.app.activityInfo return this.$store.state.app.activityInfo
}, },
watchUpdataCarInfo() { watchUpdataCarInfo () {
return this.$store.state.app.updataCarInfo return this.$store.state.app.updataCarInfo
} }
}, },
data() { data () {
return { return {
show: false, show: false,
showModal: false, showModal: false,
...@@ -146,11 +164,11 @@ export default { ...@@ -146,11 +164,11 @@ export default {
default: false default: false
} }
}, },
mounted() { mounted () {
this.iSMiniprogram = window.__wxjs_environment === 'miniprogram' this.iSMiniprogram = window.__wxjs_environment === 'miniprogram'
}, },
methods: { methods: {
submit() { submit () {
let { detail, iSMiniprogram } = this let { detail, iSMiniprogram } = this
if (iSMiniprogram) { if (iSMiniprogram) {
this.showToast('参团请拨打短信中咨询热线') this.showToast('参团请拨打短信中咨询热线')
...@@ -183,11 +201,15 @@ export default { ...@@ -183,11 +201,15 @@ export default {
shareStaffName: linkParams.shareStaffName || '', shareStaffName: linkParams.shareStaffName || '',
shareStaffImageUrl: linkParams.shareStaffImageUrl || '' shareStaffImageUrl: linkParams.shareStaffImageUrl || ''
} }
shopmallApi.createOrder(params).then(data => { shopmallApi.createOrder(params).then(({ data, code, message }) => {
that.pay(data) if (code == '0') that.pay(data)
else {
that.payStatus = Date.now()
that.showToast(message)
}
}) })
}, 1e3), }, 1e3),
pay(orderInfo) { pay (orderInfo) {
this.showLoading('结算中') this.showLoading('结算中')
this.payStatus = Date.now() this.payStatus = Date.now()
shopmallApi.payOrder({ shopmallApi.payOrder({
...@@ -228,7 +250,7 @@ export default { ...@@ -228,7 +250,7 @@ export default {
} else this.showToast(message) } else this.showToast(message)
}) })
}, },
getPoster() { getPoster () {
let { id } = this.detail let { id } = this.detail
let userInfo = this.getUserInfo() let userInfo = this.getUserInfo()
let { phone, nickName, logo } = userInfo let { phone, nickName, logo } = userInfo
......
<template> <template>
<van-action-sheet v-model="showBox" @click-overlay="onCancel" :lock-scroll="false"> <van-action-sheet
v-model="showBox"
@click-overlay="onCancel"
:lock-scroll="false"
>
<div class="box"> <div class="box">
<template v-for="(i, index) in items"> <template v-for="(i, index) in items">
<template v-if="i.name"> <template v-if="i.name">
<div class="item flex" :key="index"> <div
class="item flex"
:key="index"
>
<div class="label text-hide"> <div class="label text-hide">
<span>*</span> <span>*</span>
{{ i.name }} {{ i.name }}
</div> </div>
<div class="value"> <div class="value">
<template v-if="i.route"> <template v-if="i.route">
<van-field readonly :placeholder="`请选择您的${i.name}`" @click="jumpCarBrands(i.route)" v-model="params[i.key]" class="readonly" right-icon="arrow"></van-field> <van-field
readonly
:placeholder="`请选择您的${i.name}`"
@click="jumpCarBrands(i.route)"
v-model="params[i.key]"
class="readonly"
right-icon="arrow"
></van-field>
</template> </template>
<template v-else> <template v-else>
<van-field v-model="params[i.key]" :placeholder="`请填写您的${i.name}`" :maxlength="i.maxlength" :type="i.type" clearable /> <van-field
v-model="params[i.key]"
:placeholder="`请填写您的${i.name}`"
:maxlength="i.maxlength"
:type="i.type"
clearable
/>
</template> </template>
</div> </div>
</div> </div>
...@@ -23,10 +43,19 @@ ...@@ -23,10 +43,19 @@
本人已阅读且同意<span @click="jump('agreement')">《隐私协议》</span> 本人已阅读且同意<span @click="jump('agreement')">《隐私协议》</span>
</div> --> </div> -->
<template v-if="ISWXWORK"> <template v-if="ISWXWORK">
<van-button color="#b1b1b1" class="btn disabled">企微暂不支持支付</van-button> <van-button
color="#b1b1b1"
class="btn disabled"
>企微暂不支持支付</van-button>
</template> </template>
<template v-else> <template v-else>
<van-button color="#f13c3d" class="btn" @click="pay" loading-text="支付中..." :loading="payLoading">立即支付</van-button> <van-button
color="#f13c3d"
class="btn"
@click="pay"
loading-text="支付中..."
:loading="payLoading"
>立即支付</van-button>
</template> </template>
</div> </div>
</van-action-sheet> </van-action-sheet>
...@@ -60,13 +89,17 @@ export default { ...@@ -60,13 +89,17 @@ export default {
// { name: '电话', key: 'userPhone', maxlength: 11, type: 'tel' }, // { name: '电话', key: 'userPhone', maxlength: 11, type: 'tel' },
...this.list ...this.list
] ]
console.log(this.items)
let params = {} let params = {}
this.items.map(e => { this.items.map(e => {
params[e.key] = '' params[e.key] = ''
if (e.route) this.hasCarBrand = true if (e.route) this.hasCarBrand = true
if (e.key == 'userPhone') {
this.hasPhoneSelect = true
if (phone) params[e.key] = phone
}
}) })
this.params = params this.params = params
if (!this.params.userPhone) this.params.userPhone = phone
let { hasDefaultBrands, brandInfo } = this.$parent.detail let { hasDefaultBrands, brandInfo } = this.$parent.detail
if (hasDefaultBrands && !this.params.carBrandsText) { if (hasDefaultBrands && !this.params.carBrandsText) {
this.params.carBrandsText = `${brandInfo.vehicleBrandName} ${brandInfo.vehicleSubBrandName}` this.params.carBrandsText = `${brandInfo.vehicleBrandName} ${brandInfo.vehicleSubBrandName}`
...@@ -78,9 +111,11 @@ export default { ...@@ -78,9 +111,11 @@ export default {
}, },
carInfo (n) { carInfo (n) {
console.table([JSON.parse(JSON.stringify(n))]) console.table([JSON.parse(JSON.stringify(n))])
this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}` if (this.params) {
this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}` this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}`
} this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}`
}
},
}, },
data () { data () {
return { return {
...@@ -88,7 +123,8 @@ export default { ...@@ -88,7 +123,8 @@ export default {
payLoading: false, payLoading: false,
items: [], items: [],
params: null, params: null,
hasCarBrand: false hasCarBrand: false,
hasPhoneSelect: false
} }
}, },
mounted () { mounted () {
...@@ -99,7 +135,7 @@ export default { ...@@ -99,7 +135,7 @@ export default {
this.$emit('cancel') this.$emit('cancel')
}, },
pay () { pay () {
let { params, items, hasCarBrand, carInfo } = this, let { params, items, hasCarBrand, carInfo, hasPhoneSelect } = this,
obj = {}, obj = {},
phoneRex = /^[1]([3-9])[0-9]{9}$/, phoneRex = /^[1]([3-9])[0-9]{9}$/,
userInfo = this.getUserInfo(), userInfo = this.getUserInfo(),
...@@ -116,7 +152,7 @@ export default { ...@@ -116,7 +152,7 @@ export default {
this.showToast(`请填写${error}`) this.showToast(`请填写${error}`)
return return
} }
if (!phoneRex.test(params.userPhone)) { if (params.userPhone && !phoneRex.test(params.userPhone)) {
this.showToast('请填写正确的手机号') this.showToast('请填写正确的手机号')
return return
} }
...@@ -139,19 +175,22 @@ export default { ...@@ -139,19 +175,22 @@ export default {
} }
} }
if (userInfo.phone) this.emit(obj) if (userInfo.phone) this.emit(obj)
else ssoApi.captchaLogin({ else {
mobile: params.userPhone, if (!hasPhoneSelect) this.emit(obj)
captcha: 8888, else ssoApi.captchaLogin({
source: 'CROWDFUNDING_H5' mobile: params.userPhone,
}).then(({ code, data, message }) => { captcha: 8888,
if (code == '0') { source: 'CROWDFUNDING_H5'
this.setUserInfo(data) }).then(({ code, data, message }) => {
this.setSessionId(data.sessionId) if (code == '0') {
store.dispatch('registerHttp', data.sessionId) this.setUserInfo(data)
this.emit(obj) this.setSessionId(data.sessionId)
} store.dispatch('registerHttp', data.sessionId)
else Notify(message) this.emit(obj)
}) }
else Notify(message)
})
}
}, },
emit (obj) { emit (obj) {
console.log(obj) console.log(obj)
......
<template> <template>
<canvas :id="canvasId" class="create"></canvas> <canvas
:id="canvasId"
class="create"
></canvas>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -58,21 +61,22 @@ export default { ...@@ -58,21 +61,22 @@ export default {
canvasWidth = 337, canvasWidth = 337,
canvasHeight = 561, canvasHeight = 561,
carText = '', carText = '',
labelList = ['姓名:', '手机:'], labelList = ['姓名:'],
spacing = 0, spacing = 0,
textYList = [], textYList = [],
labelEndX = 80, labelEndX = 80,
lineNum = 2, lineNum = 2,
lineHeight = 24 lineHeight = 24,
valueList = [userName]
const draw = new Draw(this, { const draw = new Draw(this, {
width: canvasWidth, width: canvasWidth,
height: canvasHeight, height: canvasHeight,
// pixelRatio: 1 // pixelRatio: 1
}) })
let valueList = [ if (userPhone) {
userName, labelList.push('手机:')
userPhone, valueList.push(userPhone)
] }
if (plateNo) { if (plateNo) {
labelList.push('车牌号:') labelList.push('车牌号:')
valueList.push(plateNo) valueList.push(plateNo)
...@@ -84,7 +88,7 @@ export default { ...@@ -84,7 +88,7 @@ export default {
} }
labelList = [...labelList, '商品名称:', '支付时间:'] labelList = [...labelList, '商品名称:', '支付时间:']
valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')] valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
if(orderStatus != 10 && outTradeNo){ if (orderStatus != 10 && outTradeNo) {
labelList.push('商户订单号:') labelList.push('商户订单号:')
valueList.push(outTradeNo) valueList.push(outTradeNo)
} }
...@@ -176,6 +180,7 @@ export default { ...@@ -176,6 +180,7 @@ export default {
value.y = textYList[index] + 5 value.y = textYList[index] + 5
} }
draw.drawText(label) draw.drawText(label)
console.log('---------------', e, value)
draw.drawText(value) draw.drawText(value)
})) }))
draw.drawLine({ draw.drawLine({
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
module.exports = { module.exports = {
title: '加载中...', title: '加载中...',
request: { request: {
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址, baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!