agentCargoOwner.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
  3. <view class="good-list content">
  4. <view class="good-li" v-for="(good,index) in goods" :key="index">
  5. <view class="row flex">
  6. <image :src="good.avatarUrl" mode="" class="avatar-img"></image>
  7. <view class="content-text">
  8. <view class="left flex">
  9. <view class="name">{{good.name}}</view>
  10. <view class="phone">{{good.phone}}</view>
  11. </view>
  12. <view class="company">{{good.company}}</view>
  13. </view>
  14. <view class="right-status number-color" v-if="good.status=='待审核'">{{good.status}}</view>
  15. <view class="right-status wtg-color" v-if="good.status=='已驳回'">{{good.status}}</view>
  16. <view class="right-status wtg-color" v-if="good.status=='平台已驳回'">{{good.status}}</view>
  17. <view class="right-status wtg-color" v-if="good.status=='已撤销授权'">{{good.status}}</view>
  18. <view class="right-status ygq-color" v-if="good.status=='代理终止'">{{good.status}}</view>
  19. <view class="right-status ytg-color" v-if="good.status=='已授权'">{{good.status}}</view>
  20. </view>
  21. <view class="row flex sqs flex-space-between" @click="previewImage(good)">
  22. <view class="right">授权书</view>
  23. <u-icon name="attach" color="#2979ff" size="24"></u-icon>
  24. </view>
  25. <view class="row flex flex-end row-btn">
  26. <view class="btn sq-btn" @click="configAuthorize(good,1)" v-if="good.status=='待审核'">授权</view>
  27. <view class="btn bh-btn" @click="configAuthorize(good,2)" v-if="good.status=='待审核'">驳回</view>
  28. <view class="btn sc-btn" @click="del(good)"
  29. v-if="good.status=='已驳回'||good.status=='已撤销授权'||good.status=='代理终止'">删除</view>
  30. <view class="btn cxsq-btn" @click="configAuthorize(good,3)" v-if="good.status=='已授权'">撤销授权</view>
  31. </view>
  32. </view>
  33. </view>
  34. <u-toast ref="uToast"></u-toast>
  35. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  36. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  37. @cancel="cancelClick"></u-modal>
  38. </mescroll-body>
  39. </template>
  40. <script>
  41. var that;
  42. import {
  43. mapState
  44. } from 'vuex';
  45. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  46. import {
  47. apiGoods
  48. } from "@/api/mock.js"
  49. export default {
  50. mixins: [MescrollMixin], // 使用mixin
  51. data() {
  52. return {
  53. isShowAlert: false,
  54. alertTitle: '',
  55. alertContent: '',
  56. goods: [], // 数据列表,
  57. type: '',
  58. selectVal: null
  59. }
  60. },
  61. computed: {
  62. ...mapState(['hasLogin', 'userInfo'])
  63. },
  64. onLoad() {
  65. that = this
  66. },
  67. methods: {
  68. previewImage(good){
  69. uni.previewImage({
  70. urls: [good.certificateAddressUrl],
  71. longPressActions: {
  72. // itemList: ['发送给朋友', '保存图片', '收藏'],
  73. success: function(data) {
  74. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  75. },
  76. fail: function(err) {
  77. console.log(err.errMsg);
  78. }
  79. }
  80. });
  81. },
  82. confirmClick() {
  83. if (this.type == 4) {
  84. this.$request.baseRequest('post', '/agentCargoOwnerInfo/api/deleteAgentCargoOwner', {
  85. id: this.selectVal.id,
  86. }).then(res => {
  87. this.isShowAlert = false
  88. that.$refs.uToast.show({
  89. type: 'success',
  90. message: "刪除成功!",
  91. complete() {
  92. that.mescroll.resetUpScroll()
  93. }
  94. })
  95. })
  96. .catch(res => {
  97. uni.hideLoading()
  98. uni.showToast({
  99. title: res.message,
  100. icon: 'none',
  101. duration: 2000
  102. })
  103. this.mescroll.endErr();
  104. });
  105. } else {
  106. this.$request.baseRequest('post', '/agentCargoOwnerInfo/api/editAgentCargoOwner', {
  107. id: this.selectVal.id,
  108. grantFlag: this.type,
  109. }).then(res => {
  110. if (res.code == 200) {
  111. this.isShowAlert = false
  112. that.$refs.uToast.show({
  113. type: 'success',
  114. message: "操作成功!",
  115. complete() {
  116. that.mescroll.resetUpScroll()
  117. }
  118. })
  119. }
  120. })
  121. .catch(res => {
  122. uni.hideLoading()
  123. uni.showToast({
  124. title: res.message,
  125. icon: 'none',
  126. duration: 2000
  127. })
  128. this.mescroll.endErr();
  129. });
  130. }
  131. },
  132. cancelClick() {
  133. this.isShowAlert = false
  134. },
  135. mescrollInit(mescroll) {
  136. this.mescroll = mescroll;
  137. },
  138. configAuthorize(val, type) {
  139. this.type = type
  140. this.selectVal = val
  141. if (type == 1) {
  142. this.alertTitle = '确定授权?'
  143. } else if (type == 2) {
  144. this.alertTitle = '确定驳回?'
  145. } else {
  146. this.alertTitle = '确定撤销授权?'
  147. }
  148. this.isShowAlert = true
  149. },
  150. del(val) {
  151. this.alertTitle = '确定删除?'
  152. this.selectVal = val
  153. this.type = 4
  154. this.isShowAlert = true
  155. },
  156. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  157. upCallback(page) {
  158. this.$request.baseRequest('get', '/agentCargoOwnerInfo/selectAgentCargoOwner', {
  159. commonId: this.userInfo.id,
  160. pageSize: page.size,
  161. currentPage: page.num,
  162. }).then(res => {
  163. debugger
  164. this.mescroll.endBySize(res.data.records.length, res.data.total);
  165. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  166. this.goods = this.goods.concat(res.data.records); //追加新数据
  167. })
  168. .catch(res => {
  169. uni.hideLoading()
  170. uni.showToast({
  171. title: res.message,
  172. icon: 'none',
  173. duration: 2000
  174. })
  175. this.mescroll.endErr();
  176. });
  177. }
  178. }
  179. }
  180. </script>
  181. <style scoped lang="scss">
  182. .good-li {
  183. background: white;
  184. margin: 20rpx;
  185. border-radius: 15rpx;
  186. padding: 40rpx;
  187. position: relative;
  188. .row {
  189. align-items: center;
  190. }
  191. }
  192. .avatar-img {
  193. width: 104rpx;
  194. height: 104rpx;
  195. }
  196. .right-status {
  197. position: absolute;
  198. top: 20rpx;
  199. right: 20rpx;
  200. }
  201. .content-text {
  202. margin-left: 30rpx;
  203. .name {
  204. font-size: 36rpx;
  205. font-weight: 700;
  206. color: #333333;
  207. margin-right: 20rpx;
  208. }
  209. .company {
  210. color: #333333;
  211. }
  212. .left {
  213. align-items: baseline;
  214. .phone {
  215. font-size: 28rpx;
  216. }
  217. }
  218. }
  219. .sqs {
  220. background: #F3F8FF;
  221. margin-top: 40rpx;
  222. color: #2772FB;
  223. padding: 20rpx;
  224. border-radius: 15rpx;
  225. }
  226. .row-btn {
  227. margin-top: 40rpx;
  228. }
  229. .sq-btn {
  230. background: #2772FB;
  231. font-size: 28rpx;
  232. color: #FFFFFF;
  233. padding: 10rpx 20rpx;
  234. border-radius: 50rpx;
  235. margin-right: 20rpx;
  236. }
  237. .bh-btn,
  238. .sc-btn,
  239. .cxsq-btn {
  240. background: #F8F8F8;
  241. font-size: 28rpx;
  242. color: #333333;
  243. padding: 10rpx 20rpx;
  244. border-radius: 50rpx;
  245. }
  246. </style>