对接生成二维码接口
parent
d0837aa8f7
commit
203718afa5
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="flex items-center justify-center flex-col pt-80rpx">
|
<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="mt-20rpx">请用户通过微信扫码进入小程序生成订单</view>
|
||||||
<view class="grid grid-cols-2 gap-x-80rpx text-36rpx mt-120rpx">
|
<view class="grid grid-cols-2 gap-x-80rpx text-36rpx mt-120rpx">
|
||||||
<view @click="toBack">门店管理</view>
|
<view @click="toBack">门店管理</view>
|
||||||
|
|
@ -13,9 +13,12 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
image:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
onLoad({image}) {
|
||||||
|
this.image=image
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
toBack(){
|
toBack(){
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@
|
||||||
<text class="ml-10rpx price-text text-hex-ef4444">{{vipPrice}}元</text>
|
<text class="ml-10rpx price-text text-hex-ef4444">{{vipPrice}}元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view @click="$u.route('/pageB/code/index')"
|
<view @click="qrCode" class="bg-hex-ef4444 h-100rpx w-210rpx text-white text-center leading-100rpx ml-30rpx">
|
||||||
class="bg-hex-ef4444 h-100rpx w-210rpx text-white text-center leading-100rpx ml-30rpx">生成二维码</view>
|
生成二维码</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<!-- 无商品时 -->
|
<!-- 无商品时 -->
|
||||||
|
|
@ -57,6 +57,9 @@
|
||||||
<view class="text-hex-909399 -mt-20rpx">请搜索您需要的商品</view>
|
<view class="text-hex-909399 -mt-20rpx">请搜索您需要的商品</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
<cu-modal v-model="modeShow" @confirm="confirm" confirm-color="#378264" show-cancel-button content="是否生成二维码?"
|
||||||
|
confirmText="确认" cancelText="再想想">
|
||||||
|
</cu-modal>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -68,6 +71,7 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
modeShow: false,
|
||||||
isShow: true,
|
isShow: true,
|
||||||
id: '',
|
id: '',
|
||||||
keyword: '',
|
keyword: '',
|
||||||
|
|
@ -134,6 +138,46 @@
|
||||||
this.chooseList[Index].num = val
|
this.chooseList[Index].num = val
|
||||||
this.chooseList[Index].defaultNum = val
|
this.chooseList[Index].defaultNum = val
|
||||||
this.chooseList = [...this.chooseList]
|
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>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="flex items-center justify-end bg-white shadow-up fixed right-0 left-0 bottom-0 cu-bar tabbar">
|
<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">
|
<view class="text-md text-txBase">
|
||||||
合计: <text class="text-xl text-txSvip">¥{{ detail.total_amount }}</text>
|
合计: <text class="text-xl text-txSvip">¥{{ detail.total_amount }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -103,14 +103,14 @@ export default {
|
||||||
// name: '支付宝',
|
// name: '支付宝',
|
||||||
// pay_way: 'alipay',
|
// pay_way: 'alipay',
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
name: '可提',
|
// name: '可提',
|
||||||
pay_way: 'wallet',
|
// pay_way: 'wallet',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '余额',
|
// name: '余额',
|
||||||
pay_way: 'balance',
|
// pay_way: 'balance',
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
payWay: 'wxpay',
|
payWay: 'wxpay',
|
||||||
detail: {},
|
detail: {},
|
||||||
|
|
|
||||||
|
|
@ -360,8 +360,7 @@ export default {
|
||||||
},
|
},
|
||||||
//是否为店员
|
//是否为店员
|
||||||
is_company(){
|
is_company(){
|
||||||
// return this.user?.is_company??false
|
return this.user?.is_company??false
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="pt-24rpx">
|
<view class="pt-24rpx">
|
||||||
<u-navbar>
|
<u-navbar :custom-back="goJump">
|
||||||
<view slot="right" class="flex items-center">
|
<view slot="right" class="flex items-center">
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<view class="px-18rpx relative" @tap="$u.route(`/pages/web_view/index?url=${service}`)">
|
<view class="px-18rpx relative" @tap="$u.route(`/pages/web_view/index?url=${service}`)">
|
||||||
|
|
@ -226,7 +226,6 @@ export default {
|
||||||
},
|
},
|
||||||
onLoad({ id }) {
|
onLoad({ id }) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
// this.getDetail();
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getDetail();
|
this.getDetail();
|
||||||
|
|
@ -244,6 +243,18 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//判断是否有页面栈,如果没有返回首页,否则返回上一页
|
||||||
|
goJump(){
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const prevPage = pages[pages.length - 2]
|
||||||
|
if(prevPage){
|
||||||
|
uni.navigateBack({})
|
||||||
|
}else{
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
//复制
|
//复制
|
||||||
copy(val) {
|
copy(val) {
|
||||||
uniCopy({
|
uniCopy({
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { strToParams } from '@/utils/tools';
|
import {
|
||||||
|
strToParams
|
||||||
|
} from '@/utils/tools';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -13,12 +15,31 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
console.log(e);
|
||||||
const scene = strToParams(decodeURIComponent(e.scene))
|
const scene = strToParams(decodeURIComponent(e.scene))
|
||||||
|
console.log(scene);
|
||||||
if (scene.product) {
|
if (scene.product) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/product_details/index?skuId=' + scene.product
|
url: '/pages/product_details/index?skuId=' + scene.product
|
||||||
})
|
})
|
||||||
uni.setStorageSync('INVITE_CODE', scene.code)
|
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