|
@@ -1,6 +1,6 @@
|
|
|
const _Http = getApp().globalData.http,
|
|
|
file = require("../../utils/FormatTheAttachment");
|
|
|
-
|
|
|
+import currency from "../../utils/currency";
|
|
|
Page({
|
|
|
data: {
|
|
|
loading: true,
|
|
@@ -44,17 +44,22 @@ Page({
|
|
|
title: res.msg,
|
|
|
icon: "none"
|
|
|
})
|
|
|
+ const CNY = num => currency(num, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
+ let newPrice = this.data.newPrice,
|
|
|
+ oldPrice = this.data.oldPrice;
|
|
|
res.data = res.data.map(value => {
|
|
|
if (value.attinfos.length != 0) {
|
|
|
value.attinfos = file.fileList(value.attinfos)
|
|
|
let image = value.attinfos.find(v => v.fileType == "image");
|
|
|
value.cover = image ? image.cover : "";
|
|
|
}
|
|
|
- value.gradeprice && (value.gradeprice = (value.gradeprice - 0).toFixed(2));
|
|
|
- value.marketprice && (value.marketprice = (value.marketprice - 0).toFixed(2));
|
|
|
- value.price && (value.price = (value.price - 0).toFixed(2));
|
|
|
- value.oldprice && (value.oldprice = (value.oldprice - 0).toFixed(2));
|
|
|
- value.contractprice && (value.contractprice = (value.contractprice - 0).toFixed(2));
|
|
|
+
|
|
|
+ if (newPrice) value.newPrice = CNY(value[newPrice] || 0);
|
|
|
+ if (oldPrice) value.oldPrice = CNY(value[oldPrice] || 0);
|
|
|
+
|
|
|
value.brandName = value.brand.map(name => name.brandname)
|
|
|
value.tradefields = value.tradefield.map(name => name.tradefield)
|
|
|
return value;
|