position.vue 7.8 KB

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