Commit 214700eb by Sixong.Zhu
parents 1ddf11ba 5135e8c3
...@@ -122,7 +122,7 @@ export interface OrderPayItem { ...@@ -122,7 +122,7 @@ export interface OrderPayItem {
createdTime: string; createdTime: string;
actions?: any[]; actions?: any[];
bankAccountName?: string; bankAccountName?: string;
OpenningBankNam?: string; OpenningBankName?: string;
bankAccountNo?: string; bankAccountNo?: string;
} }
...@@ -140,7 +140,7 @@ export const orderPayItemPredict = { ...@@ -140,7 +140,7 @@ export const orderPayItemPredict = {
value: "Amount", value: "Amount",
createdTime: "CreatedDate", createdTime: "CreatedDate",
bankAccountName: "ProviderHandleId#ServiceProviderBank.AccountName", bankAccountName: "ProviderHandleId#ServiceProviderBank.AccountName",
OpenningBankNam: "ProviderHandleId#ServiceProviderBank.OpenningBankNam", OpenningBankName: "ProviderHandleId#ServiceProviderBank.OpenningBankName",
bankAccountNo: "ProviderHandleId#ServiceProviderBank.AccountNo", bankAccountNo: "ProviderHandleId#ServiceProviderBank.AccountNo",
} }
......
export * from "./upload"
\ No newline at end of file
...@@ -80,7 +80,7 @@ class OrderService { ...@@ -80,7 +80,7 @@ class OrderService {
public getPayments(id: number, withActions = false) { public getPayments(id: number, withActions = false) {
return this.getSdk() return this.getSdk()
.model(orderService.generalOrderPaymentModel) .model(orderService.generalOrderPaymentModel)
.list() .list('userOrderPaymentList')
.addPrefilter({ OrderId: id }) .addPrefilter({ OrderId: id })
.query({ pageIndex: 1, item_size: 100 }) .query({ pageIndex: 1, item_size: 100 })
.then((r) => { .then((r) => {
......
...@@ -7,3 +7,63 @@ export async function uploadFile(file: File, uploading?: (p: number) => void) { ...@@ -7,3 +7,63 @@ export async function uploadFile(file: File, uploading?: (p: number) => void) {
}); });
return `${sdk.global.baseUrl}${url}`; return `${sdk.global.baseUrl}${url}`;
} }
export const enum UploadType {
Default,
Image,
Camera
}
/**
* x
* @param type UploadType 默认值 UploadType.Default
* @param size 可不传 单位M
* @returns
*/
export function chooseFileAndUpload(type = UploadType.Default, size?: number) {
return chooseFile(type).then(r => {
const sdk = Chat.getSdk();
return sdk.uploadFileV2(r)
})
}
/**
*
* @param type UploadType
* @param size 可不传 单位M
* @returns
*/
export function chooseFile(type = UploadType.Default, size?: number) {
return new Promise<File>((resolve, reject) => {
const target = document.createElement('input');
target.setAttribute('type', 'file');
// 添加这个属性,就可以唤起相机的功能
(type === UploadType.Camera) && target.setAttribute('capture', 'camera');
// 这里如果不加属性 accept 是 "image/*" 或者 "video/*",就默认打开摄像头,既可以拍照也可以录像
(type === UploadType.Image) && target.setAttribute('accept', 'image/*');
target.setAttribute('style', 'display:none');
// 监听改变事件
target.addEventListener('change', (e: Event) => {
// 拿到文件对象
if (e && e.target) {
const t = e.target as HTMLInputElement;
const { files } = t;
if (files) {
// 返回的是一个文件对象
if (size && files[0].size >= size * 1024 * 1024) {
reject(`上传的${type === UploadType.Default ? "文件" : "图片"}太大了~`);
return;
}
resolve(files[0]);
setTimeout(() => target.remove(), 200);
return;
}
}
reject(new Error('系统不支持'));
setTimeout(() => target.remove(), 200);
});
document.body.appendChild(target);
// 这里是模拟点击了input控件
target.click();
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment