Browse Source

小程序:商家端-商品添加api

panyong 2 years ago
parent
commit
9269b08c1c
1 changed files with 80 additions and 0 deletions
  1. 80 0
      htmldev/wxMini/pages/businessGoodsEdit/api/index.js

+ 80 - 0
htmldev/wxMini/pages/businessGoodsEdit/api/index.js

@@ -0,0 +1,80 @@
+const { request } = require('../../../api/request')
+/**
+ * 商品分类
+ * @returns {Promise<*>}
+ */
+export const getProductCategoryList = () => request({
+  url: '/api/shop/product/category/list',
+  method: 'POST',
+  showLoading: true
+})
+
+/**
+ * 商品品牌
+ * @returns {Promise<*>}
+ */
+export const getProductBrandList = () => request({
+  url: '/api/shop/product/brand/list',
+  method: 'POST',
+  showLoading: true
+})
+
+/**
+ * 商品添加
+ * @param obj
+ * @returns {Promise<*>}
+ */
+export const postAddProduct = (obj) => request({
+  url: '/api/shop/product/add',
+  method: 'POST',
+  data: {
+    // "product_img_url": "sdsd", //商品主图
+    // "product_rotation_img_list": [
+    //   "sdsjdsd"
+    // ], //商品轮播图
+    // "product_detail_img_list": [
+    //   "sdsndish"
+    // ], //详情图
+    // "product_title": "测试商品", //商品标题
+    // "product_category_id": 1, //分类ID
+    // "product_brand_id": 1, //品牌ID
+    // "product_spec": "xl", //规格
+    // "product_unit": "个", //单位
+    // "product_all_price": 10000, //批发价
+    // "product_price": 9000, //零售价
+    // "product_count": 1000, //库存
+    // "product_sale_at": 0 //预售时间(0代表预售)
+  },
+  showLoading: true
+})
+
+/**
+ * 商品编辑
+ * @param obj
+ * @returns {Promise<*>}
+ */
+export const postModifyProduct = (obj) => request({
+  url: '/api/shop/product/modify',
+  method: 'POST',
+  data: {
+    ...obj
+    // "id": 1,
+    // "product_img_url": "sdsd", //商品主图
+    // "product_rotation_img_list": [
+    //   "sdsjdsd"
+    // ], //商品轮播图
+    // "product_detail_img_list": [
+    //   "sdsndish"
+    // ], //详情图
+    // "product_title": "测试商品1", //商品标题
+    // "product_category_id": 1, //分类ID
+    // "product_brand_id": 1, //品牌ID
+    // "product_spec": "xl", //规格
+    // "product_unit": "个", //单位
+    // "product_all_price": 10000, //批发价
+    // "product_price": 9000, //零售价
+    // "product_count": 1000, //库存
+    // "product_status": 0 //状态(0下架1上架)
+  },
+  showLoading: true
+})