6
0
Fork 0
jiqu-library-miniprogram/src/pages/welcome/index.vue

68 lines
1.5 KiB
Vue

<template>
<view>
</view>
</template>
<script>
import {
strToParams
} from '@/utils/tools';
import { wxMnpLogin } from '@/utils/login'
export default {
data() {
return {
scene:null
};
},
onLoad(e) {
const scene = strToParams(decodeURIComponent(e.scene))
this.scene=scene
uni.setStorageSync('INVITE_CODE', scene.invite_code)
if (scene.product) {
uni.redirectTo({
url: '/pages/product_details/index?skuId=' + scene.product
})
uni.setStorageSync('INVITE_CODE', scene.code)
} else if (scene.order_pre) {
}else if(scene.invite_code){
uni.redirectTo({
url: '/pages/index/index'
})
uni.setStorageSync('INVITE_CODE', scene.invite_code)
}
},
onShow() {
if(this.scene.order_pre){
this.getOrder(this.scene.order_pre)
}
},
methods:{
//生成订单
async getOrder(id){
try{
const obj = {
id:id
}
const {order_id}=await this.$api.post(`/v1/order-pre/order`,obj,{
custom:{
silence:true
}
})
uni.redirectTo({
url: '/pages/order_details/index?id=' + order_id
})
}catch(err){
if(err.errcode==401){
uni.navigateTo({ url: '/pages/login/index' })
}
}
}
}
}
</script>
<style lang="scss">
</style>