Skip to content

Commit ab8152a

Browse files
committed
feature(uniapp商品): 商品功能完善
1 parent f297921 commit ab8152a

File tree

4 files changed

+58
-386
lines changed

4 files changed

+58
-386
lines changed

src/main.js

Lines changed: 2 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, addBeginAndEndTime} 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"
@@ -36,6 +36,7 @@ Vue.prototype.getDictDataLabel = getDictDataLabel
3636
Vue.prototype.DICT_TYPE = DICT_TYPE
3737
Vue.prototype.handleTree = handleTree
3838
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime
39+
Vue.prototype.divide = divide
3940

4041
// 全局组件挂载
4142
Vue.component('DictTag', DictTag)

src/utils/ruoyi.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,17 @@ export function getPath(path) {
222222
}
223223
return basePath + path;
224224
}
225+
226+
/**
227+
* 除法保留两位小数
228+
*
229+
* @param {*} divisor 除数
230+
* @param {*} dividend 被除数
231+
* @returns
232+
*/
233+
export function divide(divisor, dividend) {
234+
if(divisor == null || dividend == null || dividend == 0){
235+
return null;
236+
}
237+
return Math.floor(divisor/dividend*100)/100;
238+
}

0 commit comments

Comments
 (0)