Browse Source

add order logic

dev
刘嘉炜 3 weeks ago
parent
commit
af4d5f47a6
  1. 6
      src/pages.json
  2. 4
      src/pages/order/list.vue
  3. 36
      src/subpackage/order/components/detail/verify.vue
  4. 77
      src/subpackage/order/pages/detail.vue
  5. 162
      src/subpackage/order/pages/enter_code.vue

6
src/pages.json

@ -42,6 +42,12 @@
"venue-info-async": "view"
}
}
},
{
"path": "pages/enter_code",
"style": {
"navigationBarTitleText": "查看入场码"
}
}
]
},

4
src/pages/order/list.vue

@ -8,7 +8,7 @@ const tab = reactive({
list: [ {name: '全部'}, {name: '已核销'}, {name: '已退款'}, ],
idx: 0
});
const loadPage = 1;
let loadPage = 1;
const orderLs = ref([]);
onLoad(() => {
@ -57,7 +57,7 @@ function getOrderLs({
<view class="oh-status">已核销</view>
</view>
<view class="oi-info">
<view class="oi-line"><text class="ol-txt">订单信息s</text>羽毛球订场200元代金券欧轩客服</view>
<view class="oi-line"><text class="ol-txt">订单信息</text>羽毛球订场200元代金券欧轩客服</view>
<view class="oi-line"><text class="ol-txt">订单编号</text>{{ e.order_no ?? '-' }}</view>
</view>
<view class="oi-bottom">

36
src/subpackage/order/components/detail/verify.vue

@ -2,25 +2,49 @@
import { onLoad } from '@dcloudio/uni-app';
import { reactive, ref } from "vue";
import textLine from "./text_line.vue";
import { routeTo } from '@/utils/polish';
const props = defineProps({
orderInfo: {
type: Object,
default: () => ({})
},
})
onLoad(() => {
});
// /
function zh_status(status){
if(status == undefined || status == '' || status == null)return '-'
if(status == -1)return '已失效';
if(status == 8)return '使用中'; // 20210521
return ['未支付','待使用','已使用','已失效','已退款'][status] || '';
}
function isCodeActive(status){
if(status == 8 || status == 1)return true;
return false;
}
function toCode(e){
routeTo(`/subpackage/order/pages/enter_code?code_id=${e?.id}`);
}
</script>
<template>
<view class="detail-verify">
<view class="dv-tit">验证信息</view>
<text-line label="使用日期">2020-12-25周五</text-line>
<text-line label="使用日期">{{ orderInfo?.date ?? '' }}</text-line>
<view class="dv-codes">
<view class="dc-item" :class="{ gray: i === 1 }" v-for="i in 2" :key="i">
<view class="di-status">待使用</view>
<view class="dc-item" :class="{ gray: !isCodeActive(e.status) }" v-for="(e, i) in (orderInfo?.sessions ?? [])" :key="i">
<view class="di-status">{{ zh_status(e.status) }}</view>
<view class="di-bottom">
<view class="db-code">验证码 12234 45455 </view>
<view class="db-txt-btn">查看个人入场码 &#xe695;</view>
<view class="db-code">验证码 {{ e?.verify_code ?? '-' }} </view>
<view class="db-txt-btn" v-if="isCodeActive(e.status)" @click="toCode(e)">查看二维码 &#xe695;</view>
</view>
</view>
</view>
<view class="vci-share-bar">
<view class="vci-share-bar" v-if="false">
<text class="vsb-add-icon">&#xe60d;</text>
<text class="vv-text">分享给好友领取入场码</text>
<text class="vsb-arrow">&#xe695;</text>

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

@ -15,7 +15,8 @@ onLoad(options => {
orderGet({
data: {
brand_id: options?.brand_id ?? '',
order_no: options?.order_no ?? ''
order_no: options?.order_no ?? '',
from_platform: 'weixin'
}
})
.then(res=>{
@ -42,6 +43,11 @@ function navClick(){
address: _oInfo.venue_addr
})
}
//
function zh_selectedSpacs(specsArr){
if(!Array.isArray(specsArr))return ''
return specsArr.join('+') || '';
}
</script>
@ -56,14 +62,25 @@ function navClick(){
<view class="oh-line">订单编号{{ orderInfo?.order_no ?? '-' }}</view>
<view class="oh-line">创建时间{{ orderInfo?.success_time ?? '-' }}</view>
</view>
<view class="od-box">
<!-- 联系方式/地址 -->
<detail-contact
:address="orderInfo?.venue_addr ?? ''"
@click:phone="phoneClick"
@click:nav="navClick"
></detail-contact>
<!-- 验证信息 -->
<detail-verify
:orderInfo="orderInfo"
></detail-verify>
</view>
<view class="od-box od-product" v-if="[1,2].includes(orderInfo?.order_type)">
<view class="od-title">产品信息</view>
<text-line label="预定项目:">{{ orderInfo?.project ?? '-' }}</text-line>
<text-line label="数量:">{{ orderInfo?.number ?? '' }}</text-line>
<text-line label="类型:">{{ zh_selectedSpacs(orderInfo?.spec) }}</text-line>
<view class="op-bottom">
<view class="op-val">小计</view>
<view class="op-val">¥{{ orderInfo?.amount || '0' }}</view>
</view>
</view>
<view class="od-box od-venue-info" v-if="orderInfo?.order_type === 0">
<!-- 场次信息 -->
<venue-info-async
@ -78,43 +95,37 @@ function navClick(){
</template>
</venue-info-async>
</view>
<view class="od-box od-product" v-if="[1,2].includes(orderInfo?.order_type)">
<view class="od-title">产品信息</view>
<text-line label="预定项目:">羽毛球</text-line>
<text-line label="数量:">1</text-line>
<text-line label="类型:">llasd</text-line>
<view class="op-bottom">
<view class="op-val">小计</view>
<view class="op-val">¥300</view>
</view>
<view class="od-box od-code" v-if="orderInfo.verify_qrcode">
<!-- 二维码 -->
<image
mode="aspectFit"
class="oc-code-img"
:src="orderInfo.verify_qrcode"
@click="previewImg(orderInfo.verify_qrcode)"
></image>
<view class="oc-tip">点击二维码可放大查看</view>
</view>
<view class="od-box">
<!-- 联系方式/地址 -->
<detail-contact
:address="orderInfo?.venue_addr ?? ''"
@click:phone="phoneClick"
@click:nav="navClick"
></detail-contact>
</view>
<view class="od-box od-total">
<view class="ot-line">
<view class="ol-val">金额小计</view>
<view class="ol-val">{{ orderInfo?.amount ?? '0' }}</view>
<view class="ol-val">{{ orderInfo?.amount || '0' }}</view>
</view>
<view class="ot-line">
<view class="ol-val">团购券抵扣</view>
<view class="ol-val">{{ orderInfo?.douyin_coupon_deduct_amount ?? '0' }}</view>
<view class="ol-val">{{ orderInfo?.douyin_coupon_deduct_amount || '0' }}</view>
</view>
<view class="ot-amount"><text class="oa-txt">合计支付</text>{{ orderInfo?.pay_amount ?? '0' }}</view>
<view class="ot-amount"><text class="oa-txt">合计支付</text>{{ orderInfo?.pay_amount || '0' }}</view>
</view>
<view class="od-box">
<!-- 验证信息 -->
<detail-verify></detail-verify>
</view>
<view class="od-box od-code" v-if="orderInfo.verify_qrcode">
<!-- 二维码 -->
<image
mode="aspectFit"
class="oc-code-img"
:src="orderInfo.verify_qrcode"
@click="previewImg(orderInfo.verify_qrcode)"
></image>
<view class="oc-tip">点击二维码可放大查看</view>
</view>
<view class="od-box od-payment">
<!-- 支付信息 -->
<view class="od-title">支付信息</view>

162
src/subpackage/order/pages/enter_code.vue

@ -0,0 +1,162 @@
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import server from '@/api/server';
const codeInfo = ref({}); //
onLoad(option => {
server.post({
url: '/stadium/order/session/get' + `/${option?.code_id ?? ''}`,
data: {
id: option?.code_id
}
})
.then(res => {
console.log('获取code详情', res);
codeInfo.value = res?.data || {};
})
});
//
function copyVerifyCode(code = ''){
uni.setClipboardData({ data: `${code}` });
}
//
function isShowCodeMask(_showCodeInfo){
if(!_showCodeInfo)return false;
let _status = _showCodeInfo.status || '';
// 20230823 ID1001365
if(+_status === 2 && _showCodeInfo.is_many_enter)return false;
return [ 2, 3, 4, -1 ].includes(+_status) || _showCodeInfo.qr_status != 1;
}
// icon
// 20210111 2使/3/4退/-1, 4
function codeMaskImgPath(status){
if(status==2||status==4)return `status_${status}.png`;
if(!status)return 'status_3.png';
return 'status_3.png'
}
//
function previewCode(e){
if(isShowCodeMask(e))return;
uni.previewImage({ urls: [e.verify_qrcode] })
}
</script>
<template>
<view class="order-enter-code">
<view class="oec-section" v-if="codeInfo?.id">
<view class="os-stadium">
<image mode="aspectFit" :src="codeInfo?.stadium_logo ?? ''"></image>
<view>{{ codeInfo?.stadium_name ?? '-' }}</view>
</view>
<view class="cci-tip">
<view class="ct-text">
<text>点击二维码可放大查看</text>
<!-- <view class="ct-tag">可再次进场</view> -->
</view>
</view>
<view class="cci-code">
<image @click="previewCode(codeInfo)" mode="aspectFit" :src="codeInfo?.verify_qrcode ?? ''"></image>
<!-- <view class="cc-cover" v-if="isShowCodeMask(codeInfo)" @click.prevent="_=>false">
<image mode="aspectFit" :src="'/subpackage/venue/static/images/appoint/'+ codeMaskImgPath(codeInfo&&codeInfo.status)" ></image>
</view> -->
</view>
<view class="cci-v-code">
验证码{{ codeInfo?.verify_code ?? '' }}
<text v-if="codeInfo?.verify_code" @click="copyVerifyCode(codeInfo?.verify_code)">复制</text>
</view>
</view>
</view>
</template>
<style lang="scss">
page{
background-color: #fff;
}
.order-enter-code{
@include isPd(0upx);
}
.oec-section{
padding-bottom: 60upx;
.os-stadium{
@include ctf(flex-start);
padding: 30upx;
>image{
flex-shrink: 0;
margin-right: 10upx;
width: 40upx;
height: 40upx;
}
>view{
@include tHide(1);
@include flcw(28upx, 40upx, #333, 500);
}
}
.cci-tip{
padding: 20upx 0 14upx;
@include ctf(center);
.ct-text{
position: relative;
text-align: center;
font-size: 24upx;
@include flcw(24upx, 34upx, #9A9A9D, 500);
.ct-tag{
position: absolute;
right: 0;
top: 0;
transform: translateX(100%);
margin-right: -24upx;
padding: 0 4upx;
text-align: center;
border: 1px solid #68C43B;
border-radius: 4upx;
@include flcw(18upx, 28upx, #68C43B);
}
}
}
.cci-code{
margin: 0 auto 8upx;
position: relative;
width: 384upx;
height: 384upx;
>image{
display: block;
width: 100%;
height: 100%;
border: 0;
}
.cc-cover{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba($color: #fff, $alpha: .8);
>image{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 152upx;
height: 152upx;
}
}
}
.cci-v-code{
margin-bottom: 34upx;
text-align: center;
@include flcw(28upx, 40upx, #333, 600);
>text{
color: $mColor;
margin-left: 28upx;
}
}
}
</style>
Loading…
Cancel
Save