|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
import { create } from 'zustand'
|
|
|
|
|
import { devtools } from 'zustand/middleware'
|
|
|
|
|
import { fetchJSON, postForm } from '@/utils/request'
|
|
|
|
|
import { API_HOST } from '@/config'
|
|
|
|
|
import { isNotEmpty, prepareUrl } from '@/utils/commons'
|
|
|
|
|
|
|
|
|
|
export const useOrderStore = create((set, get) => ({
|
|
|
|
|
export const useOrderStore = create(devtools((set, get) => ({
|
|
|
|
|
|
|
|
|
|
orderList: [],
|
|
|
|
|
orderDetail: {},
|
|
|
|
@ -52,7 +53,6 @@ export const useOrderStore = create((set, get) => ({
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appendOrderComment: async (opi_sn, coli_sn, comment) => {
|
|
|
|
|
const { fetchOrderDetail } = get()
|
|
|
|
|
const formData = new FormData()
|
|
|
|
@ -70,6 +70,33 @@ export const useOrderStore = create((set, get) => ({
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
generatePayment: async () => {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.append('descriptions', 'Tracking Code:123\r\nTravel Advisor:qqs\r\nContent:大法师')
|
|
|
|
|
formData.append('currency', 'USD')
|
|
|
|
|
formData.append('lgc', 'US')
|
|
|
|
|
formData.append('amount', 1000)
|
|
|
|
|
formData.append('coli_id', 'System18108')
|
|
|
|
|
formData.append('wlemail', 'Charles@hainatravel.com')
|
|
|
|
|
formData.append('paytype', 'SYT')
|
|
|
|
|
formData.append('ordertype', '227001')
|
|
|
|
|
formData.append('opisn', 29)
|
|
|
|
|
formData.append('wxzh', 'cht')
|
|
|
|
|
formData.append('fq', 0)
|
|
|
|
|
formData.append('onlyusa', 0)
|
|
|
|
|
formData.append('useyhm', 0)
|
|
|
|
|
|
|
|
|
|
return postForm(`${API_HOST}/generate_payment_links`, formData)
|
|
|
|
|
.then(json => {
|
|
|
|
|
if (json.errcode === 0) {
|
|
|
|
|
console.info(json)
|
|
|
|
|
return json.result
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(json?.errmsg + ': ' + json.errcode)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setOrderPropValue: async (colisn, propName, value) => {
|
|
|
|
|
|
|
|
|
|
if (propName === 'orderlabel') {
|
|
|
|
@ -98,7 +125,7 @@ export const useOrderStore = create((set, get) => ({
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
}), { name: 'orderStore' }))
|
|
|
|
|
|
|
|
|
|
export const OrderLabelDefaultOptions = [
|
|
|
|
|
{ value: 240003, label: '重点', emoji: '❣️' },
|
|
|
|
|