| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { defineStore } from 'pinia'
- import router from '@/router'
- interface SysState {
- /**
- * 状态栏高度
- */
- statusBarHeight: number
- /**
- * 胶囊按钮高度
- */
- MenuButtonHeight: number
- /**
- * 支付成功页面查看订单按钮跳转路径
- *
- */
- paySuccessPath: string
- /**
- * 支付成功页面返回首页按钮跳转路径
- */
- payBackIndexPath: string
- /**
- * 支付失败页面返回首页按钮跳转路径
- */
- payFailPath: string
- /**
- * 透明度
- */
- opcity: number
- /**
- * 是否上线审核
- */
- isOnlineAudit: boolean
- /**
- * 如果是组件模式加tabbar,从订单详情返回订单列表页面需要刷新,监听此字段刷新页面
- */
- refreshOrderList: boolean
- }
- export const useSysStore = defineStore('system', {
- state: (): SysState => ({
- statusBarHeight: 0,
- MenuButtonHeight: 0,
- paySuccessPath: '',
- payBackIndexPath: '',
- payFailPath: '',
- opcity: 0,
- isOnlineAudit: true,
- refreshOrderList: false,
- }),
- actions: {
- getSystemData() {
- const { statusBarHeight } = uni.getSystemInfoSync()
- const { height } = uni.getMenuButtonBoundingClientRect()
- this.statusBarHeight = Number(statusBarHeight)
- this.MenuButtonHeight = height
- },
- /**
- *
- * @param payBackIndexPath 支付成功页面返回首页按钮跳转路径
- *
- * @param paySuccessPath 支付成功页面查看订单按钮跳转路径
- */
- setPaySuccessPath(paySuccessPath: string, payBackIndexPath: string) {
- this.paySuccessPath = paySuccessPath
- this.payBackIndexPath = payBackIndexPath
- },
- async getAudit() {
- const res = await Apis.sys.dictPage({ data: { typeCode: 'sys_applet' } })
- this.isOnlineAudit = res.data?.list[0].value === '0'
- },
- /**
- * 申请退款获取退款订单信息
- * @param orderNumber
- * @returns
- */
- async getRefunOrder(orderNumber: string) {
- uni.showLoading({ mask: true })
- return new Promise((resolve, reject) => {
- Apis.xsb.findByOrderNumber({
- data: {
- orderNumber,
- },
- }).then((res) => {
- // resolve(res.data)
- router.push({ name: 'common-afterSales', params: { order: JSON.stringify(res.data) } })
- uni.hideLoading()
- }).catch((err) => {
- reject(err)
- uni.hideLoading()
- })
- })
- },
- },
- })
|