i
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
const obj = {
|
||||
a: 1,
|
||||
b: 3,
|
||||
c: 10,
|
||||
};
|
||||
|
||||
Object.keys(obj).forEach((item, index) => {
|
||||
console.log(obj[item]);
|
||||
});
|
||||
@@ -12,6 +12,9 @@
|
||||
<view class="dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="goodInfo.status === 1" class="timeBox">
|
||||
订单剩余{{ timeStr }}过期,请尽快核销!
|
||||
</view>
|
||||
<!-- 商家信息 -->
|
||||
<view class="mer-info">
|
||||
<view class="left">
|
||||
@@ -27,11 +30,11 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="icon" @click="toPhone">
|
||||
<Service />
|
||||
<Service/>
|
||||
<text>电话</text>
|
||||
</view>
|
||||
<view class="icon" @click="toAdder">
|
||||
<Find />
|
||||
<Find/>
|
||||
<text>导航</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -43,9 +46,9 @@
|
||||
<nut-cell>
|
||||
<template #default>
|
||||
<view class="top">
|
||||
<image :src="goodInfo.BindGoods?.cover" />
|
||||
<image :src="goodInfo.BindGoods?.cover"/>
|
||||
<view class="title"
|
||||
>{{ goodInfo.BindGoods?.name }}
|
||||
>{{ goodInfo.BindGoods?.name }}
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{ goodInfo.BindGoods?.number }}</view>
|
||||
@@ -86,7 +89,9 @@
|
||||
<template #default>
|
||||
<view style="text-align: right; width: 100%">
|
||||
<view
|
||||
>实付款({{ type === "1" ? "元" : "积分" }}):
|
||||
>{{
|
||||
goodInfo.status === 0 ? '应付款' : '实付款'
|
||||
}}({{ type === '1' ? '元' : '积分' }}):
|
||||
<nut-price
|
||||
:price="goodInfo.number"
|
||||
size="normal"
|
||||
@@ -111,7 +116,7 @@
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openPay()"
|
||||
>立即付款
|
||||
>立即付款
|
||||
</nut-button>
|
||||
<nut-button
|
||||
v-if="goodInfo.status === 1"
|
||||
@@ -119,7 +124,7 @@
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openCode()"
|
||||
>出示核销码
|
||||
>出示核销码
|
||||
</nut-button>
|
||||
</view>
|
||||
|
||||
@@ -148,96 +153,123 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
useLoad,
|
||||
getStorageSync,
|
||||
makePhoneCall,
|
||||
openLocation,
|
||||
showToast,
|
||||
} from "@tarojs/taro";
|
||||
import { Service, Find } from "@nutui/icons-vue-taro";
|
||||
import { ref } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {Find, Service} from '@nutui/icons-vue-taro'
|
||||
import {ref} from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
import Pay from '@/components/Pay.vue'
|
||||
|
||||
const goodInfo = ref<any>({});
|
||||
dayjs.extend(duration)
|
||||
|
||||
const goodInfo = ref<any>({})
|
||||
|
||||
const statusList = ref([
|
||||
{
|
||||
id: 0,
|
||||
text: "待付款",
|
||||
text: '待付款'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
text: "待使用",
|
||||
text: '待使用'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: "已使用",
|
||||
text: '已使用'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: "已失效",
|
||||
},
|
||||
]);
|
||||
text: '已失效'
|
||||
}
|
||||
])
|
||||
|
||||
const isShowCode = ref(false);
|
||||
const isShowPay = ref(false);
|
||||
const jfInfo = ref<any>({});
|
||||
const isShowCode = ref(false)
|
||||
const isShowPay = ref(false)
|
||||
const jfInfo = ref<any>({})
|
||||
|
||||
const type = ref("");
|
||||
const type = ref('')
|
||||
|
||||
const url = ref("");
|
||||
const url = ref('')
|
||||
|
||||
useLoad((options) => {
|
||||
type.value = options.type;
|
||||
goodInfo.value = getStorageSync("item");
|
||||
});
|
||||
Taro.useLoad((options) => {
|
||||
type.value = options.type
|
||||
goodInfo.value = Taro.getStorageSync('item')
|
||||
if (goodInfo.value.status === 1) {
|
||||
startTime()
|
||||
}
|
||||
})
|
||||
|
||||
const toPhone = () => {
|
||||
makePhoneCall({
|
||||
phoneNumber: goodInfo.value.BindStore.phone,
|
||||
});
|
||||
};
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: goodInfo.value.BindStore.mobile
|
||||
})
|
||||
}
|
||||
|
||||
const toAdder = () => {
|
||||
openLocation({
|
||||
Taro.openLocation({
|
||||
latitude: Number(goodInfo.value.BindStore.lat),
|
||||
longitude: Number(goodInfo.value.BindStore.lon),
|
||||
scale: 18,
|
||||
});
|
||||
};
|
||||
scale: 18
|
||||
})
|
||||
}
|
||||
|
||||
const openPay = () => {
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = getStorageSync("item");
|
||||
};
|
||||
isShowPay.value = true
|
||||
jfInfo.value = Taro.getStorageSync('item')
|
||||
}
|
||||
|
||||
const errPay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
isShowPay.value = false
|
||||
Taro.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none'
|
||||
})
|
||||
jfInfo.value = {}
|
||||
}
|
||||
const closePay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付取消",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
isShowPay.value = false
|
||||
Taro.showToast({
|
||||
title: '支付取消',
|
||||
icon: 'none'
|
||||
})
|
||||
jfInfo.value = {}
|
||||
}
|
||||
|
||||
const openCode = () => {
|
||||
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
|
||||
isShowCode.value = true;
|
||||
};
|
||||
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`
|
||||
isShowCode.value = true
|
||||
}
|
||||
|
||||
const closed = () => {
|
||||
isShowCode.value = false;
|
||||
url.value = "";
|
||||
};
|
||||
isShowCode.value = false
|
||||
url.value = ''
|
||||
}
|
||||
|
||||
let timeId: any
|
||||
|
||||
const timeStr = ref('????')
|
||||
|
||||
const startTime = () => {
|
||||
const nowTime = dayjs()
|
||||
const endTime = dayjs(goodInfo.value.expires * 1000)
|
||||
|
||||
// 计算剩余时间的持续时间对象
|
||||
const duration = dayjs.duration(endTime.diff(nowTime))
|
||||
|
||||
// 格式化剩余时间
|
||||
timeStr.value = duration.format('D天H小时m分钟s秒')
|
||||
|
||||
if (goodInfo.value.expires - dayjs().unix() > 0) {
|
||||
clearInterval(timeId)
|
||||
timeId = setTimeout(() => {
|
||||
startTime()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
Taro.useUnload(() => {
|
||||
clearTimeout(timeId)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -248,6 +280,13 @@ page {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.timeBox {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.step-bar {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import Taro from "@tarojs/taro";
|
||||
import { ref } from "vue";
|
||||
import { getVerifyCode, applyMer, getMerTypeList } from "@/api/user";
|
||||
import Upload from "@/components/Upload.vue";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ref} from 'vue'
|
||||
import {applyMer, getMerTypeList, getVerifyCode} from '@/api/user'
|
||||
import Upload from '@/components/Upload.vue'
|
||||
|
||||
const visible = ref(false);
|
||||
|
||||
@@ -91,7 +91,7 @@ const onOk = async () => {
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({
|
||||
Taro.switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
}, 3000);
|
||||
@@ -222,6 +222,25 @@ const submit = () => {
|
||||
placeholder="请输入联系电话"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入正确的店铺号码',
|
||||
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
|
||||
},
|
||||
]"
|
||||
label="店铺号码"
|
||||
prop="phone"
|
||||
required
|
||||
>
|
||||
<input
|
||||
v-model="formValue.mobile"
|
||||
:maxlength="11"
|
||||
placeholder="请输入店铺号码"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
required
|
||||
label="验证码"
|
||||
@@ -470,7 +489,7 @@ const submit = () => {
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.img" :max="5" />
|
||||
<Upload v-model:list="formValue.img" :max="5" multiple/>
|
||||
</nut-form-item>
|
||||
|
||||
<view class="btn">
|
||||
|
||||
Reference in New Issue
Block a user