position.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="content">
  3. <view class="big_title">{{warehousename}}</view>
  4. <view class="cost-list" v-for="(item,index) in costList">
  5. <view style="display: flex;justify-content: space-between;">
  6. <view class="title">仓位号:{{item.binNumber}}</view>
  7. </view>
  8. <view class="goods-table">
  9. <view class="goods-table-title">
  10. <view class="font">货名</view>
  11. <view class="font">储量(吨)</view>
  12. <view class="font">价值(元)</view>
  13. </view>
  14. <view class="goods-table-content" v-for="(item1,index1) in item.warehousePositionStorageInfoList">
  15. <view class="font" :class="item.warehousePositionStorageInfoList.length>1&&index1==item.warehousePositionStorageInfoList.length-1?'active':''">
  16. {{item1.goodsName}}
  17. </view>
  18. <view class="font" :class="item.warehousePositionStorageInfoList.length>1&&index1==item.warehousePositionStorageInfoList.length-1?'active':''">
  19. {{item1.storage}}
  20. </view>
  21. <view class="font">{{item1.cost}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- <u-modal class="record" v-model="isShowDetailBtn" :title-style="{fontSize: '18px',fontWeight:'500'}"
  26. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='导出记录'
  27. showCancelButton='false' @confirm="alertBtn" @cancel="cancelClick">
  28. <view>
  29. <u-radio-group v-model="value">
  30. <u-radio active-color="#22C572" @change="radioChange" v-for="(item, index) in list" :key="index"
  31. :name="item.name" :disabled="item.disabled">
  32. {{item.name}}
  33. </u-radio>
  34. </u-radio-group>
  35. <view class="modal-row">
  36. <view class="">查询日期</view>
  37. <view class="" @click="selectDate">
  38. {{parameter.endDate?parameter.startDate+' - '+parameter.endDate:'请选择查询日期'}}
  39. </view>
  40. </view>
  41. <view class="modal-row">
  42. <view class="">仓库名称</view>
  43. <view>{{parameter.warehouseName}}</view>
  44. </view>
  45. </view>
  46. </u-modal>
  47. <u-calendar v-model="show" :mode="mode" @change="change" range-color='#22C572' btn-type='success'
  48. range-bg-color='rgba(25, 190, 107, 0.13)' active-bg-color='#22C572'></u-calendar>
  49. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  50. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
  51. showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal> -->
  52. </view>
  53. </template>
  54. <script>
  55. import helper from '@/common/helper.js';
  56. import {
  57. mapState
  58. } from 'vuex';
  59. export default {
  60. data() {
  61. return {
  62. isShowAlert: false,
  63. content: '当前登录身份已失效,请重新登录!',
  64. warehousename:'',
  65. warehouseId: '',
  66. parameter: {
  67. startDate: "",
  68. endDate: '',
  69. warehouseName: ''
  70. },
  71. show: false,
  72. mode: 'range',
  73. list: [{
  74. name: '入库记录',
  75. disabled: false
  76. },
  77. {
  78. name: '出库记录',
  79. disabled: false
  80. }
  81. ],
  82. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  83. value: '入库记录',
  84. costList: [],
  85. isShowDetailBtn: false
  86. }
  87. },
  88. onLoad: function(option) {
  89. this.warehousename=option.warehouse
  90. this.warehouseId=option.warehouseId
  91. this.init()
  92. },
  93. computed: {
  94. ...mapState(['hasLogin', 'userInfo']),
  95. },
  96. methods: {
  97. alertBtn() {
  98. uni.navigateTo({
  99. url: '/pages/public/login'
  100. })
  101. },
  102. // goposition(item){
  103. // uni.navigateTo({
  104. // url: '/pages/user/contractLook/position?warehouse='+item.warehouseName+'&warehouseType='+item.warehouseType
  105. // })
  106. // },
  107. cancelClick() {
  108. this.isShowAlert = false
  109. },
  110. selectDate() {
  111. this.show = true
  112. },
  113. change(e) {
  114. this.parameter.startDate = e.startDate
  115. this.parameter.endDate = e.endDate
  116. },
  117. radioChange(e) {
  118. console.log(e);
  119. },
  120. alertBtn() {
  121. let _url = ''
  122. if (this.value == '入库记录') {
  123. _url = '/warehouseBaseInfo/exportphone'
  124. } else {
  125. _url = "/warehouseBaseInfo/exportPhoneOut"
  126. }
  127. uni.showLoading({
  128. title: '正在加载'
  129. })
  130. this.$api.doRequest('post', _url, {
  131. startDate: this.parameter.startDate,
  132. endDate: this.parameter.endDate,
  133. warehouseName: this.parameter.warehouseName
  134. }).then(res => {
  135. uni.hideLoading()
  136. console.log('-----------')
  137. console.log(res.data.data)
  138. uni.downloadFile({
  139. url: res.data.data,
  140. success: function(res) {
  141. var filePath = res.tempFilePath;
  142. uni.openDocument({
  143. filePath: filePath,
  144. showMenu: true,
  145. success: function(res) {
  146. console.log('打开文档成功');
  147. }
  148. });
  149. }
  150. });
  151. })
  152. },
  153. cancelClick() {
  154. this.isShowDetailBtn = false
  155. },
  156. toDetail(warehouseName) {
  157. this.parameter.warehouseName = warehouseName
  158. this.parameter.startDate = helper.getNowFormatDate()
  159. this.parameter.endDate = helper.getNowFormatDate()
  160. this.isShowDetailBtn = true
  161. },
  162. init() {
  163. if (!this.hasLogin) {
  164. this.isShowAlert = true;
  165. } else {
  166. uni.showLoading({
  167. title: '正在加载'
  168. })
  169. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  170. id:this.warehouseId
  171. }).then(res => {
  172. uni.hideLoading()
  173. if (res.data.data) {
  174. const results = res.data.data.warehousePositionInfoList
  175. for (let i = 0; i < results.length; i++) {
  176. if(results[i].warehousePositionStorageInfoList&&results[i].warehousePositionStorageInfoList.length>1){
  177. let _price = 0
  178. for (let q = 0; q < results[i].warehousePositionStorageInfoList.length; q++) {
  179. _price +=Number(results[i].warehousePositionStorageInfoList[q].storage)
  180. }
  181. _price = _price.toFixed(2)
  182. results[i].warehousePositionStorageInfoList.push({
  183. 'goodsName': '合计',
  184. 'storage': _price
  185. })
  186. }
  187. this.costList =results
  188. }
  189. }
  190. })
  191. }
  192. },
  193. makeGroupData(array, fn) {
  194. const groups = {};
  195. array.forEach(function(item) {
  196. const group = JSON.stringify(fn(item));
  197. groups[group] = groups[group] || [];
  198. groups[group].push(item);
  199. });
  200. return Object.keys(groups).map(function(group) {
  201. return groups[group];
  202. })
  203. }
  204. }
  205. }
  206. </script>
  207. <style scoped lang="scss">
  208. .active {
  209. font-size: 32rpx;
  210. font-weight: 700;
  211. }
  212. .modal-row {
  213. display: flex;
  214. justify-content: space-between;
  215. padding: 10rpx 60rpx;
  216. margin-top: 20rpx;
  217. margin-bottom: 20rpx;
  218. }
  219. .u-radio-group {
  220. width: 100%;
  221. display: flex;
  222. justify-content: space-between;
  223. }
  224. .u-radio {
  225. width: 50% !important;
  226. display: flex;
  227. justify-content: center;
  228. }
  229. .record {
  230. background: red;
  231. display: flex;
  232. justify-content: center;
  233. }
  234. .button {
  235. font-size: 24rpx;
  236. padding: 4rpx 20rpx;
  237. border-radius: 15px;
  238. background: #22C572;
  239. color: white;
  240. // margin: 0 10px;
  241. }
  242. .cost-list {
  243. margin: 20rpx;
  244. background: white;
  245. border-radius: 20rpx;
  246. padding: 20rpx;
  247. .title {
  248. font-size: 32rpx;
  249. font-weight: 500;
  250. color: #333333;
  251. }
  252. .goods-table {
  253. margin-top: 22rpx;
  254. }
  255. .goods-table-title {
  256. display: flex;
  257. border-bottom: 1px solid #EEEEEE;
  258. padding-bottom: 16rpx;
  259. // margin-bottom: ;
  260. .font {
  261. font-size: 27rpx;
  262. font-weight: 400;
  263. color: #B2B3BB;
  264. }
  265. .font:nth-of-type(1) {
  266. width: 40%;
  267. }
  268. .font:nth-of-type(2) {
  269. width: 30%;
  270. }
  271. .font:nth-of-type(3) {
  272. width: 30%;
  273. text-align: right;
  274. }
  275. }
  276. .goods-table-content {
  277. display: flex;
  278. margin: 22rpx;
  279. font-size: 28rpx;
  280. font-weight: 400;
  281. color: #333333;
  282. .font:nth-of-type(1) {
  283. width: 40%;
  284. }
  285. .font:nth-of-type(2) {
  286. width: 30%;
  287. }
  288. .font:nth-of-type(3) {
  289. width: 30%;
  290. text-align: right;
  291. }
  292. }
  293. }
  294. .big_title{
  295. font-size:20px;
  296. padding:10px 0 0 10px;
  297. }
  298. </style>