warehouseReserves.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view>
  3. <view style='background:#fff;padding:15px 10px 10px;border-radius:0 0 10px 10px;'>
  4. <u-search bgColor='#F5F6F9' @change='keyWordChange' :show-action="false" placeholder="请输入仓库名" v-model="warehouseName"></u-search>
  5. </view>
  6. <view class='content'>
  7. <view class='content-item' v-for='item in dataList'>
  8. <view style='padding:10px 0;font-weight:600;' class="flex justify-between">
  9. <view class="big-title">{{item.name}}</view>
  10. <view class="big-price">¥{{item.value}}</view>
  11. </view>
  12. <view v-for='(item2,index) in item.content'>
  13. <view style='margin:10px 0;padding:0 10px 10px;' :style='{"border-bottom":index!=item.content.length-1?"1px solid #eee":""}'>
  14. <view style='width:100%;height:30px;' v-if='item2.status==1'>
  15. <view class="orange-title">{{item2.goodsName}}</view>
  16. </view>
  17. <view v-else>
  18. <view class="green-title">{{item2.goodsName}}</view>
  19. </view>
  20. <view style='color:#878C9C;' class="flex justify-between">
  21. <view>{{item2.storage}}吨</view>
  22. <view>{{item2.cost}}元/吨</view>
  23. <view>{{item2.value}}元</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. chartlist: [],
  36. carCount1: '',
  37. carCount2: '',
  38. carCount3: '',
  39. inventoryCost: '',
  40. inventoryValue: '',
  41. ZChart: {},
  42. // url:"https://datav.aliyuncs.com/share/235518097ffd673bc1eb05011b9a02b6",
  43. url: '',
  44. flag: true,
  45. chartData: {},
  46. ringoptions: {},
  47. dataList:[],
  48. currentPage:1,
  49. pageSize:10,
  50. warehouseId:'',
  51. warehouseName:''
  52. }
  53. },
  54. onLoad: function(option) {
  55. uni.showLoading({
  56. title: "加载中",
  57. mask: true
  58. })
  59. this.init()
  60. },
  61. methods: {
  62. keyWordChange(e){
  63. this.warehouseName=e
  64. uni.showLoading({
  65. title: "加载中",
  66. mask: true
  67. })
  68. this.init()
  69. },
  70. init() {
  71. this.dataList=[]
  72. this.$api.doRequest('get', '/costManagementInfo/selectCostManagementInfo',
  73. {compId:uni.getStorageSync('pcUserInfo').compId,
  74. warehouseId: this.warehouseId,
  75. warehouseName: this.warehouseName,
  76. warehouseType: 1,currentPage: this.currentPage,pageSize: this.pageSize,searchKeyWord:this.searchKeyWord}).then(res => {
  77. uni.hideLoading()
  78. var data={
  79. name:'',
  80. content:[]
  81. }
  82. var id=''
  83. let index = 1;
  84. let i = 0;
  85. if(res.data.data.length>0){
  86. for(let k in res.data.data){
  87. data.name=res.data.data[k].warehouseName
  88. let {warehouseId} = res.data.data[i];
  89. let {warehouseId:warehouseId2} = res.data.data[i+1]||{}
  90. if(warehouseId==warehouseId2 ){
  91. index++;
  92. data.content.push({...res.data.data[k]})
  93. if(this.dataList.length>0){
  94. if(this.dataList.every( function( item, index, array ){
  95. return item.name!=data.name })){
  96. this.dataList.push(JSON.parse(JSON.stringify(data)))
  97. }else{
  98. for (var q = 0; q < this.dataList.length; q++) {
  99. if(this.dataList[q].name==data.name){
  100. this.dataList[q]=JSON.parse(JSON.stringify(data))
  101. }
  102. }
  103. }
  104. }else{
  105. this.dataList.push(JSON.parse(JSON.stringify(data)))
  106. }
  107. }else{
  108. data.name=res.data.data[k].warehouseName
  109. data.content.push({...res.data.data[k]})
  110. if(this.dataList.length>0){
  111. if(this.dataList.every( function( item, index, array ){ return item.name!=data.name })){
  112. this.dataList.push(JSON.parse(JSON.stringify(data)))
  113. }else{
  114. for (var q = 0; q < this.dataList.length; q++) {
  115. if(this.dataList[q].name==data.name){
  116. this.dataList[q]=JSON.parse(JSON.stringify(data))
  117. }
  118. }
  119. }
  120. }else{
  121. this.dataList.push(JSON.parse(JSON.stringify(data)))
  122. }
  123. data.content=[]
  124. index = 1;
  125. }
  126. i++
  127. }
  128. }else{
  129. this.dataList=[]
  130. }
  131. if(this.dataList.length>0){
  132. for (var q = 0; q < this.dataList.length; q++) {
  133. var num=0
  134. for (var k = 0; k < this.dataList[q].content.length; k++) {
  135. if(this.dataList[q].content[k].goodsName.indexOf('玉米')==-1){
  136. this.dataList[q].content[k].status=0
  137. }else{
  138. this.dataList[q].content[k].status=1
  139. }
  140. this.dataList[q].content[k].value=(this.dataList[q].content[k].cost*this.dataList[q].content[k].storage).toFixed(4)
  141. num+=Number(this.dataList[q].content[k].value)
  142. }
  143. this.dataList[q].value=Number(num).toFixed(2)
  144. }
  145. }
  146. console.log(this.dataList)
  147. })
  148. },
  149. getdata(e) {
  150. console.log(e)
  151. }
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .content{
  157. background:#F5F6FA;
  158. }
  159. .content-item{
  160. background:#fff;
  161. margin:10px;
  162. padding:10px;
  163. border-radius:6px;
  164. font-size:14px;
  165. .big-title,.big-price{
  166. font-size:16px;
  167. }
  168. .big-price{
  169. color:#22C572;
  170. }
  171. .orange-title {
  172. color:#FE6430;
  173. font-size:24rpx;
  174. background:#FEECE6;
  175. position:absolute;
  176. padding:3px;
  177. border-radius:3px;
  178. text-align:center;
  179. }
  180. .green-title {
  181. color:#22C572;
  182. font-size:24rpx;
  183. }
  184. }
  185. charts-box {
  186. // background: black;
  187. position: relative;
  188. // top: 70vh;
  189. }
  190. .content2 .row,
  191. .content4 .row {
  192. display: flex;
  193. justify-content: space-around;
  194. background: #24262d;
  195. padding: 40rpx 20rpx;
  196. .item-top,
  197. .item-bottom {
  198. color: #d5d5d5;
  199. }
  200. .item-bottom {
  201. display: flex;
  202. align-items: center;
  203. }
  204. }
  205. .bottom-tip {
  206. position: absolute;
  207. z-index: 11;
  208. color: #8c8c8d;
  209. right: 10px;
  210. bottom: 10px;
  211. }
  212. .title-margin {
  213. bottom: 120rpx;
  214. }
  215. </style>