warehouseWeighing.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <u-search placeholder="输入编号/客户号/车牌号" v-model="inputKeyword" @search="getList()"></u-search>
  5. <view class="dropdown">
  6. <view class="left" @click="selectWarehouse">
  7. <view>{{warehouseName}}</view>
  8. <u-icon name="arrow-down" color=""></u-icon>
  9. </view>
  10. <!-- <view class="right">
  11. <u-icon name="checkmark-circle-fill" color="#22C572"></u-icon>
  12. <view class="default">默认</view>
  13. </view> -->
  14. </view>
  15. <u-select v-model="isShowWarehouse" :list="warehouseList" @confirm="confirmWarehouse"></u-select>
  16. </view>
  17. <view class="middle">
  18. <view class="item-style" v-for="(item,index) in dataList" :key="index" @click="toDetail(item)">
  19. <view class="row1">
  20. <view class="row1-left">
  21. <view class="left status1" v-if="item.status=='已质检'">检</view>
  22. <view class="left status2" v-if="item.status=='已称皮重'">皮</view>
  23. <view class="left status3" v-if="item.status=='已称毛重'">毛</view>
  24. <view>
  25. <view class="top-title">
  26. {{item.contractNo}}
  27. </view>
  28. <view class="bottom">{{item.updateDate}}</view>
  29. </view>
  30. </view>
  31. <view class="right">{{item.customer}}</view>
  32. </view>
  33. <view class="row2" v-if="item.paymentManagement">
  34. <view>{{item.paymentManagement.customerName}}</view>
  35. <view>{{item.paymentManagement.carNo}}</view>
  36. <view>{{item.paymentManagement.goodsName}}({{item.qualityInspectionManagement.waterContent}}水)
  37. </view>
  38. </view>
  39. <view class="row3">
  40. <view class="row3-item">
  41. <view class="left">皮</view>
  42. <view>{{item.tare?item.tare:'未称重'}}</view>
  43. </view>
  44. <view class="row3-item">
  45. <view class="left">毛</view>
  46. <view>{{item.grossWeight?item.grossWeight:'未称重'}}</view>
  47. </view>
  48. <view class="row3-item">
  49. <view class="left">净</view>
  50. <view>{{item.netWeight?item.netWeight:'未称重'}}</view>
  51. </view>
  52. </view>
  53. <view class="row4">
  54. <view v-if="getRoles('acquisitionWeightOut.weight')&&item.status!='已称毛重'" class="right"
  55. @click.stop="tareClick(item)">皮重</view>
  56. <view v-if="getRoles('acquisitionWeightOut.mao')&&!(item.paymentManagement&&item.paymentManagement.status=='已收款')||
  57. !(item.paymentManagement&&item.paymentManagement.status=='部分收款')
  58. " class="right" :class="item.status=='已质检'?'gray':''" @click.stop="grossWeightClick(item)">毛重</view>
  59. <view class="right" v-if='getRoles("acquisitionWeightOut.view")' @click.stop="delClick(item)">删除
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view v-show="isContent">
  65. <uni-load-more :status="loadStatus"></uni-load-more>
  66. </view>
  67. <u-toast ref="uToast" />
  68. <view class="footer">
  69. <view @click='add' class="button" v-if='getRoles("acquisitionWeightOut.new")'>新增</view>
  70. </view>
  71. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  72. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
  73. :showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. mapState
  79. } from 'vuex';
  80. import helper from '@/common/helper.js';
  81. export default {
  82. data() {
  83. return {
  84. isShowAlert: false,
  85. content: '登录信息过期需要重新登录,是否立即登录?',
  86. inputKeyword: '',
  87. warehouseName: '',
  88. isShowWarehouse: false,
  89. warehouseList: [],
  90. isContent: false,
  91. loadStatus: 'noMore',
  92. dataList: [],
  93. pageSize: 10,
  94. currentPage: 1,
  95. cangId: ''
  96. }
  97. },
  98. computed: {
  99. ...mapState(['hasLogin', 'userInfo'])
  100. },
  101. onShow() {
  102. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  103. if (res.data.data == "INVALID") {
  104. this.isShowAlert = true;
  105. // uni.showModal({
  106. // title: "提示",
  107. // content: "Session过期需要重新登录,是否立即登录",
  108. // showCancel: true,
  109. // confirmText: '登录',
  110. // success(e) {
  111. // if (e.confirm) {
  112. // uni.navigateTo({
  113. // url: '/pages/public/login'
  114. // })
  115. // }
  116. // }
  117. // })
  118. } else {
  119. this.compId = uni.getStorageSync('pcUserInfo').compId
  120. console.log("compId", this.compId)
  121. this.loadData()
  122. }
  123. })
  124. .catch(res => {
  125. if (res.message) {
  126. uni.showToast({
  127. title: res.message,
  128. icon: 'none',
  129. duration: 2000
  130. })
  131. }
  132. });
  133. },
  134. onPullDownRefresh() {
  135. this.currentPage = 1
  136. this.gridList = []
  137. this.getList()
  138. },
  139. onReachBottom() {
  140. this.currentPage += 1
  141. this.getList()
  142. // this.getMoreNews()
  143. },
  144. methods: {
  145. alertBtn() {
  146. uni.navigateTo({
  147. url: '/pages/public/login'
  148. })
  149. },
  150. cancelClick() {
  151. this.isShowAlert = false
  152. },
  153. //获取当前按钮权限
  154. getRoles: function(role) {
  155. let _roles = uni.getStorageSync('rolesList')
  156. for (let i = 0; i < _roles.length; i++) {
  157. if (_roles[i] == role) {
  158. return true
  159. }
  160. }
  161. return false
  162. },
  163. add() {
  164. console.log(this.warehouseName)
  165. uni.navigateTo({
  166. url: '/pages/erpbusiness/acquisitionInspection/add_check_the_weight?cangId=' + this.cangId +
  167. '&warehouseName=' + this.warehouseName
  168. })
  169. },
  170. loadData() {
  171. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelfApp', {
  172. compId: this.compId
  173. }).then(res => {
  174. console.log("warehouseBaseInfo", res)
  175. let _resData = res.data.data
  176. for (let i = 0; i < _resData.length; i++) {
  177. let _obj = {
  178. "label": _resData[i].warehouseName,
  179. "value": _resData[i].id,
  180. }
  181. this.warehouseList.push(_obj)
  182. }
  183. this.warehouseName = this.warehouseList[0].label
  184. this.cangId = this.warehouseList[0].value
  185. this.getList()
  186. })
  187. },
  188. //获取列表
  189. getList() {
  190. this.$api.doRequest('get', '/weighingManagement/selectWeighingManagement', {
  191. compId: '',
  192. currentPage: this.currentPage,
  193. pageSize: this.pageSize,
  194. searchKeyWord: this.inputKeyword,
  195. warehouseName: this.warehouseName,
  196. managementType: 3,
  197. }).then(res => {
  198. var data = res.data.data.records
  199. this.dataList = this.dataList.concat(data)
  200. console.log(res.data.data.records)
  201. if (res.data.data.records.length == 0) {
  202. this.isContent = true
  203. }
  204. // console.log("--------------------------------")
  205. // console.log("this.dataList",this.dataList)
  206. })
  207. },
  208. selectWarehouse() {
  209. this.isShowWarehouse = true
  210. },
  211. confirmWarehouse(e) {
  212. console.log(e)
  213. this.warehouseName = e[0].label
  214. this.cangId = e[0].value
  215. },
  216. //毛重
  217. grossWeightClick(item) {
  218. if (item.status == "已质检") return;
  219. console.log(item)
  220. uni.navigateTo({
  221. url: './grossWeightDetail1?id=' + item.id + '&cangId=' + this.cangId
  222. })
  223. },
  224. tareClick(item) {
  225. //
  226. uni.navigateTo({
  227. url: './tareDetail1?id=' + item.id + '&cangId=' + this.cangId
  228. })
  229. },
  230. delClick(val) {
  231. console.log(val)
  232. let that = this;
  233. uni.showModal({
  234. content: "确定删除检斤信息?",
  235. success: function(res) {
  236. if (res.confirm) {
  237. console.log(that.detailData)
  238. that.$api.doRequest('post', '/weighingManagement/api/deleteWeightcheck', {
  239. id: val.id
  240. }).then(res => {
  241. if (res.data.code == 200) {
  242. that.$refs.uToast.show({
  243. title: '删除成功',
  244. type: 'success',
  245. url: '/pages/erpbusiness/acquisitionInspection/warehouseWeighing'
  246. })
  247. } else {
  248. that.$refs.uToast.show({
  249. title: '删除失败',
  250. type: 'error',
  251. })
  252. }
  253. })
  254. } else if (res.cancel) {
  255. console.log('用户点击取消');
  256. }
  257. //
  258. }
  259. })
  260. },
  261. toDetail(item) {
  262. uni.navigateTo({
  263. url: './tareDetail2?id=' + item.id + '&cangId=' + this.cangId
  264. })
  265. }
  266. }
  267. }
  268. </script>
  269. <style scoped lang="scss">
  270. .top {
  271. background: white;
  272. padding: 20rpx;
  273. border-radius: 0 0 20rpx 40rpx;
  274. }
  275. .dropdown {
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. position: relative;
  280. margin: 20rpx 0;
  281. padding: 0 13rpx;
  282. .right,
  283. .left {
  284. display: flex;
  285. align-items: center;
  286. }
  287. }
  288. .item-style {
  289. background: white;
  290. margin: 20rpx;
  291. padding: 20rpx;
  292. .row1 {
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. .row1-left {
  297. display: flex;
  298. justify-content: flex-start;
  299. align-items: center;
  300. .left {
  301. margin-right: 20rpx;
  302. }
  303. .top-title {
  304. font-size: 32rpx;
  305. font-weight: 600;
  306. color: #333333;
  307. }
  308. .bottom {
  309. color: #878C9C;
  310. }
  311. .right {
  312. font-size: 28rpx;
  313. font-weight: 600;
  314. color: #333333;
  315. }
  316. }
  317. }
  318. .row2 {
  319. display: flex;
  320. background: #F9F9FA;
  321. border-radius: 10rpx;
  322. padding: 10rpx 0;
  323. justify-content: space-evenly;
  324. margin: 20rpx;
  325. color: #878C9C;
  326. }
  327. .row3 {
  328. display: flex;
  329. margin-top: 20rpx;
  330. .row3-item {
  331. display: flex;
  332. margin-right: 40rpx;
  333. .left {
  334. background: #22C572;
  335. border-radius: 10rpx;
  336. padding: 2rpx 10rpx;
  337. box-sizing: border-box;
  338. color: white;
  339. font-size: 12px;
  340. margin-right: 15rpx;
  341. }
  342. }
  343. }
  344. .row4 {
  345. margin-top: 10px;
  346. display: flex;
  347. justify-content: flex-end;
  348. .right {
  349. border: 1px solid #CDCDCD;
  350. border-radius: 45rpx;
  351. padding: 10rpx 30rpx;
  352. margin-left: 20rpx;
  353. }
  354. }
  355. }
  356. .status1,
  357. .status2,
  358. .status3 {
  359. padding: 8rpx 12rpx;
  360. border-radius: 50%;
  361. color: white;
  362. }
  363. .status1 {
  364. background: #FD714F;
  365. }
  366. .status2 {
  367. background: #22C572;
  368. }
  369. .status3 {
  370. background: #3296FA;
  371. }
  372. .gray {}
  373. .footer {
  374. background: #fff;
  375. position: fixed;
  376. bottom: 0;
  377. width: 100%;
  378. padding: 20px 10px;
  379. z-index: 10;
  380. .button {
  381. background: #22C572;
  382. width: 90%;
  383. margin: 0 auto;
  384. padding: 10px;
  385. color: #fff;
  386. text-align: center;
  387. border-radius: 30px;
  388. }
  389. }
  390. </style>