litian
2024-06-28 75a9abca4f4cf0ebe579705abc369489cfe20e7c
assets/js/middleGround/api/store.js
@@ -1,6 +1,12 @@
import request from "../../../request/index";
import { tokenKey, goodsStore } from '../../config'
import { handleQueryResourceListData, handleDetailQueryRequestData } from '../tool'
import {
  tokenKey,
  goodsStore
} from '../../config'
import {
  handleQueryResourceListData,
  handleDetailQueryRequestData
} from '../tool'
const storeApi = {
  /*
    **获取商品列表**
@@ -42,16 +48,9 @@
        Start: paging.start || '0',
        Size: paging.size || '10'
      },
      SortQuery:
        sort?.length == 0
          ? []
          : sort
            ? [sort]
            : [
              {
                LinkOrder: 'Desc'
              }
            ],
      SortQuery: sort?.length == 0 ? [] : sort ? [sort] : [{
        LinkOrder: 'Desc'
      }],
      CreateDate: [],
      Description: [],
      Name: [],
@@ -78,36 +77,32 @@
      query.AccessControl.MainProductId = mainProductId
    }
    if (handelEBooK) {
      query.ProductCmsQuery = [
        {
          QueryCms: {
            Path: '*',
            Type: '\\',
            Name: [],
            Icon: [],
            TypeId: [],
            RefCode: [],
            ChildrenCount: [],
            ChildrenFolderCount: [],
            CreateDate: [],
            SysType: [],
            SaleMethod: [],
            PageQuery: {
              Start: 0,
              Size: 9999
            },
            ProductLinkInfo: []
          }
      query.ProductCmsQuery = [{
        QueryCms: {
          Path: '*',
          Type: '\\',
          Name: [],
          Icon: [],
          TypeId: [],
          RefCode: [],
          ChildrenCount: [],
          ChildrenFolderCount: [],
          CreateDate: [],
          SysType: [],
          SaleMethod: [],
          PageQuery: {
            Start: 0,
            Size: 9999
          },
          ProductLinkInfo: []
        }
      ]
      }]
    }
    const body = {
      query: JSON.stringify({
        Query: [
          {
            Q1: query
          }
        ]
        Query: [{
          Q1: query
        }]
      })
    }
    let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : '';
@@ -180,6 +175,7 @@
        Icon: [],
        TypeId: [],
        RefCode: [],
        Description: [],
        ChildrenCount: [],
        ChildrenFolderCount: [],
        CreateDate: [],
@@ -189,13 +185,9 @@
          Start: 0,
          Size: 9999
        },
        SortQuery: cmsSort
          ? [cmsSort]
          : [
            {
              ProductLinkOrder: 'Asc'
            }
          ],
        SortQuery: cmsSort ? [cmsSort] : [{
          ProductLinkOrder: 'Asc'
        }],
        ProductLinkInfo: [],
        ...itemFields
      }
@@ -209,6 +201,7 @@
        Icon: [],
        TypeId: [],
        RefCode: [],
        Description: [],
        ChildrenCount: [],
        ChildrenFolderCount: [],
        CreateDate: [],
@@ -233,6 +226,7 @@
          Icon: [],
          TypeId: [],
          RefCode: [],
          Description: [],
          LinkTypes: [linkType.linkType],
          PageQuery: {
            Start: 0,
@@ -261,18 +255,15 @@
        Size: '1'
      },
      'Id=': [`${productId}`],
      SortQuery: sort
        ? [sort]
        : [
          {
            LinkOrder: 'Desc'
          }
        ],
      SortQuery: sort ? [sort] : [{
        LinkOrder: 'Desc'
      }],
      CreateDate: [],
      Description: [],
      Name: [],
      Icon: [],
      RefCode: [],
      Description: [],
      TypeId: [],
      SysType: [],
      State: [],
@@ -294,28 +285,25 @@
    const body = {
      query: JSON.stringify({
        Query: [
          {
            Q1: query
          }
        ]
        Query: [{
          Q1: query
        }]
      })
    }
    let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : '';
    let url = token ? '/store/api/ApiQueryProductByAppUser' : '/store/api/ApiQueryProduct'
    return request({
      url: url,
      method: 'post',
      data: body,
      cancelToken: source?.token
    })
        url: url,
        method: 'post',
        data: body,
        cancelToken: source?.token
      })
      .then((resp) => {
        if (resp.length > 0) {
          const data = resp[0]
          if (data.datas.length) {
            data.datas[0].subDatas = data.datas[0].cmsDatas
            const datas = handleDetailQueryRequestData({
              item: data.datas[0],
@@ -664,7 +652,15 @@
      method: 'post',
      data
    })
  },
  //根据销售方式查询商品信息
  getProductBySaleMethod(data) {
    return request({
      url: '/store/api/ApiGetProductBySaleMethod',
      method: 'post',
      data
    })
  }
}
export default storeApi
export default storeApi