| | |
| | | */ |
| | | |
| | | import { http, Method } from "@/utils/request.js"; |
| | | import api from "@/config/api.js"; |
| | | |
| | | /** |
| | | * 从ES中获取相关商品品牌名称,分类名称及属性 |
| | |
| | | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 卖家商品列表 |
| | | * |
| | | */ |
| | | export function getStoreGoods(params) { |
| | | return http.request({ |
| | | url: api.store + '/goods/goods/list', |
| | | method: Method.GET, |
| | | needToken: true, |
| | | params |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 卖家商品详情 |
| | | * |
| | | */ |
| | | export function getStoreGoodsInfo(id) { |
| | | return http.request({ |
| | | url: api.store + `/goods/goods/get/${id}`, |
| | | needToken: true, |
| | | method: Method.GET |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建商品 |
| | | */ |
| | | export function createStoreGoods(params) { |
| | | return http.request({ |
| | | url: api.store + `/goods/goods/create`, |
| | | method: Method.POST, |
| | | needToken: true, |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 修改商品 |
| | | */ |
| | | export function updateStoreGoods(params) { |
| | | return http.request({ |
| | | url: api.store + +`/goods/goods/update/${params.id}`, |
| | | needToken: true, |
| | | method: Method.PUT, |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 卖家商品分类信息 |
| | | * |
| | | */ |
| | | export function getStoreGoodsCategory() { |
| | | return http.request({ |
| | | url: api.store + `/goods/category/all`, |
| | | needToken: true, |
| | | method: Method.GET |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 卖家商品分类信息 |
| | | * |
| | | */ |
| | | export function getStoreGoodsBrands(categoryId) { |
| | | return http.request({ |
| | | url: api.store + `/goods/category/${categoryId}/brands`, |
| | | needToken: true, |
| | | method: Method.GET |
| | | }) |
| | | } |
| | | export function getgoodsUnit() { |
| | | return http.request({ |
| | | url: api.store + `/goods/goodsUnit`, |
| | | needToken: true, |
| | | method: Method.GET, |
| | | params: { pageNumber: 1, pageSize: 200 } |
| | | }) |
| | | } |
| | | |
| | |
| | | im: "http://127.0.0.1:8885", |
| | | common: "http://127.0.0.1:8890", |
| | | buyer: "http://127.0.0.1:8888", |
| | | store: "http://127.0.0.1:8889", |
| | | // common: "http://192.168.0.113:8890", |
| | | // buyer: "http://192.168.0.113:8888", |
| | | // im: "http://192.168.0.113:8885", |
| | |
| | | |
| | | api.buyer += "/buyer"; |
| | | api.common += "/common"; |
| | | api.store += "/store"; |
| | | api.im += "/im"; |
| | | export default { |
| | | ...api, |
| | |
| | | "style" : |
| | | { |
| | | "enablePullDownRefresh" : true, |
| | | "navigationBarTitleText" : "商品列表" |
| | | "navigationBarTitleText" : "商品列表", |
| | | "componentPlaceholder": { |
| | | "u-icon": "view", |
| | | "u-button": "view", |
| | | "u-form": "view", |
| | | "u-form-item": "view", |
| | | "u-input": "view", |
| | | "u-popup": "view", |
| | | "u-search": "view" |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path" : "pages/goods-manager/addGoods/addGoods", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "" |
| | | "enablePullDownRefresh" : true, |
| | | "navigationBarTitleText" : "新增商品", |
| | | "componentPlaceholder": { |
| | | "u-icon": "view", |
| | | "u-button": "view", |
| | | "u-form": "view", |
| | | "u-form-item": "view", |
| | | "u-input": "view", |
| | | "u-popup": "view", |
| | | "u-search": "view" |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> |
| | | |
| | | <u-form-item label="商品分类" label-width="130" prop=""> |
| | | <div @click="showPicker"> |
| | | {{ form.___path || '请选择所在地区' }} |
| | | </div> |
| | | <picker @change="bindCategoryChange" :value="index" :range="categoryArray"> |
| | | <view class="uni-input">{{categoryArray[index]}}</view> |
| | | </picker> |
| | | </u-form-item> |
| | | |
| | | <u-form-item class="border" label="商品名称" label-width="130" prop="name"> |
| | |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="商品品牌" label-width="130" prop=""> |
| | | <div @click="showPicker"> |
| | | {{ form.___path || '请选择所在地区' }} |
| | | <div @click="showBrands"> |
| | | {{ form.___path || '请选择品牌' }} |
| | | </div> |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="计量单位" label-width="130" prop="___path"> |
| | | <div @click="showPicker"> |
| | | <div @click="showUnit"> |
| | | {{ form.___path || '请选择所在地区' }} |
| | | </div> |
| | | </u-form-item> |
| | |
| | | import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; |
| | | import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; |
| | | import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; |
| | | import UActionSheet from '@/uview-components/uview-ui/components/u-action-sheet/u-action-sheet.vue'; |
| | | |
| | | |
| | | import storage from "@/utils/storage.js"; |
| | | import * as API_GOODS from "@/api/goods.js"; |
| | | export default { |
| | | components: { UForm, UFormItem, UInput, UUpload, UCheckboxGroup, UCheckbox, UIcon, UActionSheet }, |
| | | components: { UForm, UFormItem, UInput, UUpload, UCheckboxGroup, UCheckbox, UIcon }, |
| | | data() { |
| | | return { |
| | | storage, |
| | | form: {} |
| | | form: {}, |
| | | categoryArray:[], |
| | | brandsArray:[], |
| | | unitArray:[] |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }); |
| | | this.form.images = images; |
| | | }, |
| | | bindCategoryChange(){}, |
| | | bindBrandsChange(){}, |
| | | bindUnitChange(){}, |
| | | initCategory(){ |
| | | API_GOODS.getStoreGoodsCategory().then((res) => { |
| | | const params = res.data.result; |
| | | this.categoryArray = params |
| | | if(params.length>0){ |
| | | this.initBrands(params[0].id) |
| | | } |
| | | }); |
| | | }, |
| | | initBrands(categoryId){ |
| | | API_GOODS.getStoreGoodsBrands(categoryId).then((res) => { |
| | | const params = res.data.result; |
| | | this.brandsArray = params |
| | | }); |
| | | }, |
| | | initGoods(){ |
| | | API_GOODS.getgoodsUnit().then((res) => { |
| | | const params = res.data.result; |
| | | this.unitArray = params |
| | | }); |
| | | }, |
| | | }, |
| | | onShow() { |
| | | this.initGoods() |
| | | this.initCategory() |
| | | |
| | | }, |
| | | onLoad(option) { |
| | | uni.showLoading({ |
| | | title: "加载中", |
| | | }); |
| | | this.routerVal = option; |
| | | console.log(option); |
| | | |
| | | if (option.id) { |
| | | getGoodsDetail(option.id).then((res) => { |
| | | API_GOODS.getStoreGoodsInfo(option.id).then((res) => { |
| | | const params = res.data.result; |
| | | params.___path = params.consigneegoodsPath; |
| | | this.$set(this, "form", params); |
| | |
| | | <script> |
| | | |
| | | import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; |
| | | |
| | | import * as API_GOODS from "@/api/goods.js"; |
| | | |
| | | export default { |
| | | components: { UIcon }, |
| | | data() { |
| | |
| | | formData: { |
| | | waterfall: false, // 布局方向切换 |
| | | status: 'loading', // 加载状态 |
| | | }, |
| | | params: { |
| | | pageNumber: 1, |
| | | pageSize: 10, |
| | | }, |
| | | data: [ |
| | | { |
| | |
| | | tipShow: false // 是否显示顶部提示框 |
| | | }; |
| | | }, |
| | | onLoad() { }, |
| | | methods: { |
| | | load(data, ended) { |
| | | if (ended) { |
| | | this.formData.status = 'noMore' |
| | | onLoad() { |
| | | }, |
| | | onShow() { |
| | | if (this.$options.filters.tipsToLogin()) { |
| | | this.getGoodsList(); |
| | | } |
| | | }, |
| | | addGoods(id) { |
| | | console.log("addGoods:" + id); |
| | | methods: { |
| | | |
| | | getGoodsList() { |
| | | uni.showLoading(); |
| | | API_GOODS.getStoreGoods( |
| | | this.params.pageNumber, |
| | | this.params.pageSize |
| | | ).then((res) => { |
| | | this.data = res.data.result.records; |
| | | |
| | | if (this.$store.state.isShowToast) { uni.hideLoading() }; |
| | | }); |
| | | }, |
| | | addGoods(id) { |
| | | uni.navigateTo({ |
| | | url: `/pages/goods-manager/addGoods/addGoods${id ? "?id=" + id : ""}`, |
| | | }); |