diff --git a/http/yskApi/goods.js b/http/yskApi/goods.js index 8173c50..8f66df3 100644 --- a/http/yskApi/goods.js +++ b/http/yskApi/goods.js @@ -5,7 +5,17 @@ import { Base64 } from 'js-base64' import infoBox from '@/commons/utils/infoBox.js' - +function objectToUrlParams(obj) { + let params = []; + for (let key in obj) { + if (obj.hasOwnProperty(key)) { + let value = obj[key]; + let param = encodeURIComponent(key) + '=' + encodeURIComponent(value); + params.push(param); + } + } + return params.join('&'); +} /* 商品列表 */ export function $tbProduct(data) { return http.req('/api/tbProduct', {...data,shopId:uni.getStorageSync('shopId')}, 'GET') @@ -92,7 +102,8 @@ export function $getStocktakin(data){ * 上下架商品 */ export function $updateGrounding(data){ - return http.req('/api/stock/grounding', {...data,shopId:uni.getStorageSync('shopId')}, 'PUT') + const ajaxData={...data,shopId:uni.getStorageSync('shopId')} + return http.req('/api/stock/grounding'+`?${objectToUrlParams(ajaxData)}`, ajaxData, 'PUT') } @@ -107,3 +118,14 @@ export const $productSpec=new $API('/api/tbProductSpec',http.req) +// v2 api start + +/* 商品列表 V2 */ +export function $tbProductV2(data) { + return http.req('/api/tbProduct/list/v2', {...data,shopId:uni.getStorageSync('shopId')}, 'GET') +} +/* 耗材与商品绑定关系 */ +export function $tbProskuConV2(data) { + return http.req('/api/tbProskuCon/V2', data, 'POST') +} +// v2 api end \ No newline at end of file