grainDeliveryRecord.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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>25日0时前有效</view>
  7. </view>
  8. <view>{{item.name}}</view>
  9. <view class="car-list">
  10. <view v-for="(item1,index) in item.carList">
  11. {{item1.carNumber}}
  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. warehouseName:"鲅鱼圈1号库",
  42. id:1,
  43. name:'张三',
  44. carList:[{carNumber:'123123'},{carNumber:'123123'},{carNumber:'123123'}
  45. ]
  46. },
  47. {
  48. warehouseName:"鲅鱼圈2号库",
  49. id:2,
  50. name:'张三1',
  51. carList:[{carNumber:'123123'},{carNumber:'123123'},{carNumber:'123123'}
  52. ]
  53. }
  54. ]
  55. }
  56. },
  57. onLoad() {
  58. },
  59. // #ifndef MP
  60. onNavigationBarButtonTap(e) {
  61. const index = e.index;
  62. if (index === 0) {
  63. this.navTo('/pages/set/set');
  64. } else if (index === 1) {
  65. // #ifdef APP-PLUS
  66. const pages = getCurrentPages();
  67. const page = pages[pages.length - 1];
  68. const currentWebview = page.$getAppWebview();
  69. currentWebview.hideTitleNViewButtonRedDot({
  70. index
  71. });
  72. // #endif
  73. uni.navigateTo({
  74. url: '/pages/notice/notice'
  75. })
  76. }
  77. },
  78. // #endif
  79. computed: {
  80. ...mapState(['hasLogin', 'userInfo']),
  81. },
  82. onShow() {
  83. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  84. console.log("checkSession", res)
  85. if (res.data.data == "INVALID") {
  86. this.isShowAlert = true;
  87. }
  88. let _obj = {
  89. commonId:uni.getStorageSync("userInfo").id,
  90. pageSize:1,
  91. currentPage:10
  92. }
  93. this.$api.doRequest('get', '/grainDeliveryRegistration/selectGrainDeliveryRegistration',_obj ).then(res => {
  94. if (res.data.code == 200) {
  95. }
  96. })
  97. })
  98. console.log("hasLogin", this.hasLogin)
  99. },
  100. methods: {
  101. del(row){
  102. this.isShowAlert1=true
  103. this.id = row.id
  104. // 删除成功后删除页面当前行
  105. },
  106. navTo(url) {
  107. if (!this.hasLogin) {
  108. url = '/pages/public/login';
  109. }
  110. uni.navigateTo({
  111. url
  112. })
  113. },
  114. alertBtn() {debugger
  115. this.$api.doRequest('post', '//grainDeliveryRegistration/api/deleteInfo',{
  116. id:this.id
  117. }).then(res => {
  118. if (res.data.code == 200) {
  119. for(let i=0;i<this.dataList.length;i++){
  120. if(this.id==this.dataList[i].id){
  121. this.dataList.splice(i,1)
  122. }
  123. }
  124. }
  125. })
  126. },
  127. cancelClick() {
  128. this.isShowAlert = false
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang='scss' scoped>
  134. page {
  135. background: #F5F6FA;
  136. }
  137. .wrap {
  138. background: #fff;
  139. margin: 10px;
  140. border-radius: 10px;
  141. padding: 10px;
  142. }
  143. .top{
  144. display: flex;
  145. justify-content: space-between;
  146. }
  147. </style>