|
@@ -27,7 +27,7 @@
|
|
<uni-td align="center">{{ item.productName }}
|
|
<uni-td align="center">{{ item.productName }}
|
|
</uni-td>
|
|
</uni-td>
|
|
<uni-td align="center">
|
|
<uni-td align="center">
|
|
- <view class="name">{{ item.type }}</view>
|
|
|
|
|
|
+ <view class="name">{{ item.type}}</view>
|
|
</uni-td>
|
|
</uni-td>
|
|
<uni-td align="center">{{ item.price }}
|
|
<uni-td align="center">{{ item.price }}
|
|
</uni-td>
|
|
</uni-td>
|
|
@@ -132,9 +132,16 @@ export default {
|
|
uni.stopPullDownRefresh();
|
|
uni.stopPullDownRefresh();
|
|
},
|
|
},
|
|
dataFormat(rows) {
|
|
dataFormat(rows) {
|
|
|
|
+ // 创建一个映射对象,键是id,值是productName
|
|
|
|
+ const idToProductName = this.categories.reduce((acc, cur) => {
|
|
|
|
+ acc[cur.id] = cur.productName;
|
|
|
|
+ return acc;
|
|
|
|
+ }, {});
|
|
return rows.map(item => {
|
|
return rows.map(item => {
|
|
let date = new Date(item.createTime);
|
|
let date = new Date(item.createTime);
|
|
item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
|
|
item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
|
|
|
|
+ // 使用映射对象将type的值从id转换为productName
|
|
|
|
+ item.type = idToProductName[item.type] || item.type;
|
|
return item;
|
|
return item;
|
|
});
|
|
});
|
|
},
|
|
},
|