| | |
| | | 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 = { |
| | | /* |
| | | **获取商品列表** |
| | |
| | | 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: [], |
| | |
| | | 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) : ''; |
| | |
| | | Start: 0, |
| | | Size: 9999 |
| | | }, |
| | | SortQuery: cmsSort |
| | | ? [cmsSort] |
| | | : [ |
| | | { |
| | | ProductLinkOrder: 'Asc' |
| | | } |
| | | ], |
| | | SortQuery: cmsSort ? [cmsSort] : [{ |
| | | ProductLinkOrder: 'Asc' |
| | | }], |
| | | ProductLinkInfo: [], |
| | | ...itemFields |
| | | } |
| | |
| | | Size: '1' |
| | | }, |
| | | 'Id=': [`${productId}`], |
| | | SortQuery: sort |
| | | ? [sort] |
| | | : [ |
| | | { |
| | | LinkOrder: 'Desc' |
| | | } |
| | | ], |
| | | SortQuery: sort ? [sort] : [{ |
| | | LinkOrder: 'Desc' |
| | | }], |
| | | CreateDate: [], |
| | | Description: [], |
| | | Name: [], |
| | |
| | | |
| | | const body = { |
| | | query: JSON.stringify({ |
| | | Query: [ |
| | | { |
| | | Q1: query |
| | | } |
| | | ] |
| | | Query: [{ |
| | | Q1: query |
| | | }] |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | 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] |
| | |
| | | method: 'post', |
| | | data |
| | | }) |
| | | }, |
| | | //根据销售方式查询商品信息 |
| | | getProductBySaleMethod(data) { |
| | | return request({ |
| | | url: '/store/api/ApiGetProductBySaleMethod', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | } |
| | | |
| | | export default storeApi |
| | | export default storeApi |
| | |
| | | totalSize: res.totalSize |
| | | }) |
| | | res.datas.forEach(item => { |
| | | console.log(res); |
| | | |
| | | this.setData({ |
| | | bookId: res.id, |
| | | bookName: res.name |
| | |
| | | this.setData({ |
| | | shoppingCartData: res.datas |
| | | }); |
| | | console.log(this.data.shoppingCartData, 'shoppingCartData'); |
| | | if (this.data.shoppingCartData.length === 0) { |
| | | this.setData({ |
| | | onDisabled: true |
| | | }) |
| | | } else { |
| | | console.log(2222); |
| | | this.setData({ |
| | | onDisabled: false |
| | | }) |
| | |
| | | console.log(978); |
| | | this.shoppingCartGet() |
| | | }, |
| | | onBook(e) { |
| | | async onBook(e) { |
| | | const item = e.currentTarget.dataset.item |
| | | console.log(item); |
| | | console.log(item.productMonWithLinkDto.product.id); |
| | | console.log(item.productMonWithLinkDto.product.name); |
| | | let parentData = null; |
| | | parentData = await app.MG.store.getProductBySaleMethod({ |
| | | 'saleMethodId': item.saleMethod.id |
| | | }) |
| | | console.log(parentData) |
| | | let bookId = item.productMonWithLinkDto.product.id; |
| | | if (parentData.parentProduct.length > 0) { |
| | | bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id; |
| | | } |
| | | wx.navigateTo({ |
| | | url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name |
| | | url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + item.productMonWithLinkDto.product.name |
| | | }) |
| | | } |
| | | }); |