Commit 12cfe2d1 by Sixong.Zhu

u

parent a2dcf20b
Showing with 18 additions and 9 deletions
import Chat from "@/customer-service/xim"; import Chat from "@/customer-service/xim";
import { metaRow, UniplatSdkExtender } from "uniplat-sdk"; import { metaRow, UniplatSdkExtender, UniplatSdk } from "uniplat-sdk";
import { import {
OperationType, OperationType,
OrderStatus, OrderStatus,
...@@ -17,14 +17,23 @@ class OrderService { ...@@ -17,14 +17,23 @@ class OrderService {
public readonly generalOrderPaymentModel = "general_order_payment_info"; public readonly generalOrderPaymentModel = "general_order_payment_info";
private readonly handler = new UniplatSdkExtender(); private readonly handler = new UniplatSdkExtender();
private innerSdk: UniplatSdk | null = null;
public injectSdk(sdk: UniplatSdk) {
this.innerSdk = sdk;
return this;
}
private getSdk() {
return this.innerSdk || Chat.getSdk();
}
public openOrder(params: { public openOrder(params: {
productId: string | number; productId: string | number;
srcPlatform: SrcPlatform; srcPlatform: SrcPlatform;
createdType: OperationType; createdType: OperationType;
}) { }) {
const sdk = Chat.getSdk(); return this.getSdk()
return sdk
.model(this.generalOrder) .model(this.generalOrder)
.action("addOrder") .action("addOrder")
.addInputs_parameter({ .addInputs_parameter({
...@@ -40,7 +49,7 @@ class OrderService { ...@@ -40,7 +49,7 @@ class OrderService {
v: number, v: number,
status: OrderStatus status: OrderStatus
) { ) {
return Chat.getSdk() return this.getSdk()
.model(this.generalOrder) .model(this.generalOrder)
.action("editStatus") .action("editStatus")
.addInputs_parameter({ .addInputs_parameter({
...@@ -52,7 +61,7 @@ class OrderService { ...@@ -52,7 +61,7 @@ class OrderService {
} }
public getOrders(index: number) { public getOrders(index: number) {
return Chat.getSdk() return this.getSdk()
.model(this.generalOrder) .model(this.generalOrder)
.list("userOrderList") .list("userOrderList")
.query({ item_size: 100, pageIndex: index }) .query({ item_size: 100, pageIndex: index })
...@@ -65,7 +74,7 @@ class OrderService { ...@@ -65,7 +74,7 @@ class OrderService {
} }
public getPayments(id: number) { public getPayments(id: number) {
return Chat.getSdk() return this.getSdk()
.model(orderService.generalOrderPaymentModel) .model(orderService.generalOrderPaymentModel)
.list() .list()
.addPrefilter({ OrderId: id }) .addPrefilter({ OrderId: id })
...@@ -90,7 +99,7 @@ class OrderService { ...@@ -90,7 +99,7 @@ class OrderService {
} }
public getPayment(id: string | number) { public getPayment(id: string | number) {
return Chat.getSdk() return this.getSdk()
.model(orderService.generalOrderPaymentModel) .model(orderService.generalOrderPaymentModel)
.detail(id as string, "userOrderPaymentDetail") .detail(id as string, "userOrderPaymentDetail")
.query() .query()
...@@ -110,7 +119,7 @@ class OrderService { ...@@ -110,7 +119,7 @@ class OrderService {
} }
public addImage4Payment(payment: number | string, v: number, path: string) { public addImage4Payment(payment: number | string, v: number, path: string) {
return Chat.getSdk() return this.getSdk()
.model(orderService.generalOrderPaymentModel) .model(orderService.generalOrderPaymentModel)
.action("addImages") .action("addImages")
.updateInitialParams({ selected_list: [{ v, id: payment as number }] }) .updateInitialParams({ selected_list: [{ v, id: payment as number }] })
...@@ -119,7 +128,7 @@ class OrderService { ...@@ -119,7 +128,7 @@ class OrderService {
} }
public getImages4Payment(payment: number) { public getImages4Payment(payment: number) {
return Chat.getSdk() return this.getSdk()
.model("general_order_payment_file_info") .model("general_order_payment_file_info")
.list() .list()
.addPrefilter({ PaymentId: payment }) .addPrefilter({ PaymentId: payment })
......
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