Commit b8f1df88 by 李伟康

提交代码

1 parent de6d710f
...@@ -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,
// 携带凭证 // 携带凭证
......
...@@ -40,14 +40,11 @@ export default { ...@@ -40,14 +40,11 @@ export default {
}, },
mounted () { mounted () {
let data = this.getLocalStorage('wx_scrm_car_brand_list') let data = this.getLocalStorage('wx_scrm_car_brand_list')
if (data) { if (data) this.formatData(data)
this.formatData(data) else carLifeApi.getCarBrandList().then(carInfo => {
} else { this.setLocalStorage('wx_scrm_car_brand_list', carInfo)
carLifeApi.getCarBrandList().then(data => { this.formatData(carInfo)
this.setLocalStorage('wx_scrm_car_brand_list', data)
this.formatData(data)
}) })
}
}, },
methods: { methods: {
formatData (data) { formatData (data) {
......
...@@ -82,6 +82,10 @@ export default { ...@@ -82,6 +82,10 @@ export default {
this.showType = false this.showType = false
this.indexList = [] this.indexList = []
let { list, brandInfo } = this.getParams() let { list, brandInfo } = this.getParams()
if (!list || !list.length) {
this.$router.back()
return
}
this.list = list this.list = list
this.brandInfo = brandInfo this.brandInfo = brandInfo
list.map((e, index) => { list.map((e, index) => {
......
<template> <template>
<div <div
class="action isFullSucreen flex" :class="['action isFullSucreen flex']"
v-if="show" v-if="show"
> >
<div class="btn-box flex"> <div class="btn-box flex">
...@@ -155,14 +155,16 @@ export default { ...@@ -155,14 +155,16 @@ export default {
shareStaffImageUrl: linkParams.shareStaffImageUrl || '' shareStaffImageUrl: linkParams.shareStaffImageUrl || ''
} }
shopmallApi.createOrder(params).then(data => { shopmallApi.createOrder(params).then(data => {
that.pay(data.orderCode) that.pay(data)
}) })
}, 1e3), }, 1e3),
pay (orderCode) { pay (orderInfo) {
this.to('crowdfunding.success', { orderInfo })
return
this.showLoading('结算中') this.showLoading('结算中')
this.payStatus = Date.now() this.payStatus = Date.now()
shopmallApi.payOrder({ shopmallApi.payOrder({
orderCode orderCode: orderInfo.orderCode
}).then(({ code, data, message }) => { }).then(({ code, data, message }) => {
this.hideLoading() this.hideLoading()
if (code == '0') { if (code == '0') {
...@@ -176,8 +178,8 @@ export default { ...@@ -176,8 +178,8 @@ export default {
timestamp: payParams.timeStamp, timestamp: payParams.timeStamp,
packages: payParams.packages packages: payParams.packages
} }
wxConfig.chooseWXPay(params).then(() => this.$router.push({ name: 'crowdfunding.success' })) wxConfig.chooseWXPay(params).then(() => this.to('crowdfunding.success', { orderInfo }))
} else this.$router.push({ name: 'crowdfunding.success' }) } else this.to('crowdfunding.success', { orderInfo })
} else this.showToast(message) } else this.showToast(message)
}) })
}, },
...@@ -205,23 +207,12 @@ export default { ...@@ -205,23 +207,12 @@ export default {
this.posterImg = res this.posterImg = res
this.showPoster = true this.showPoster = true
}) })
},
jump () {
console.log(123)
} }
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
@keyframes showAction {
form {
bottom: -100%;
}
to {
bottom: 0;
}
}
.action { .action {
position: fixed; position: fixed;
left: 0; left: 0;
...@@ -230,7 +221,7 @@ export default { ...@@ -230,7 +221,7 @@ export default {
background: #ffffff; background: #ffffff;
z-index: 3; z-index: 3;
padding: 0 16px; padding: 0 16px;
animation: showAction 0.5s forwards; animation: show-goods-action 0.5s forwards;
.btn-box { .btn-box {
font-size: 13px; font-size: 13px;
font-weight: bold; font-weight: bold;
...@@ -294,6 +285,14 @@ export default { ...@@ -294,6 +285,14 @@ export default {
width: 150px; width: 150px;
} }
} }
@keyframes show-goods-action {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
.isFullSucreen { .isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important; padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important; padding-bottom: env(safe-area-inset-bottom) !important;
......
...@@ -30,26 +30,64 @@ export default { ...@@ -30,26 +30,64 @@ export default {
img: null img: null
} }
}, },
activated () {
let { orderInfo } = this.getParams()
if (orderInfo) this.setLocalStorage('wx_scrm_test', orderInfo)
else orderInfo = this.getLocalStorage('wx_scrm_test')
this.drawOrderImg(orderInfo)
return
if (!orderInfo || !Object.keys(orderInfo).length) {
this.$router.back()
return
}
},
mounted () { mounted () {
this.drawOrderImg() // this.drawOrderImg()
//
}, },
methods: { methods: {
drawOrderImg () { drawOrderImg (orderInfo) {
let labelList = ['姓名:', '手机:', '车牌号:', '品牌车型:', '商品名称:', '支付时间:', '支付定金']
let valueList = ['恒河猴',
'18888888888',
'粤B12345',
'奥迪奥迪Q5L Sportback2022款 40 TFSI RS套件燃速型',
'氛围灯', '2022年8月3日 17:43:48', '199元']
let textYList = [109, 141, 173, 205, 261, 293, 352]
this.ctx = document.getElementById('canvas') this.ctx = document.getElementById('canvas')
let {
activityJoin,
payPrice,
orderGoods: [orderGoods]
} = orderInfo,
valueX = 98,
labelX = 20,
valueWidth = 303,
fontSize = 14,
textBaseline = 'top',
canvasWidth = 343,
canvasHeight = 422,
carText = '',
labelList = ['姓名:', '手机:'],
spacing = 0,
textYList = []
const draw = new Draw(this, { const draw = new Draw(this, {
width: 343, width: canvasWidth,
height: 422, height: canvasHeight
})
console.log(activityJoin)
let valueList = [
activityJoin.userName,
activityJoin.userPhone,
]
if (activityJoin.plateNo) {
labelList.push('车牌号:')
valueList.push(activityJoin.plateNo)
}
if (activityJoin.vehicleBrandName) {
carText = `${activityJoin.vehicleBrandName || ''} ${activityJoin.vehicleSubBrandName || ''} ${activityJoin.vehicleSeriesName || ''} ${activityJoin.vehicleShapeName || ''}`
labelList.push('品牌车型:')
valueList.push(carText)
}
labelList = [...labelList, '商品名称:', '支付时间:', '支付定金']
valueList = [...valueList, orderGoods.goodsName, new Date().format('yyyy年M月d日 hh:mm:ss'), `${payPrice}元`]
labelList.map((e, index) => {
if (e == '商品名称:' && draw.getTextWidth(carText) + valueX > valueWidth) spacing = 24
if (index == labelList.length - 1) textYList.push(352)
else textYList.push(index * 32 + 109 + spacing)
}) })
draw.drawImages({ draw.drawImages({
url: require('@/assets/images/order-bg.png'), url: require('@/assets/images/order-bg.png'),
x: 0, x: 0,
...@@ -58,12 +96,10 @@ export default { ...@@ -58,12 +96,10 @@ export default {
height: 422, height: 422,
}, () => { }, () => {
labelList && labelList.length > 0 && (labelList.map((e, index) => { labelList && labelList.length > 0 && (labelList.map((e, index) => {
let y = textYList[index] + 7, let y = textYList[index] + 7
fontSize = 14,
textBaseline = 'top'
let label = { let label = {
text: e, text: e,
x: 20, x: labelX,
y, y,
color: '#999', color: '#999',
fontSize, fontSize,
...@@ -71,12 +107,12 @@ export default { ...@@ -71,12 +107,12 @@ export default {
} }
let value = { let value = {
text: valueList[index], text: valueList[index],
x: 98, x: valueX,
y, y,
color: '#282829', color: '#282829',
fontSize, fontSize,
textBaseline, textBaseline,
width: 303 width: valueWidth
} }
if (e === '品牌车型:') { if (e === '品牌车型:') {
value.lineNum = 2 value.lineNum = 2
...@@ -100,7 +136,6 @@ export default { ...@@ -100,7 +136,6 @@ export default {
width: 1, width: 1,
color: '#F1F1F1' color: '#F1F1F1'
}) })
this.ctx.getContext('2d').fillText('newText', 20, 109)
this.img = this.ctx.toDataURL('image/png') this.img = this.ctx.toDataURL('image/png')
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!