6
0
Fork 0

order-pre

hui.zhou
panliang 2023-02-11 11:05:11 +08:00
parent 14b16f2b49
commit b88ba1c865
4 changed files with 91 additions and 46 deletions

View File

@ -130,6 +130,7 @@
export default {
data() {
return {
type: '',
couponId: '',
goodsList: [],
orderInfo: {},

View File

@ -3,8 +3,8 @@
<view class="u-search-box bg-white">
<view class="flex items-center">
<view class="mr-15rpx">商品信息</view>
<u-search class="flex-1" placeholder="货号或名称" :show-action="false"> </u-search>
<u-icon class="ml-20rpx" name="scan" color="#333333" size="48"></u-icon>
<u-search v-model="keywords" class="flex-1" placeholder="货号或名称" :show-action="false" @search="search" />
<u-icon class="ml-20rpx" name="scan" color="#333333" size="48" @tap="scan" />
</view>
</view>
<view class="u-menu-wrap">
@ -21,26 +21,26 @@
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box" @scroll="rightScroll">
<view class="page-view">
<block v-for="(item, index) in tabbar" :key="index">
<view class="classSel" :id="'item' + index">
<view class="class-item" v-for="(item1, index1) in item.children" :key="index1">
<view class="item-title">
<text>{{ item1.name }}</text>
</view>
<!-- 广告位 -->
<view class="my-20rpx shdow2 h-200rpx" v-if="item1.icon">
<image class="w-full h-full rounded-15rpx " :src="item1.icon" mode="aspectFill"></image>
</view>
<view class="item-container">
<view @click="navigateToList(item2.id)" class="thumb-box" v-for="(item2, index2) in item1.children" :key="index2">
<image v-if="item2.icon" class="item-menu-image" :src="item2.icon" mode=""></image>
<view class="item-menu-name">{{ item2.name }}</view>
</view>
</view>
</view>
</view>
</block>
</view>
<block v-for="(item, index) in tabbar" :key="index">
<view class="classSel" :id="'item' + index">
<view class="class-item" v-for="(item1, index1) in item.children" :key="index1">
<view class="item-title">
<text>{{ item1.name }}</text>
</view>
<!-- 广告位 -->
<view class="my-20rpx shdow2 h-200rpx" v-if="item1.icon">
<image class="w-full h-full rounded-15rpx" :src="item1.icon" mode="aspectFill"></image>
</view>
<view class="item-container">
<view @click="navigateToList(item2.id)" class="thumb-box" v-for="(item2, index2) in item1.children" :key="index2">
<image v-if="item2.icon" class="item-menu-image" :src="item2.icon" mode=""></image>
<view class="item-menu-name">{{ item2.name }}</view>
</view>
</view>
</view>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
@ -50,6 +50,7 @@ export default {
data() {
return {
mid: '',
keywords: '',
scrollTop: 0, //tab
oldScrollTop: 0,
current: 0, //
@ -64,10 +65,10 @@ export default {
};
},
onLoad(e) {
this.mid = e.mid
this.$api.get('/v1/product/categories').then(res => {
this.tabbar = res
})
this.mid = e.mid;
this.$api.get('/v1/product/categories').then((res) => {
this.tabbar = res;
});
},
onReady() {
this.getMenuItemTop();
@ -190,8 +191,24 @@ export default {
}, 10);
},
navigateToList(cid) {
this.$u.route('/pageB/select_product/search', { mid: this.mid, cid: cid })
}
this.$u.route('/pageB/select_product/search', { mid: this.mid, cid: cid });
},
search() {
this.$u.route('/pageB/select_product/search', { mid: this.mid, keywords: this.keywords });
},
scan() {
//#ifdef MP-WEIXIN
uni.scanCode({
onlyFromCamera: true,
success: ({ result }) => {
this.$u.route('/pageB/select_product/search', { mid: this.mid, keywords: result });
},
fail: (err) => {
this.$u.toast('扫码失败,请重新扫描');
},
});
//#endif
},
},
};
</script>

View File

@ -1,18 +1,14 @@
<template>
<view class="">
<loading-view v-if="isFirstLoading"></loading-view>
<view class="text-center text-42rpx pt-30rpx">
线上预约店
</view>
<view class="my-20rpx px-20rpx">
<view class="text-center text-42rpx pt-30rpx">线上预约店</view>
<view class="my-20rpx px-80rpx" @tap="navigateToCategory">
<image mode="widtFix" class="w-full h-250rpx rounded-15rpx" src="/static/images/user/u=2313295534,3451005153&fm=253&fmt=auto&app=138&f=JPEG.webp"></image>
</view>
<view class="my-20rpx px-20rpx">
<view class="my-20rpx px-80rpx">
<u-line></u-line>
</view>
<view class="text-center text-42rpx">
线下预约店
</view>
<view class="text-center text-42rpx">线下预约店</view>
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
<view class="grid grid-cols-2 gap-x-80rpx pt-20rpx px-80rpx">
<view
@ -76,6 +72,12 @@ export default {
this.mescroll.endErr();
});
},
navigateToCategory() {
uni.setStorageSync('store_order_pre', 1)
uni.switchTab({
url: '/pages/sort/index'
})
},
},
};
</script>

View File

@ -128,8 +128,15 @@
</view>
<!-- -->
<view class="border-t border-txBorder pt-base text-md">
<textarea :adjust-position="false" v-model="remarks" class="min-h-130rpx w-full" placeholder-style="text-h999"
placeholder="订单备注:" maxlength="100" auto-height></textarea>
<textarea
v-model="remarks"
:adjust-position="false"
class="min-h-130rpx w-full"
placeholder-style="text-h999"
placeholder="订单备注:"
maxlength="100"
auto-height
/>
</view>
</view>
@ -154,13 +161,9 @@
<view class="text-md text-txBase">
合计: <text class="text-xl" v-if="orderInfo.total_points >0"> {{orderInfo.total_points}}积分+</text> <text class="text-xl text-txSvip">{{ orderInfo.total_amount }}</text>
</view>
<view @tap="createOrder"
class="w-180rpx h-66rpx leading-66rpx text-center text-lg ml-40rpx text-white bg-primary rounded-lg mr-base"> 提交订单
</view>
<view @tap="createOrder" class="w-180rpx h-66rpx leading-66rpx text-center text-lg ml-40rpx text-white bg-primary rounded-lg mr-base">提交订单</view>
<view v-if="is_company" @tap="createPreOrder" class="w-180rpx h-66rpx leading-66rpx text-center text-lg ml-20rpx text-white bg-hex-D43030 rounded-lg mr-base"></view>
</view>
</view>
</template>
@ -223,6 +226,13 @@
//
isDistribution() {
return this.orderInfo?.shipping_supported ?? false;
},
user() {
return this.$store.getters.user ?? {};
},
//
is_company() {
return this.user?.is_company ?? false
}
},
onShow() {
@ -385,8 +395,23 @@
const resData = await this.$api.get('/v1/shipping-addresses')
this.addressAry = resData
},
createPreOrder() {
const params = {
products: this.goodsList.map(item => {
return {
sku_id: item.sku.id,
quantity: item.quantity,
send: item.quantity
}
}),
note: this.remarks
}
uni.showLoading()
this.$api.post(`/v1/order-pre`, params).then(res => {
uni.hideLoading()
this.$u.route('/pageB/code/index', { id: res.order_pre })
})
}
},
watch: {
couponShow(e) {