Merge branch 'master' of https://gitea.zianxin.com/zax/biz-mobile-react-cloud
This commit is contained in:
commit
2baaa6d7a8
5 files changed
+104
-23
No files matched your search
@@ -57,7 +57,7 @@
|
||||
|
||||
<template #main-bottom>
|
||||
<view class="z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<product-total :totPrice="totPrice" :totCount="totalCount" @doContainer="doCart" @submit="goSettlement" />
|
||||
<product-total :totPrice="totPrice" :totCount="totalCount" @doContainer="doCart" @submit="goSettlement(state.mchId)" />
|
||||
</view>
|
||||
</template>
|
||||
</crud-layout>
|
||||
|
||||
@@ -6,16 +6,21 @@
|
||||
<tm-sticky-header>
|
||||
<view class="h-20rpx" />
|
||||
<view class="card p-20rpx">
|
||||
<view class="text-36rpx">请选择自提点</view>
|
||||
<!-- <tm-picker rang-key="title" rang-text="title" v-model="state.curPickUp" v-model:model-str="state.curPickUp" :list="state.pickUpList"> -->
|
||||
<view class="flex-row items-center justify-between">
|
||||
<view class="sub-text-28">请选择自提点</view>
|
||||
<view class="text-36rpx mb-2">请选择自提点</view>
|
||||
<view class="flex-row items-center justify-between" @click="onPickupPoint">
|
||||
<view v-if="curPickup.id" class="sub-text-30 mb-2 flex items-center">
|
||||
<image class="size-80rpx rounded-1 mr-2" :src="filePath(curPickup.logo)" />
|
||||
<view>
|
||||
<view>{{ curPickup.name }}</view>
|
||||
<view class="sub-text-26">{{ curPickup.phone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="sub-text-30 mb-2">请选择自提点</view>
|
||||
<view class="flex-row items-center second-text-24">
|
||||
<text>{{ 0 || "请选择自提点" }} </text>
|
||||
<text>请选择自提点</text>
|
||||
<text class="ml-10rpx color-#b1b1b1 iconfont icon-xiangxiajiantouxiao" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- </tm-picker> -->
|
||||
<view class="c-#0089ff text-24rpx">配送订单较多时,配送时间可能波动</view>
|
||||
</view>
|
||||
<view class="h-20rpx" />
|
||||
@@ -35,7 +40,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="text-center second-text-28">你尚未选择任何商品</view>
|
||||
<view v-else class="text-center second-text-28 py-20">你尚未选择任何商品</view>
|
||||
</view>
|
||||
<view class="h-20rpx" />
|
||||
|
||||
@@ -45,22 +50,99 @@
|
||||
<view class="second-text-36 color-#f63a36!">¥ {{ hooks.useMoney(totPrice) }}</view>
|
||||
<view class="sub-text-28">共{{ totalCount }}件</view>
|
||||
</view>
|
||||
<view class="bg-#0094ff px-60rpx py-20rpx text-center rounded-full sub-text-32 color-white!" @tap.stop="doBuy">提交订单</view>
|
||||
<view class="bg-#0094ff px-60rpx py-20rpx text-center rounded-full sub-text-32 color-white!" @tap.stop="submitOrder">提交订单</view>
|
||||
</view>
|
||||
</template>
|
||||
</crud-layout>
|
||||
|
||||
<tm-drawer v-model:show="state.showDrawer" title="自提点" :showClose="true" :showFooter="false" size="98%" bgColor="#F3FAFF">
|
||||
<z-paging
|
||||
ref="pageRef"
|
||||
height="98%"
|
||||
v-model="pageHook.list"
|
||||
:default-page-size="10"
|
||||
safe-area-inset-bottom
|
||||
:loading-more-enabled="true"
|
||||
@query="query"
|
||||
:auto-clean-list-when-reload="false"
|
||||
:auto-scroll-to-top-when-reload="false"
|
||||
@scroll="pageHook.scroll"
|
||||
>
|
||||
<view class="h-100rpx"></view>
|
||||
<tm-radio-group v-model="state.curPickupId" direction="column" @change="radioChange">
|
||||
<tm-radio v-for="(v, i) in pageHook.list" :key="i" class="w-full h-full px-2" :value="v.id">
|
||||
<template v-slot:label="checked">
|
||||
<view class="card p-2">
|
||||
<view class="flex items-center mb-1">
|
||||
<image class="size-140rpx rounded-12rpx mr-2" :src="filePath(v.logo)" mode="aspectFill" />
|
||||
<view class="flex-1 overflow-hidden">
|
||||
<view class="sub-text-30 truncate">{{ v.name }}</view>
|
||||
<view class="sub-text-26">{{ v.phone }}</view>
|
||||
<view class="sub-text-24" v-for="(item, index) in JSON.parse(v.businessHoursJson)" :key="index">
|
||||
<text>{{ item.title }}:</text>
|
||||
<text>{{ item.startTime }} ~ </text>
|
||||
<text>{{ item.endTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<tm-text class="mx-3 mb-1">地址:{{ v.detailAddress }}</tm-text>
|
||||
<tm-collapse @click.stop>
|
||||
<tm-collapse-item :name="i" title="简介" titleFontSize="28" activeColor="#000" titleHeight="40" :showBottomLine="false">
|
||||
<tm-text>{{ v.introduction }}</tm-text>
|
||||
<template #right>
|
||||
<text class="second-text-24">展开</text>
|
||||
</template>
|
||||
</tm-collapse-item>
|
||||
</tm-collapse>
|
||||
</view>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</tm-radio-group>
|
||||
</z-paging>
|
||||
</tm-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from "vue"
|
||||
import { computed, reactive, ref } from "vue"
|
||||
import { hooks } from "@/sheep"
|
||||
import useCartBuy from "./use-cart-buy"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { walletApi } from "@/sheep/api"
|
||||
|
||||
const { cartList, totPrice, totalCount, doBuy } = useCartBuy()
|
||||
const { cartList, totPrice, totalCount, getShopCart, doBuy } = useCartBuy()
|
||||
|
||||
const state = reactive({
|
||||
pickUpList: [],
|
||||
curPickUp: {},
|
||||
const state = reactive<any>({
|
||||
mchId: "",
|
||||
showDrawer: false,
|
||||
curPickupId: "",
|
||||
})
|
||||
const curPickup = computed(() => {
|
||||
return pageHook.list.find((item: any) => item.id === state.curPickupId) || {}
|
||||
})
|
||||
const pageRef = ref<any>(null)
|
||||
const pageHook = hooks.usePage(pageRef, walletApi.pickUpPage, null, "data.records")
|
||||
const query = (page: number, pagesize: number) => {
|
||||
pageHook.startPage(page, pagesize, false, { mchId: state.mchId })
|
||||
}
|
||||
|
||||
onLoad((option: any) => {
|
||||
const { mchId } = option
|
||||
if (!mchId) return uni.showToast({ title: "参数错误", icon: "error" })
|
||||
state.mchId = option.mchId
|
||||
getShopCart(mchId)
|
||||
})
|
||||
|
||||
// 选择自提点
|
||||
const onPickupPoint = () => {
|
||||
state.showDrawer = true
|
||||
}
|
||||
const radioChange = () => {
|
||||
state.showDrawer = false
|
||||
}
|
||||
|
||||
const submitOrder = () => {
|
||||
if (!curPickup.value.id) return uni.showToast({ title: "请选择自提点", icon: "none" })
|
||||
doBuy(curPickup.value.id)
|
||||
}
|
||||
</script>
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
<template #main-bottom>
|
||||
<view class="z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<product-total :totPrice="totPrice" :totCount="totalCount" @doContainer="doCart" @submit="goSettlement" />
|
||||
<product-total :totPrice="totPrice" :totCount="totalCount" @doContainer="doCart" @submit="goSettlement(state.mchId)" />
|
||||
</view>
|
||||
</template>
|
||||
</crud-layout>
|
||||
|
||||
@@ -45,12 +45,12 @@ export default function useCartBuy() {
|
||||
await cartStore.removeProductCount(productId, merchantId)
|
||||
}
|
||||
|
||||
const goSettlement = () => {
|
||||
uni.navigateTo({ url: "/pages/prosperity-shop/settlement" })
|
||||
const goSettlement = (mchId: string) => {
|
||||
uni.navigateTo({ url: `/pages/prosperity-shop/settlement?mchId=${mchId}` })
|
||||
}
|
||||
|
||||
// 点击提交订单
|
||||
const doBuy = async () => {
|
||||
const doBuy = async (pickUpId: string) => {
|
||||
if (isEmpty(cartList.value)) return uni.showToast({ title: "请至少购买一件商品", icon: "none" })
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
@@ -58,18 +58,18 @@ export default function useCartBuy() {
|
||||
confirmColor: "#0094ff",
|
||||
success: async (res) => {
|
||||
if (!res.confirm) return
|
||||
submitPay()
|
||||
submitPay(pickUpId)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 确认提交订单
|
||||
const submitPay = async () => {
|
||||
const submitPay = async (pickUpId: string) => {
|
||||
try {
|
||||
uni.showLoading({ title: "支付中...", mask: false })
|
||||
const { code, msg }: any = await orderApi.appCreateFarmerReserveOrder({
|
||||
carParentId: cartStore.cartList[0].parentCarId,
|
||||
hardType: "FARMER",
|
||||
carParentId: cartList.value[0].parentCarId,
|
||||
pickUpId,
|
||||
})
|
||||
if (code != 0) throw new Error(msg)
|
||||
uni.showToast({ title: "支付成功", icon: "none" })
|
||||
|
||||
@@ -3,7 +3,6 @@ import request from "@/sheep/utils/request"
|
||||
export default {
|
||||
/**
|
||||
* app领取优惠券
|
||||
* 不用传参数
|
||||
*/
|
||||
appGet: (data: any) =>
|
||||
request({
|
||||
|
||||
Reference in new issue
Block a user