| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- import { shallowRef, ref, reactive, computed } from 'vue'
- import { v4 } from 'uuid'
- import { useDataTable } from '@/hooks/datatable'
- import { queryGzbscinOutOrder, queryBScinOutOrderDetail, queryBScOutOrderDetailatt, queryGzbscusermonthpay, queryGzbscuserpowerfee, queryBscinoutorder, bscInAndOutWareHouseApply, bscUploadFile, bscConfirmPay } from '@/services/api/bonded'
- import { loginStore } from '@/stores'
- import Long from 'long'
- const { userId } = loginStore.$mapGetters()
- export type RequiredType<T, K extends keyof T> = Partial<T> & Pick<T, K> // 指定某个属性为必选
- // 保税仓出入库申请列表
- export function useGzbscinOutOrder() {
- const { dataList, total, pageIndex, pageSize } = useDataTable<Ermcp.GzbscinOutOrderRsp>()
- const loading = shallowRef(false)
- const getGzbscinOutOrder = (params: RequiredType<Ermcp.GzbscinOutOrderReq, 'ordertype'>) => {
- loading.value = true
- return queryGzbscinOutOrder({
- data: {
- page: pageIndex.value,
- pagesize: pageSize.value,
- userid: userId.value,
- ...params,
- },
- success: (res) => {
- total.value = res.total
- dataList.value = res.data
- },
- complete: () => {
- loading.value = false
- }
- })
- }
- return {
- loading,
- dataList,
- total,
- pageIndex,
- pageSize,
- getGzbscinOutOrder,
- }
- }
- // 保税仓出库申请明细附表
- export function useBScinOutOrderDetail(orderid: string) {
- const orderDetailList = ref<Ermcp.BScinOutOrderDetailRsp[]>([]) // 明细列表
- const orderDetailAttList = ref<Ermcp.BScOutOrderDetailattRsp[]>([]) // 附表列表
- const getBScinOutOrderDetail = (params: Partial<Ermcp.BScinOutOrderDetailReq> = {}) => {
- return queryBScinOutOrderDetail({
- data: {
- userid: userId.value,
- orderid,
- ...params,
- },
- success: (res) => {
- orderDetailList.value = res.data
- },
- })
- }
- const getBScOutOrderDetailatt = (params: Partial<Ermcp.BScOutOrderDetailattReq> = {}) => {
- return queryBScOutOrderDetailatt({
- data: {
- userid: userId.value,
- orderid,
- ...params,
- },
- success: (res) => {
- orderDetailAttList.value = res.data
- },
- })
- }
- return {
- orderDetailList,
- orderDetailAttList,
- getBScinOutOrderDetail,
- getBScOutOrderDetailatt,
- }
- }
- // 保税仓进出仓申请
- export function useBscInAndOutWareHouseApply(OrderType: number) {
- const { UserID, LoginID, LoginCode } = loginStore.state.loginInfo
- const loading = shallowRef(false)
- const formData = reactive<Proto.BSCInAndOutWareHouseApplyReq>({
- UserID, // 用户ID,必填
- UserName: '', // 申请方名称,必填
- UserAddress: '', // 申请方地点,必填
- ContactName: '', // 申请方联系人,必填
- ContactNum: '', // 申请方联系电话,必填
- LogisticsCompany: '', // 物流公司名称,必填
- LogisticsNo: '', // 托运单号,选填
- OrderType, // 单据类型,必填1:进仓2:出仓
- BSCGoodsListDetails: [], // 明细列表(数组),必填
- BSCOutWareHouseSchedules: [], // 出仓附表(数组),必填
- OperateID: LoginID, // 操作人ID,必填
- OperateAccount: LoginCode, // 操作人账户,必填
- ClientSerialNo: '', // 客户端流水号
- })
- const formSubmit = () => {
- loading.value = true
- return bscInAndOutWareHouseApply({
- data: {
- ...formData,
- ClientSerialNo: v4(),
- },
- complete: () => {
- loading.value = false
- }
- })
- }
- return {
- loading,
- formData,
- formSubmit,
- }
- }
- // 保税仓上传文件
- export function useBscUploadFile(orderId: string) {
- const { UserID, LoginID, LoginCode } = loginStore.state.loginInfo
- const loading = shallowRef(false)
- const formData = reactive<Proto.BSCUploadFileReq>({
- UserID, // 用户ID,必填
- OrderID: Long.fromString(orderId), // 单据ID,必填
- FileDetails: [], // 文件列表,必填
- ClientSerialNo: '', // 客户端流水号
- OperateID: LoginID, // 操作人ID,必填
- OperateAccount: LoginCode, // 操作人账户,必填
- })
- const formSubmit = () => {
- loading.value = true
- return bscUploadFile({
- data: {
- ...formData,
- ClientSerialNo: v4(),
- },
- complete: () => {
- loading.value = false
- }
- })
- }
- return {
- loading,
- formData,
- formSubmit,
- }
- }
- // 保税仓计费管理列表
- export function useGzbscusermonthpay() {
- const { dataList, total, pageIndex, pageSize } = useDataTable<Ermcp.GzbscusermonthpayRsp>()
- const loading = shallowRef(false)
- const getGzbscusermonthpay = (params: Partial<Ermcp.GzbscusermonthpayReq> = {}) => {
- loading.value = true
- return queryGzbscusermonthpay({
- data: {
- page: pageIndex.value,
- pagesize: pageSize.value,
- userid: userId.value,
- ...params,
- },
- success: (res) => {
- total.value = res.total
- dataList.value = res.data
- },
- complete: () => {
- loading.value = false
- }
- })
- }
- return {
- loading,
- dataList,
- total,
- pageIndex,
- pageSize,
- getGzbscusermonthpay,
- }
- }
- // 保税仓计费管理详情
- export function useGzbscusermonthpayDetails(trademonth: string) {
- const powerfeeList = shallowRef<Ermcp.GzbscuserpowerfeeRsp[]>([]) // 电费明细列表
- const bondedList = shallowRef<Ermcp.BscinoutorderRsp[]>([]) // 保税仓明细列表
- // 进口明细列表
- const importList = computed(() => bondedList.value.filter((e) => e.ordertype === 1))
- // 出境明细列表
- const exportList = computed(() => bondedList.value.filter((e) => e.ordertype === 2 && e.outtype === 1))
- // 转厂明细列表
- const transferList = computed(() => bondedList.value.filter((e) => e.ordertype === 2 && e.outtype === 2))
- queryGzbscuserpowerfee({
- data: {
- userid: userId.value,
- trademonth,
- },
- success: (res) => {
- powerfeeList.value = res.data
- }
- })
- queryBscinoutorder({
- data: {
- userid: userId.value,
- jckdate: trademonth,
- },
- success: (res) => {
- bondedList.value = res.data
- }
- })
- return {
- powerfeeList,
- importList,
- exportList,
- transferList,
- }
- }
- // 保税仓确认支付
- export function useBscConfirmPay(TradeMonth: string) {
- const loading = shallowRef(false)
- const formSubmit = () => {
- loading.value = true
- return bscConfirmPay({
- data: {
- UserID: userId.value, // 用户ID,必填
- TradeMonth, // 月份(yyyMM),必填
- ClientSerialNo: v4() // 客户端流水号
- },
- complete: () => {
- loading.value = false
- }
- })
- }
- return {
- loading,
- formSubmit,
- }
- }
|