grainDeliveryRecord.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="wrap">
  3. <view class="content content1" v-for="(item,index) in dataList" :key="index">
  4. <view class="top">
  5. <view>{{item.warehouseName}}</view>
  6. <view>{{item.validityDate}}前有效</view>
  7. </view>
  8. <view>{{item.shipperName}}({{item.carList.length}}车)</view>
  9. <view class="car-list">
  10. <view v-for="(item1,index) in item.carList">
  11. {{item1}}
  12. </view>
  13. </view>
  14. <u-button @click='del(item)'>删除</u-button>
  15. </view>
  16. <u-modal v-model="isShowAlert1" :title-style="{fontSize: '18px',fontWeight:'500'}"
  17. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
  18. showCancelButton='false' :content="content1" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  19. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  20. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
  21. showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. mapState
  27. } from 'vuex';
  28. export default {
  29. components: {
  30. },
  31. data() {
  32. return {
  33. id:'',
  34. warehouseName:'',
  35. isShowAlert: false,
  36. isShowAlert1:false,
  37. content: '当前登入信息验证失败,是否重新登录?',
  38. content1: '确定删除送粮记录?',
  39. dataList:[]
  40. }
  41. },
  42. onLoad() {
  43. },
  44. // #ifndef MP
  45. onNavigationBarButtonTap(e) {
  46. const index = e.index;
  47. if (index === 0) {
  48. this.navTo('/pages/set/set');
  49. } else if (index === 1) {
  50. // #ifdef APP-PLUS
  51. const pages = getCurrentPages();
  52. const page = pages[pages.length - 1];
  53. const currentWebview = page.$getAppWebview();
  54. currentWebview.hideTitleNViewButtonRedDot({
  55. index
  56. });
  57. // #endif
  58. uni.navigateTo({
  59. url: '/pages/notice/notice'
  60. })
  61. }
  62. },
  63. // #endif
  64. computed: {
  65. ...mapState(['hasLogin', 'userInfo']),
  66. },
  67. onShow() {
  68. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  69. console.log("checkSession", res)
  70. if (res.data.data == "INVALID") {
  71. this.isShowAlert = true;
  72. }
  73. let _obj = {
  74. commonId:uni.getStorageSync("userInfo").id,
  75. pageSize:10,
  76. currentPage:1
  77. }
  78. this.$api.doRequest('get', '/grainDeliveryRegistration/selectGrainDeliveryRegistration',_obj ).then(res => {
  79. if (res.data.code == 200) {
  80. this.dataList = []
  81. debugger
  82. for(let i = 0;i<res.data.data.records.length;i++){
  83. let _data = res.data.data.records[i];
  84. let _carNumberList = _data.carNo.split(',')
  85. let __obj = {
  86. warehouseName:_data.warehouseName,
  87. id:_data.id,
  88. shipperName:_data.shipperName,
  89. carList:_carNumberList,
  90. validityDate:_data.validityDate
  91. }
  92. this.dataList.push(__obj)
  93. }
  94. }
  95. })
  96. })
  97. console.log("hasLogin", this.hasLogin)
  98. },
  99. methods: {
  100. del(row){
  101. this.isShowAlert1=true
  102. this.id = row.id
  103. // 删除成功后删除页面当前行
  104. },
  105. navTo(url) {
  106. if (!this.hasLogin) {
  107. url = '/pages/public/login';
  108. }
  109. uni.navigateTo({
  110. url
  111. })
  112. },
  113. alertBtn() {debugger
  114. this.$api.doRequest('post', '/grainDeliveryRegistration/api/deleteInfo',{
  115. id:this.id
  116. }).then(res => {
  117. if (res.data.code == 200) {
  118. for(let i=0;i<this.dataList.length;i++){
  119. if(this.id==this.dataList[i].id){
  120. this.dataList.splice(i,1)
  121. }
  122. }
  123. }
  124. })
  125. },
  126. cancelClick() {
  127. this.isShowAlert = false
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang='scss' scoped>
  133. page {
  134. background: #F5F6FA;
  135. }
  136. .wrap {
  137. background: #fff;
  138. margin: 10px;
  139. border-radius: 10px;
  140. padding: 10px;
  141. }
  142. .top{
  143. display: flex;
  144. justify-content: space-between;
  145. }
  146. </style>