|
@@ -28,9 +28,7 @@
|
|
|
<div :class="goodsDetail?.originPrice ? 'pb-3' : 'py-3'">
|
|
|
<span>¥</span>
|
|
|
<span class="text-2xl">
|
|
|
- {{
|
|
|
- parseFloat((goodsDetail?.price / 100).toFixed(2))
|
|
|
- }}
|
|
|
+ {{ parseFloat((goodsDetail?.price / 100).toFixed(2)) }}
|
|
|
</span>
|
|
|
<span>/{{ goodsDetail.memberCard?.lifespan }}天</span>
|
|
|
</div>
|
|
@@ -53,6 +51,13 @@
|
|
|
<div
|
|
|
class="flex w-10/12 items-center justify-center overflow-hidden rounded-xl bg-[#2c2c2c]"
|
|
|
>
|
|
|
+ <button
|
|
|
+ class="flex-1 whitespace-nowrap border-0 bg-[#2c2c2c] p-4 text-sm text-[#e59223] after:hidden"
|
|
|
+ @click="buyHistory"
|
|
|
+ >
|
|
|
+ <span class="text-base">购买记录</span>
|
|
|
+ </button>
|
|
|
+ <div class="h-5 w-px bg-[#e59223]"></div>
|
|
|
<button
|
|
|
class="flex-1 whitespace-nowrap border-0 bg-[#2c2c2c] p-4 text-sm text-[#e59223] after:hidden"
|
|
|
@click="buy"
|
|
@@ -66,19 +71,22 @@
|
|
|
:onClose="handleClose"
|
|
|
:onConfirm="handleConfirm"
|
|
|
/>
|
|
|
+ <PaymentHistoryDialog :show="showHistory" :openId="openId" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, onMounted, computed, watch } from "vue";
|
|
|
+import { ref, reactive, onMounted, computed, watch, provide } from "vue";
|
|
|
|
|
|
import PaymentDialog from "./components/PaymentDialog.vue";
|
|
|
+import PaymentHistoryDialog from "./components/PaymentHistoryDialog.vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
|
import { request } from "@/utils";
|
|
|
|
|
|
const [route, router] = [useRoute(), useRouter()];
|
|
|
const goodsDetail = ref({});
|
|
|
+provide("goodsDetail", goodsDetail);
|
|
|
const getGoodsDetail = async () => {
|
|
|
const { data } = await request.get(
|
|
|
`archivesService/member/promotionGoods/detail`,
|
|
@@ -114,12 +122,12 @@ function onBridgeReady(paySign) {
|
|
|
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠,商户需进一步调用后端查单确认支付结果。
|
|
|
console.log("支付成功");
|
|
|
router.push({
|
|
|
- name: 'promotionPayResult',
|
|
|
+ name: "promotionPayResult",
|
|
|
query: {
|
|
|
promotionGoodsId: route.query.promotionGoodsId,
|
|
|
promotionSiteId: route.query.promotionSiteId,
|
|
|
- }
|
|
|
- })
|
|
|
+ },
|
|
|
+ });
|
|
|
} else {
|
|
|
showToast("支付失败" + res.err_msg);
|
|
|
}
|
|
@@ -142,6 +150,10 @@ const handleConfirm = async (mobile, captcha) => {
|
|
|
console.log(data.paymentParams);
|
|
|
data.paymentParams?.paySign && onBridgeReady(data.paymentParams.paySign);
|
|
|
};
|
|
|
+const showHistory = ref(false);
|
|
|
+const buyHistory = () => {
|
|
|
+ showHistory.value = true;
|
|
|
+};
|
|
|
const buy = () => {
|
|
|
showDialog.value = true;
|
|
|
};
|
|
@@ -152,7 +164,7 @@ const preCheck = async () => {
|
|
|
{
|
|
|
params: {
|
|
|
promotionGoodsId: route.query.promotionGoodsId,
|
|
|
- promotionSiteId: route.query.promotionSiteId,
|
|
|
+ promotionSiteId: route.query.promotionSiteId,
|
|
|
},
|
|
|
}
|
|
|
);
|
|
@@ -176,7 +188,7 @@ const preCheck = async () => {
|
|
|
// });
|
|
|
// };
|
|
|
const appId = ref(sessionStorage.getItem("appId"));
|
|
|
-const openId = ref("ozZpI7OTqj9cNlHfzAxcJ9MH41V8");
|
|
|
+const openId = ref("KfZnJNKFaFXWWCagSlX0dT4tNkwsLEwQVlrzpHvo");
|
|
|
const getWeChatAuth = async () => {
|
|
|
const { appId, errMsg, paymentSettingId } = await preCheck();
|
|
|
if (errMsg) {
|
|
@@ -234,9 +246,9 @@ const init = async () => {
|
|
|
}
|
|
|
const paymentSettingId = sessionStorage.getItem("paymentSettingId");
|
|
|
if (!code || !paymentSettingId) {
|
|
|
- return getWeChatAuth();
|
|
|
+ // return getWeChatAuth();
|
|
|
}
|
|
|
- getOpenId()
|
|
|
+ // getOpenId()
|
|
|
// wxConfig();
|
|
|
};
|
|
|
onMounted(() => init());
|