Skip to content

Commit 15cb178

Browse files
YunaiVgitee-org
authored andcommitted
!265 商品模块 60%
Merge pull request !265 from 芋道源码/feature/1.8.0-uniapp
2 parents c8fca2c + e2854cc commit 15cb178

File tree

14 files changed

+1374
-896
lines changed

14 files changed

+1374
-896
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ public
77
# 忽略当前目录下为js的文件的语法检查
88
*.js
99
# 忽略当前目录下为vue的文件的语法检查
10-
*.vue
10+
*.vue
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import request from '@/utils/request'
2+
3+
// 创建优惠券模板
4+
export function create(data) {
5+
return request({
6+
url: '/coupon/template/create',
7+
method: 'post',
8+
data: data
9+
})
10+
}
11+
12+
// 更新优惠券模板
13+
export function update(data) {
14+
return request({
15+
url: '/coupon/template/update',
16+
method: 'put',
17+
data: data
18+
})
19+
}
20+
21+
// 删除优惠券模板
22+
export function deleteCouponTemplete (id) {
23+
return request({
24+
url: '/coupon/template/delete?id=' + id,
25+
method: 'delete'
26+
})
27+
}
28+
29+
// 获得优惠券模板
30+
export function get(id) {
31+
return request({
32+
url: '/coupon/template/get?id=' + id,
33+
method: 'get'
34+
})
35+
}
36+
37+
// 获得优惠券模板分页
38+
export function getPage(query) {
39+
return request({
40+
url: '/coupon/template/page',
41+
method: 'get',
42+
params: query
43+
})
44+
}
45+
46+
// 导出优惠券模板 Excel
47+
export function exportExcel(query) {
48+
return request({
49+
url: '/coupon/template/export-excel',
50+
method: 'get',
51+
params: query,
52+
responseType: 'blob'
53+
})
54+
}

src/api/mall/product/brand.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ export function getBrand(id) {
3434
})
3535
}
3636

37+
// 获得品牌list
38+
export function getBrandList() {
39+
return request({
40+
url: '/product/brand/list',
41+
method: 'get'
42+
})
43+
}
44+
45+
3746
// 获得品牌分页
3847
export function getBrandPage(query) {
3948
return request({

src/api/mall/product/category.js

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import request from '@/utils/request'
22

33
// 创建商品分类
4-
export function createCategory(data) {
4+
export function createProductCategory(data) {
55
return request({
66
url: '/product/category/create',
77
method: 'post',
@@ -10,7 +10,7 @@ export function createCategory(data) {
1010
}
1111

1212
// 更新商品分类
13-
export function updateCategory(data) {
13+
export function updateProductCategory(data) {
1414
return request({
1515
url: '/product/category/update',
1616
method: 'put',
@@ -19,45 +19,26 @@ export function updateCategory(data) {
1919
}
2020

2121
// 删除商品分类
22-
export function deleteCategory(id) {
22+
export function deleteProductCategory(id) {
2323
return request({
2424
url: '/product/category/delete?id=' + id,
2525
method: 'delete'
2626
})
2727
}
2828

2929
// 获得商品分类
30-
export function getCategory(id) {
30+
export function getProductCategory(id) {
3131
return request({
3232
url: '/product/category/get?id=' + id,
3333
method: 'get'
3434
})
3535
}
3636

37-
// 获得商品分类
38-
export function listCategory(query) {
39-
return request({
40-
url: '/product/category/listByQuery',
41-
method: 'get',
42-
params: query
43-
})
44-
}
45-
46-
// 获得商品分类分页
47-
export function getCategoryPage(query) {
37+
// 获得商品分类列表
38+
export function getProductCategoryList(query) {
4839
return request({
49-
url: '/product/category/page',
40+
url: '/product/category/list',
5041
method: 'get',
5142
params: query
5243
})
5344
}
54-
55-
// 导出商品分类 Excel
56-
export function exportCategoryExcel(query) {
57-
return request({
58-
url: '/product/category/export-excel',
59-
method: 'get',
60-
params: query,
61-
responseType: 'blob'
62-
})
63-
}

src/api/mall/product/spu.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,3 @@ export function getSpuPage(query) {
4242
params: query
4343
})
4444
}
45-
46-
// 导出商品spu Excel
47-
export function exportSpuExcel(query) {
48-
return request({
49-
url: '/product/spu/export-excel',
50-
method: 'get',
51-
params: query,
52-
responseType: 'blob'
53-
})
54-
}

src/components/ImageUpload/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export default {
8585
value: {
8686
handler(val) {
8787
if (val) {
88-
// 首先将值转为数组
89-
const list = Array.isArray(val) ? val : this.value.split(',');
88+
// 首先将值转为数组, 当只穿了一个图片时,会报map方法错误
89+
const list = Array.isArray(val) ? val : Array.isArray(this.value.split(',')) ? this.value.split(','): Array.of(this.value);
9090
// 然后将数组转为对象数组
9191
this.fileList = list.map(item => {
9292
if (typeof item === "string") {

src/layout/components/Sidebar/SidebarItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
1414
</template>
1515
<sidebar-item
16-
v-for="child in item.children"
17-
:key="child.path"
16+
v-for="(child, index) in item.children"
17+
:key="child.path + index"
1818
:is-nest="true"
1919
:item="child"
2020
:base-path="resolvePath(child.path)"

src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import './permission' // permission control
1616
import './tongji' // 百度统计
1717
import { getDicts } from "@/api/system/dict/data";
1818
import { getConfigKey } from "@/api/infra/config";
19-
import { parseTime, resetForm, handleTree} from "@/utils/ruoyi";
19+
import { parseTime, resetForm, handleTree, addBeginAndEndTime, divide} from "@/utils/ruoyi";
2020
import Pagination from "@/components/Pagination";
2121
// 自定义表格工具扩展
2222
import RightToolbar from "@/components/RightToolbar"
@@ -35,6 +35,8 @@ Vue.prototype.getDictDatas2 = getDictDatas2
3535
Vue.prototype.getDictDataLabel = getDictDataLabel
3636
Vue.prototype.DICT_TYPE = DICT_TYPE
3737
Vue.prototype.handleTree = handleTree
38+
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime
39+
Vue.prototype.divide = divide
3840

3941
// 全局组件挂载
4042
Vue.component('DictTag', DictTag)

src/utils/ruoyi.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,17 @@ export function getPath(path) {
235235
}
236236
return basePath + path;
237237
}
238+
239+
/**
240+
* 除法保留两位小数
241+
*
242+
* @param {*} divisor 除数
243+
* @param {*} dividend 被除数
244+
* @returns
245+
*/
246+
export function divide(divisor, dividend) {
247+
if(divisor == null || dividend == null || dividend == 0){
248+
return null;
249+
}
250+
return Math.floor(divisor/dividend*100)/100;
251+
}

0 commit comments

Comments
 (0)