对接生成二维码接口
parent
d0837aa8f7
commit
203718afa5
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view class="flex items-center justify-center flex-col pt-80rpx">
|
||||
<image class="w-400rpx h-400rpx" src="http://zcs-test.oss-cn-chengdu.aliyuncs.com/product-spus/cover/2022-04-22/f6f96cba9ba86197e58ea3c2ce93b2a1.jpg" mode="scaleToFill"></image>
|
||||
<image class="w-400rpx h-400rpx" :src="image"></image>
|
||||
<view class="mt-20rpx">请用户通过微信扫码进入小程序生成订单</view>
|
||||
<view class="grid grid-cols-2 gap-x-80rpx text-36rpx mt-120rpx">
|
||||
<view @click="toBack">门店管理</view>
|
||||
|
|
@ -13,9 +13,12 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
image:''
|
||||
};
|
||||
},
|
||||
onLoad({image}) {
|
||||
this.image=image
|
||||
},
|
||||
methods:{
|
||||
toBack(){
|
||||
uni.navigateBack({
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
<text class="ml-10rpx price-text text-hex-ef4444">{{vipPrice}}元</text>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="$u.route('/pageB/code/index')"
|
||||
class="bg-hex-ef4444 h-100rpx w-210rpx text-white text-center leading-100rpx ml-30rpx">生成二维码</view>
|
||||
<view @click="qrCode" class="bg-hex-ef4444 h-100rpx w-210rpx text-white text-center leading-100rpx ml-30rpx">
|
||||
生成二维码</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 无商品时 -->
|
||||
|
|
@ -57,6 +57,9 @@
|
|||
<view class="text-hex-909399 -mt-20rpx">请搜索您需要的商品</view>
|
||||
</view>
|
||||
</block>
|
||||
<cu-modal v-model="modeShow" @confirm="confirm" confirm-color="#378264" show-cancel-button content="是否生成二维码?"
|
||||
confirmText="确认" cancelText="再想想">
|
||||
</cu-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -68,6 +71,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modeShow: false,
|
||||
isShow: true,
|
||||
id: '',
|
||||
keyword: '',
|
||||
|
|
@ -134,6 +138,46 @@
|
|||
this.chooseList[Index].num = val
|
||||
this.chooseList[Index].defaultNum = val
|
||||
this.chooseList = [...this.chooseList]
|
||||
},
|
||||
qrCode() {
|
||||
if (this.chooseList.length == 0) {
|
||||
return this.$u.toast('至少选选择一件商品')
|
||||
}
|
||||
this.modeShow = true
|
||||
},
|
||||
//生成二维码
|
||||
async confirm() {
|
||||
uni.showLoading({
|
||||
title: '二维码生成中',
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
const arrList = this.chooseList.map(item => {
|
||||
return {
|
||||
sku_id: item.id,
|
||||
quantity: item.num,
|
||||
send: item.defaultNum
|
||||
}
|
||||
})
|
||||
const obj = {
|
||||
store_id: this.id,
|
||||
products: arrList,
|
||||
note: ''
|
||||
}
|
||||
const {
|
||||
image
|
||||
} = await this.$api.post(`/v1/order-pre`, obj);
|
||||
this.$u.route('/pageB/code/index', {
|
||||
image
|
||||
})
|
||||
this.keyword = ''
|
||||
this.list = []
|
||||
this.chooseList = []
|
||||
this.goodItem = {}
|
||||
this.isShow = true
|
||||
} catch (err) {}finally{
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
</view>
|
||||
<!-- -->
|
||||
<view class="flex items-center justify-end bg-white shadow-up fixed right-0 left-0 bottom-0 cu-bar tabbar">
|
||||
<view class="text-lg text-bgSubtitle mr-rowLg">-¥{{ discountCount }}</view>
|
||||
<view class="text-lg text-bgSubtitle mr-rowLg" v-if="discountCount">-¥{{ discountCount }}</view>
|
||||
<view class="text-md text-txBase">
|
||||
合计: <text class="text-xl text-txSvip">¥{{ detail.total_amount }}</text>
|
||||
</view>
|
||||
|
|
@ -103,14 +103,14 @@ export default {
|
|||
// name: '支付宝',
|
||||
// pay_way: 'alipay',
|
||||
// },
|
||||
{
|
||||
name: '可提',
|
||||
pay_way: 'wallet',
|
||||
},
|
||||
{
|
||||
name: '余额',
|
||||
pay_way: 'balance',
|
||||
},
|
||||
// {
|
||||
// name: '可提',
|
||||
// pay_way: 'wallet',
|
||||
// },
|
||||
// {
|
||||
// name: '余额',
|
||||
// pay_way: 'balance',
|
||||
// },
|
||||
],
|
||||
payWay: 'wxpay',
|
||||
detail: {},
|
||||
|
|
|
|||
|
|
@ -360,8 +360,7 @@ export default {
|
|||
},
|
||||
//是否为店员
|
||||
is_company(){
|
||||
// return this.user?.is_company??false
|
||||
return true
|
||||
return this.user?.is_company??false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view class="pt-24rpx">
|
||||
<u-navbar>
|
||||
<u-navbar :custom-back="goJump">
|
||||
<view slot="right" class="flex items-center">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="px-18rpx relative" @tap="$u.route(`/pages/web_view/index?url=${service}`)">
|
||||
|
|
@ -226,7 +226,6 @@ export default {
|
|||
},
|
||||
onLoad({ id }) {
|
||||
this.id = id;
|
||||
// this.getDetail();
|
||||
},
|
||||
onShow() {
|
||||
this.getDetail();
|
||||
|
|
@ -244,6 +243,18 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
//判断是否有页面栈,如果没有返回首页,否则返回上一页
|
||||
goJump(){
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2]
|
||||
if(prevPage){
|
||||
uni.navigateBack({})
|
||||
}else{
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}
|
||||
},
|
||||
//复制
|
||||
copy(val) {
|
||||
uniCopy({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { strToParams } from '@/utils/tools';
|
||||
import {
|
||||
strToParams
|
||||
} from '@/utils/tools';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -13,12 +15,31 @@
|
|||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
console.log(e);
|
||||
const scene = strToParams(decodeURIComponent(e.scene))
|
||||
console.log(scene);
|
||||
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)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue