warehouseReserves.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. console.log(warehouseId,warehouseId2)
  91. if(warehouseId==warehouseId2 ){
  92. index++;
  93. data.content.push({...res.data.data[k]})
  94. if(this.dataList.length>0){
  95. if(this.dataList.every( function( item, index, array ){
  96. return item.name!=data.name })){
  97. this.dataList.push(JSON.parse(JSON.stringify(data)))
  98. }else{
  99. for (var q = 0; q < this.dataList.length; q++) {
  100. if(this.dataList[q].name==data.name){
  101. this.dataList[q]=JSON.parse(JSON.stringify(data))
  102. }
  103. }
  104. }
  105. }else{
  106. this.dataList.push(JSON.parse(JSON.stringify(data)))
  107. }
  108. }else{
  109. data.name=res.data.data[k].warehouseName
  110. data.content.push({...res.data.data[k]})
  111. if(this.dataList.length>0){
  112. if(this.dataList.every( function( item, index, array ){ return item.name!=data.name })){
  113. this.dataList.push(JSON.parse(JSON.stringify(data)))
  114. }else{
  115. for (var q = 0; q < this.dataList.length; q++) {
  116. if(this.dataList[q].name==data.name){
  117. this.dataList[q]=JSON.parse(JSON.stringify(data))
  118. }
  119. }
  120. }
  121. }else{
  122. this.dataList.push(JSON.parse(JSON.stringify(data)))
  123. }
  124. data.content=[]
  125. index = 1;
  126. }
  127. i++
  128. }
  129. }else{
  130. this.dataList=[]
  131. }
  132. if(this.dataList.length>0){
  133. for (var q = 0; q < this.dataList.length; q++) {
  134. var num=0
  135. for (var k = 0; k < this.dataList[q].content.length; k++) {
  136. if(this.dataList[q].content[k].goodsName.indexOf('玉米')==-1){
  137. this.dataList[q].content[k].status=0
  138. }else{
  139. this.dataList[q].content[k].status=1
  140. }
  141. this.dataList[q].content[k].value=(this.dataList[q].content[k].cost*this.dataList[q].content[k].storage).toFixed(4)
  142. num+=Number(this.dataList[q].content[k].value)
  143. }
  144. this.dataList[q].value=Number(num).toFixed(4)
  145. }
  146. }
  147. console.log(this.dataList)
  148. })
  149. },
  150. getdata(e) {
  151. console.log(e)
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .content{
  158. background:#F5F6FA;
  159. }
  160. .content-item{
  161. background:#fff;
  162. margin:10px;
  163. padding:10px;
  164. border-radius:6px;
  165. font-size:14px;
  166. .big-title,.big-price{
  167. font-size:16px;
  168. }
  169. .big-price{
  170. color:#22C572;
  171. }
  172. .orange-title {
  173. color:#FE6430;
  174. font-size:24rpx;
  175. background:#FEECE6;
  176. position:absolute;
  177. padding:3px;
  178. border-radius:3px;
  179. text-align:center;
  180. }
  181. .green-title {
  182. color:#22C572;
  183. font-size:24rpx;
  184. }
  185. }
  186. charts-box {
  187. // background: black;
  188. position: relative;
  189. // top: 70vh;
  190. }
  191. .content2 .row,
  192. .content4 .row {
  193. display: flex;
  194. justify-content: space-around;
  195. background: #24262d;
  196. padding: 40rpx 20rpx;
  197. .item-top,
  198. .item-bottom {
  199. color: #d5d5d5;
  200. }
  201. .item-bottom {
  202. display: flex;
  203. align-items: center;
  204. }
  205. }
  206. .bottom-tip {
  207. position: absolute;
  208. z-index: 11;
  209. color: #8c8c8d;
  210. right: 10px;
  211. bottom: 10px;
  212. }
  213. .title-margin {
  214. bottom: 120rpx;
  215. }
  216. </style>