|
@@ -13,8 +13,9 @@
|
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app' // 必须导入需要用到的页面生命周期(即使在当前页面上没有直接使用到)
|
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app' // 必须导入需要用到的页面生命周期(即使在当前页面上没有直接使用到)
|
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
|
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
|
|
-
|
|
|
|
-import { getWalletAccountInfo, walletFlowList } from '@/api/wallet'
|
|
|
|
|
|
+import { getWalletAccountInfo, unpaidOrder, walletFlowList } from '@/api/wallet'
|
|
|
|
+import DialogBox from '@/components/DialogBox/DialogBox.vue'
|
|
|
|
+import { DialogUtils } from '@/components/DialogBox/utils'
|
|
import { formatNumber } from '@/utils'
|
|
import { formatNumber } from '@/utils'
|
|
import { toPage } from '@/utils/page'
|
|
import { toPage } from '@/utils/page'
|
|
// z-paging
|
|
// z-paging
|
|
@@ -22,6 +23,9 @@ const paging = ref(null)
|
|
// 类似mixins,如果是页面滚动务必要写这一行,并传入当前ref绑定的paging,注意此处是paging,而非paging.value
|
|
// 类似mixins,如果是页面滚动务必要写这一行,并传入当前ref绑定的paging,注意此处是paging,而非paging.value
|
|
useZPaging(paging)
|
|
useZPaging(paging)
|
|
|
|
|
|
|
|
+// DialogBox 函数式调用配置
|
|
|
|
+const dialogConfig = ref<any>({})
|
|
|
|
+
|
|
const dayType = ref(1)
|
|
const dayType = ref(1)
|
|
const walletInfo = ref<any>({})
|
|
const walletInfo = ref<any>({})
|
|
async function getWalletInfo() {
|
|
async function getWalletInfo() {
|
|
@@ -46,8 +50,52 @@ async function getWalletFlowList(pageNo: number, pageSize: number) {
|
|
paging.value.complete(false)
|
|
paging.value.complete(false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 显示取消订单确认对话框
|
|
|
|
+function showUnpaidOrderDialog() {
|
|
|
|
+ Object.assign(dialogConfig.value, DialogUtils.info(
|
|
|
|
+ `You have unfinished recharge orders,\nDo you want to continue recharge?`,
|
|
|
|
+ {
|
|
|
|
+ showCancel: true,
|
|
|
|
+ confirmText: 'Continue Recharge',
|
|
|
|
+ cancelText: 'New Recharge',
|
|
|
|
+ },
|
|
|
|
+ ))
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 处理对话框关闭事件
|
|
|
|
+function handleDialogClose() {
|
|
|
|
+ dialogConfig.value.show = false
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 处理对话框确认事件
|
|
|
|
+function handleDialogConfirm() {
|
|
|
|
+ // 继续充值
|
|
|
|
+ handleDialogClose()
|
|
|
|
+ toPage('/pages/wallet/rechargeRecord')
|
|
|
|
+ // 关闭对话框
|
|
|
|
+}
|
|
|
|
+function handleDialogCancel() {
|
|
|
|
+ // 新充值
|
|
|
|
+ handleDialogClose()
|
|
|
|
+ toPage('/pages/wallet/recharge')
|
|
|
|
+}
|
|
|
|
+// 查询未完成的充值订单
|
|
|
|
+async function getUnpaidOrder() {
|
|
|
|
+ try {
|
|
|
|
+ const res = await unpaidOrder()
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.code === '200' && res.data) {
|
|
|
|
+ showUnpaidOrderDialog()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+}
|
|
onShow(() => {
|
|
onShow(() => {
|
|
getWalletInfo()
|
|
getWalletInfo()
|
|
|
|
+ getUnpaidOrder()
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -133,6 +181,12 @@ onShow(() => {
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <DialogBox
|
|
|
|
+ v-bind="dialogConfig"
|
|
|
|
+ @confirm="handleDialogConfirm"
|
|
|
|
+ @cancel="handleDialogCancel"
|
|
|
|
+ @close="handleDialogClose"
|
|
|
|
+ />
|
|
</view>
|
|
</view>
|
|
</z-paging>
|
|
</z-paging>
|
|
</template>
|
|
</template>
|