parent
6da827ee3d
commit
f2a607eca3
6 changed files with 1 additions and 69 deletions
@ -1,22 +0,0 @@ |
||||
const my_assets = require('../../utils/my_assets.js') |
||||
|
||||
Page({ |
||||
data: { |
||||
my_asset: '', |
||||
years: '', |
||||
}, |
||||
|
||||
onLoad: function(params) { |
||||
var that = this |
||||
|
||||
my_assets.getAsset(params.sku, function(result) { |
||||
var data = getApp().store.sync(result.data) |
||||
that.setData({'my_asset': data}) |
||||
that.setData({'years': Object.keys(data['inventory-changes'])}) |
||||
wx.setStorage({ |
||||
key: "my_asset", |
||||
data: data |
||||
}) |
||||
}) |
||||
} |
||||
}) |
@ -1,23 +0,0 @@ |
||||
<view> |
||||
<image src="{{my_asset['product-icon']}}"></image> |
||||
<text>{{my_asset.product.name}}</text> |
||||
<text>资产编号{{my_asset.no}}</text> |
||||
<text>{{my_asset.product.unit}}</text> |
||||
|
||||
<block wx:for="{{my_asset['sub-products']}}" wx:for-item="sub_product"> |
||||
<view class="item"> |
||||
<text>{{sub_product.name}} {{sub_product.stock}}</text> |
||||
</view> |
||||
</block> |
||||
|
||||
<block wx:for="{{years}}" wx:for-item="year"> |
||||
<text>{{year}}</text> |
||||
<block wx:for="{{my_asset['inventory-changes'][year]}}" wx:for-item="inventory_change"> |
||||
<view class="item"> |
||||
<text>原因{{inventory_change.reason}}</text> |
||||
<text>数量{{(inventory_change.quantity)/1000}}克</text> |
||||
</view> |
||||
</block> |
||||
</block> |
||||
|
||||
</view> |
@ -1,16 +0,0 @@ |
||||
const app = getApp() |
||||
|
||||
function getAsset (sku, resolve) { |
||||
app.request({ |
||||
url: `${app.globalData.API_URL}/my_assets/${sku}`, |
||||
success: resolve, |
||||
fail: function(){} |
||||
}) |
||||
} |
||||
|
||||
|
||||
module.exports = { |
||||
getAsset(sku, resolve) { |
||||
return getAsset(sku, resolve) |
||||
} |
||||
} |
Loading…
Reference in new issue