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>
|
<template #main-bottom>
|
||||||
<view class="z-200 p-x-30rpx p-y-30rpx bg-white">
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</crud-layout>
|
</crud-layout>
|
||||||
|
|||||||
@@ -6,16 +6,21 @@
|
|||||||
<tm-sticky-header>
|
<tm-sticky-header>
|
||||||
<view class="h-20rpx" />
|
<view class="h-20rpx" />
|
||||||
<view class="card p-20rpx">
|
<view class="card p-20rpx">
|
||||||
<view class="text-36rpx">请选择自提点</view>
|
<view class="text-36rpx mb-2">请选择自提点</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" @click="onPickupPoint">
|
||||||
<view class="flex-row items-center justify-between">
|
<view v-if="curPickup.id" class="sub-text-30 mb-2 flex items-center">
|
||||||
<view class="sub-text-28">请选择自提点</view>
|
<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">
|
<view class="flex-row items-center second-text-24">
|
||||||
<text>{{ 0 || "请选择自提点" }} </text>
|
<text>请选择自提点</text>
|
||||||
<text class="ml-10rpx color-#b1b1b1 iconfont icon-xiangxiajiantouxiao" />
|
<text class="ml-10rpx color-#b1b1b1 iconfont icon-xiangxiajiantouxiao" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- </tm-picker> -->
|
|
||||||
<view class="c-#0089ff text-24rpx">配送订单较多时,配送时间可能波动</view>
|
<view class="c-#0089ff text-24rpx">配送订单较多时,配送时间可能波动</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="h-20rpx" />
|
<view class="h-20rpx" />
|
||||||
@@ -35,7 +40,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</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>
|
||||||
<view class="h-20rpx" />
|
<view class="h-20rpx" />
|
||||||
|
|
||||||
@@ -45,22 +50,99 @@
|
|||||||
<view class="second-text-36 color-#f63a36!">¥ {{ hooks.useMoney(totPrice) }}</view>
|
<view class="second-text-36 color-#f63a36!">¥ {{ hooks.useMoney(totPrice) }}</view>
|
||||||
<view class="sub-text-28">共{{ totalCount }}件</view>
|
<view class="sub-text-28">共{{ totalCount }}件</view>
|
||||||
</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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</crud-layout>
|
</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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from "vue"
|
import { computed, reactive, ref } from "vue"
|
||||||
import { hooks } from "@/sheep"
|
import { hooks } from "@/sheep"
|
||||||
import useCartBuy from "./use-cart-buy"
|
import useCartBuy from "./use-cart-buy"
|
||||||
import { filePath } from "@/sheep/utils/file"
|
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({
|
const state = reactive<any>({
|
||||||
pickUpList: [],
|
mchId: "",
|
||||||
curPickUp: {},
|
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>
|
</script>
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
|
|
||||||
<template #main-bottom>
|
<template #main-bottom>
|
||||||
<view class="z-200 p-x-30rpx p-y-30rpx bg-white">
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</crud-layout>
|
</crud-layout>
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ export default function useCartBuy() {
|
|||||||
await cartStore.removeProductCount(productId, merchantId)
|
await cartStore.removeProductCount(productId, merchantId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const goSettlement = () => {
|
const goSettlement = (mchId: string) => {
|
||||||
uni.navigateTo({ url: "/pages/prosperity-shop/settlement" })
|
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" })
|
if (isEmpty(cartList.value)) return uni.showToast({ title: "请至少购买一件商品", icon: "none" })
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
@@ -58,18 +58,18 @@ export default function useCartBuy() {
|
|||||||
confirmColor: "#0094ff",
|
confirmColor: "#0094ff",
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
if (!res.confirm) return
|
if (!res.confirm) return
|
||||||
submitPay()
|
submitPay(pickUpId)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认提交订单
|
// 确认提交订单
|
||||||
const submitPay = async () => {
|
const submitPay = async (pickUpId: string) => {
|
||||||
try {
|
try {
|
||||||
uni.showLoading({ title: "支付中...", mask: false })
|
uni.showLoading({ title: "支付中...", mask: false })
|
||||||
const { code, msg }: any = await orderApi.appCreateFarmerReserveOrder({
|
const { code, msg }: any = await orderApi.appCreateFarmerReserveOrder({
|
||||||
carParentId: cartStore.cartList[0].parentCarId,
|
carParentId: cartList.value[0].parentCarId,
|
||||||
hardType: "FARMER",
|
pickUpId,
|
||||||
})
|
})
|
||||||
if (code != 0) throw new Error(msg)
|
if (code != 0) throw new Error(msg)
|
||||||
uni.showToast({ title: "支付成功", icon: "none" })
|
uni.showToast({ title: "支付成功", icon: "none" })
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import request from "@/sheep/utils/request"
|
|||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* app领取优惠券
|
* app领取优惠券
|
||||||
* 不用传参数
|
|
||||||
*/
|
*/
|
||||||
appGet: (data: any) =>
|
appGet: (data: any) =>
|
||||||
request({
|
request({
|
||||||
|
|||||||
Reference in new issue
Block a user