6
0
Fork 0
hui.zhou
h30830569 2022-06-10 13:20:55 +08:00
parent 77b80fe18b
commit 6f2734d8f9
3 changed files with 39 additions and 24 deletions

View File

@ -15,7 +15,7 @@ export default {
this.$store.dispatch('app/getArticle');
/* #ifdef MP-WEIXIN */
// wxMnpLogin()
// wxMnpLogin()
/* #endif */
// #ifdef APP-PLUS
@ -29,11 +29,13 @@ export default {
// #endif
},
onShow(option) {
console.log(option);
let invite_code = option.query.invite_code || strToParams(decodeURIComponent(option.query.scene)).invite_code
uni.setStorageSync('INVITE_CODE',invite_code)
/* #ifdef MP-WEIXIN */
wxMnpLogin()
if(!invite_code){
wxMnpLogin()
}
/* #endif */
},
onHide: function () {

View File

@ -27,7 +27,7 @@
</view>
</u-form-item>
</u-form>
<view class="flex justify-between mt-45rpx">
<text class="text-md" @tap="$u.route('/pageA/reset_password/login', { type: 0 })">忘记密码</text>
<text class="text-md text-primary" @tap="$u.route('/pages/register/index')"></text>
@ -98,8 +98,8 @@ export default {
// this.$refs.uForm.setRules(this.rules);
},
async onLoad({ type, phone,redirec}) {
this.redirec = redirec
this.form.phone = phone ?? '';
/* #ifdef MP-WEIXIN */

View File

@ -8,37 +8,23 @@
import {
strToParams
} from '@/utils/tools';
import { wxMnpLogin } from '@/utils/login'
export default {
data() {
return {
scene:null
};
},
onLoad(e) {
const scene = strToParams(decodeURIComponent(e.scene))
console.log(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) {
setTimeout(async () => {
uni.showLoading({
title: '加载中',
mask: true
});
const obj = {
id: scene.order_pre
}
const {
order_id
} = await this.$api.post(`/v1/order-pre/order`, obj)
uni.hideLoading()
uni.redirectTo({
url: '/pages/order_details/index?id=' + order_id
})
}, 1000)
}else if(scene.invite_code){
uni.redirectTo({
url: '/pages/index/index'
@ -46,6 +32,33 @@
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>