i
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<nut-cell
|
||||
v-if="payType === 'jf'"
|
||||
title="积分支付"
|
||||
desc="剩余积分:18888"
|
||||
:desc="`剩余积分:${info.integral || 0}`"
|
||||
is-link
|
||||
@click="goPay()"
|
||||
>
|
||||
@@ -46,10 +46,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { IconFont } from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { payOrder } from "@/api/order";
|
||||
import { payJfOrder } from "@/api/goods";
|
||||
import { getPersonalInfo } from "@/api/user";
|
||||
|
||||
const prop = defineProps({
|
||||
isShowPay: {
|
||||
@@ -70,7 +72,28 @@ const prop = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["closePay"]);
|
||||
const emit = defineEmits(["closePay", "successPay"]);
|
||||
|
||||
const info = ref<any>({});
|
||||
|
||||
watch(
|
||||
() => prop.isShowPay,
|
||||
() => {
|
||||
getInfo();
|
||||
}
|
||||
);
|
||||
|
||||
const getInfo = async () => {
|
||||
try {
|
||||
const res = await getPersonalInfo();
|
||||
info.value = res.data.data;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const goPay = async () => {
|
||||
if (!prop.jfInfo)
|
||||
@@ -80,7 +103,6 @@ const goPay = async () => {
|
||||
});
|
||||
if (prop.payType === "wx") {
|
||||
try {
|
||||
console.log(prop.jfInfo);
|
||||
const { data } = await payOrder({
|
||||
oid: prop.jfInfo.oid,
|
||||
});
|
||||
@@ -90,16 +112,17 @@ const goPay = async () => {
|
||||
package: data.data.package,
|
||||
signType: data.data.signType,
|
||||
paySign: data.data.paySign,
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
success: function () {
|
||||
Taro.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: "/pages/hotGoods/hot_list/index",
|
||||
});
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res);
|
||||
fail: function () {
|
||||
Taro.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
@@ -107,6 +130,7 @@ const goPay = async () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
emit("closePay", false);
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
@@ -120,8 +144,11 @@ const goPay = async () => {
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/order_list/index",
|
||||
});
|
||||
emit("closePay", false);
|
||||
}
|
||||
emit("closePay", false);
|
||||
};
|
||||
|
||||
const closePay = () => {
|
||||
|
||||
Reference in New Issue
Block a user