hold.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-luohu" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">委托暂存</block>
  6. </cu-custom>
  7. <block v-if="list.length > 0">
  8. <view class="list" v-for="(item,index) in list" :key="index">
  9. <uni-section :title="item.wei_tuo_dan_hao_" type="line" padding>
  10. <view class="content">
  11. <text>暂存类型:{{item.bao_cun_biao_ti_}}</text>
  12. <text></text>
  13. </view>
  14. <view class="content">
  15. <text>暂存时间:{{item.bian_zhi_shi_jian}}</text>
  16. <text></text>
  17. </view>
  18. <view class="btn">
  19. <view>
  20. <u-button type="primary" size="mini" @click="goClick(item.id_)"
  21. class="u-m-r-20 btn-back-color">继续编制
  22. </u-button>
  23. <u-button type="error" size="mini" @click="repulse(item.id_)">
  24. 删除暂存
  25. </u-button>
  26. </view>
  27. </view>
  28. </uni-section>
  29. </view>
  30. </block>
  31. <block v-else></block>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. ACCESS_TOKEN,
  37. USER_NAME,
  38. USER_INFO
  39. } from "@/common/util/constants" // 拉取登录token,userName,userInfo
  40. export default {
  41. data() {
  42. return {
  43. current: 0,
  44. list: [],
  45. ReachBottomShow: true
  46. }
  47. },
  48. // 下拉刷新
  49. onPullDownRefresh() {
  50. this.getInit()
  51. },
  52. // 上拉加载
  53. onReachBottom() {
  54. let _self = this
  55. uni.showNavigationBarLoading()
  56. if (this.ReachBottomShow) {
  57. this.getData()
  58. }
  59. },
  60. onShow() {
  61. this.getInit()
  62. },
  63. methods: {
  64. getInit() {
  65. this.current = 0
  66. this.list = []
  67. this.getData()
  68. },
  69. //获取暂存列表
  70. getData() {
  71. uni.showLoading({
  72. mask: true,
  73. title: 'loading'
  74. });
  75. let info = uni.getStorageSync(USER_INFO);
  76. let useId = info.user.id
  77. var page = 0
  78. if (this.current == 0) {
  79. page = 0
  80. } else {
  81. page = this.current * 10
  82. }
  83. let sql =
  84. `select id_,bian_zhi_shi_jian,wei_tuo_dan_hao_,bao_cun_biao_ti_ from t_mjsjdzcb where dui_ying_shu_ju_b = 't_lhwtsqb' and bian_zhi_ren_ = '${useId}' and create_time_ > DATE_SUB(NOW(),INTERVAL 3 MONTH) order by create_time_ desc LIMIT ${page},10`
  85. let requestData = this.$sig(sql)
  86. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  87. if (res.data.state == 200) {
  88. const data = res.data.variables.data
  89. this.list.push(...data)
  90. uni.stopPullDownRefresh();
  91. if (data.length > 10) {
  92. this.ReachBottomShow = false
  93. }
  94. if (data.length != 0) {
  95. this.current++
  96. }
  97. uni.hideLoading()
  98. }
  99. })
  100. },
  101. //删除接口
  102. repulse(id) {
  103. let that = this
  104. uni.showModal({
  105. title: '提示',
  106. content: '是否删除该条暂存数据,删除后,将无法恢复?',
  107. success: function(res) {
  108. if (res.confirm) {
  109. let params = {}
  110. params['tableName'] = 't_mjsjdzcb'
  111. params['paramWhere'] = "{id_:'" + id + "'}"
  112. let requestData = that.$sig(params)
  113. that.$http.post("/ibps/business/v3/sys/universal/batchDelete", requestData).then(
  114. res => {
  115. if (res.data.state == 200) {
  116. uni.showToast({
  117. title: '删除成功',
  118. icon: 'none',
  119. duration: 2000
  120. })
  121. that.getInit()
  122. }
  123. })
  124. } else if (res.cancel) {
  125. }
  126. }
  127. })
  128. },
  129. //跳转到委托单添加页面
  130. goClick(id) {
  131. uni.navigateTo({ // 跳转页面
  132. url: '/pages/jiance/order?saveId=' + id
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .list {
  140. padding: 0 20rpx;
  141. .content {
  142. line-height: 45rpx;
  143. }
  144. .btn {
  145. display: flex;
  146. justify-content: flex-end;
  147. }
  148. }
  149. </style>