Browse Source

add order logic

dev
刘嘉炜 3 weeks ago
parent
commit
e8861a664a
  1. 7
      src/pages/order/list.vue
  2. 11
      src/subpackage/groupon/components/venue_info.vue
  3. 8
      src/subpackage/order/components/detail/contact.vue
  4. 22
      src/subpackage/order/pages/detail.vue
  5. 16
      src/utils/index.js

7
src/pages/order/list.vue

@ -21,8 +21,9 @@ onReachBottom(()=>{
}) })
function toOrderDetail(){
routeTo('/subpackage/order/pages/detail');
function toOrderDetail(e){
let _qryStr = `brand_id=${e?.brand_id ?? ''}&order_no=${e?.order_no ?? ''}`;
routeTo(`/subpackage/order/pages/detail?${_qryStr}`);
} }
function getOrderLs({ function getOrderLs({
@ -49,7 +50,7 @@ function getOrderLs({
<tab-bar :tabs="tab.list" v-model:idx="tab.idx"></tab-bar> <tab-bar :tabs="tab.list" v-model:idx="tab.idx"></tab-bar>
</view> </view>
<view class="ol-list-content"> <view class="ol-list-content">
<view class="ol-item" v-for="(e, i) in orderLs" :key="i" @click="toOrderDetail">
<view class="ol-item" v-for="(e, i) in orderLs" :key="i" @click="toOrderDetail(e)">
<view class="oi-header"> <view class="oi-header">
<image class="oh-logo" mode="aspectFit" :src="e.stadium_logo"></image> <image class="oh-logo" mode="aspectFit" :src="e.stadium_logo"></image>
<view class="oh-name">{{ e.stadium_name ?? '-' }}</view> <view class="oh-name">{{ e.stadium_name ?? '-' }}</view>

11
src/subpackage/groupon/components/venue_info.vue

@ -19,11 +19,16 @@ const props = defineProps({
venueLs: { venueLs: {
type: Array, type: Array,
default: [] default: []
},
gatherLs: {
type: Array,
default: []
} }
}) })
const gatherList = computed({ const gatherList = computed({
get(){ get(){
if(props?.gatherLs?.length)return props?.gatherLs;
return formatVenueLs(props.venueLs); return formatVenueLs(props.venueLs);
} }
}) })
@ -41,7 +46,7 @@ function formatVenueLs(list){
if(!v?.length)return; if(!v?.length)return;
let _name, start, end, lastIdx; let _name, start, end, lastIdx;
v.forEach(ele=>{ v.forEach(ele=>{
let [ _st, _et ] = (ele.time).split('-');
let [ _st, _et ] = (ele?.time ?? ele?.duration).split('-');
if(_name&&ele.index !== (lastIdx + 1)){ if(_name&&ele.index !== (lastIdx + 1)){
showArr.push({ name: _name, duration: `${start}-${end}` }); showArr.push({ name: _name, duration: `${start}-${end}` });
start = _st; start = _st;
@ -69,14 +74,14 @@ function formatVenueLs(list){
<view class="sbi-name">预定场次</view> <view class="sbi-name">预定场次</view>
<view class="sbi-time-range"> <view class="sbi-time-range">
<block v-for="(e, i) in gatherList" :key=i> <block v-for="(e, i) in gatherList" :key=i>
<view class="str-item">{{ e.name || '几号馆' }} {{ e.duration || '时间段' }}</view>
<view class="str-item">{{ e.name || '-' }} {{ e.duration ?? e.time ?? '-' }}</view>
</block> </block>
</view> </view>
</view> </view>
<view class="vmm-line" v-if='isShowSpecificTime'> <view class="vmm-line" v-if='isShowSpecificTime'>
<view>具体场次</view> <view>具体场次</view>
<view> <view>
<view v-for="(e,i) in venueLs" :key="i">{{ e.venue_name ?? '' }} {{ e.time ?? '' }} ({{ e?.price ?? 0 }})</view>
<view v-for="(e,i) in venueLs" :key="i">{{ e.venue_name ?? '' }} {{ e.time ?? e?.duration ?? '' }} ({{ e?.price ?? 0 }})</view>
</view> </view>
</view> </view>
<view class="soi-fold-btn" @click="isShowSpecificTime = !isShowSpecificTime"> <view class="soi-fold-btn" @click="isShowSpecificTime = !isShowSpecificTime">

8
src/subpackage/order/components/detail/contact.vue

@ -2,6 +2,12 @@
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
const emits = defineEmits([ 'click:phone', 'click:nav' ]); const emits = defineEmits([ 'click:phone', 'click:nav' ]);
const props = defineProps({
address: {
type: String,
default: ''
},
})
onLoad(() => { onLoad(() => {
}); });
@ -17,7 +23,7 @@ onLoad(() => {
</view> </view>
<view class="dl-line"> <view class="dl-line">
<view class="dl-icon">&#xe600;</view> <view class="dl-icon">&#xe600;</view>
<view class="dl-txt">白云区从云路822号城市像素6楼电梯5楼走到6楼></view>
<view class="dl-txt">{{ address ?? '-' }}></view>
</view> </view>
</view> </view>
<view class="dc-line"></view> <view class="dc-line"></view>

22
src/subpackage/order/pages/detail.vue

@ -7,18 +7,19 @@ import detailVerify from "../components/detail/verify.vue";
import detailContact from "../components/detail/contact.vue"; import detailContact from "../components/detail/contact.vue";
import venueInfoAsync from "@/subpackage/groupon/components/venue_info.vue"; import venueInfoAsync from "@/subpackage/groupon/components/venue_info.vue";
import { orderGet } from "../api"; import { orderGet } from "../api";
import { get_zh_day } from "@/utils";
const orderInfo = ref({}); const orderInfo = ref({});
// order_type 0 1/2 // order_type 0 1/2
onLoad(() => {
onLoad(options => {
orderGet({ orderGet({
data: { data: {
brand_id: 63,
order_no: "CC20250717152050893843"
brand_id: options?.brand_id ?? '',
order_no: options?.order_no ?? ''
} }
}) })
.then(res=>{ .then(res=>{
orderInfo.value = res?.data ?? {}; orderInfo.value = res?.data ?? {};
console.warn('CC20250717152050893843', res);
}) })
}); });
@ -27,7 +28,9 @@ function previewImg(img){
} }
function phoneClick(){ function phoneClick(){
if(orderInfo.value?.venue_mobile){
uni.makePhoneCall({ phoneNumber: orderInfo.value?.venue_mobile });
}
} }
function navClick(){ function navClick(){
@ -56,13 +59,20 @@ function navClick(){
<view class="od-box"> <view class="od-box">
<!-- 联系方式/地址 --> <!-- 联系方式/地址 -->
<detail-contact <detail-contact
:address="orderInfo?.venue_addr ?? ''"
@click:phone="phoneClick" @click:phone="phoneClick"
@click:nav="navClick" @click:nav="navClick"
></detail-contact> ></detail-contact>
</view> </view>
<view class="od-box od-venue-info" v-if="orderInfo?.order_type === 0"> <view class="od-box od-venue-info" v-if="orderInfo?.order_type === 0">
<!-- 场次信息 --> <!-- 场次信息 -->
<venue-info-async>
<venue-info-async
:typeName="orderInfo.project"
:dateStr="orderInfo.date"
:dayStr="get_zh_day(orderInfo?.date ?? '')"
:venueLs="orderInfo.sessions"
:gatherLs="orderInfo.durations"
>
<template #title> <template #title>
<view class="od-title">场次信息</view> <view class="od-title">场次信息</view>
</template> </template>

16
src/utils/index.js

@ -79,4 +79,18 @@ export function jsonStr(data){
export function jsonPar(json){ export function jsonPar(json){
return JSON.parse(decodeURIComponent(decodeURIComponent(json))) return JSON.parse(decodeURIComponent(decodeURIComponent(json)))
}
}
export function get_zh_day(date){
if(!date)return '';
if(isSameDay(new Date().getTime(),new Date(date).getTime()))return '今天'
const Arr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return Arr[new Date(date).getDay()] || '';
}
// 判断是否同一天
export function isSameDay(timeStampA, timeStampB) {
let dateA = new Date(timeStampA);
let dateB = new Date(timeStampB);
return (dateA.setHours(0, 0, 0, 0) == dateB.setHours(0, 0, 0, 0));
}
Loading…
Cancel
Save