agentCargoOwner.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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='#F5BA3C' @confirm="$u.throttle(confirmClick(), 1000)" @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.certificateAddressUrlArray,
  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. var obj={}
  164. for (var i = 0; i < res.data.records.length; i++) {
  165. // obj[i]=[]
  166. // console.log(obj[i])
  167. res.data.records[i].certificateAddressUrlArray=[]
  168. if(res.data.records[i].certificateAddressUrl){
  169. var data=res.data.records[i].certificateAddressUrl.split(',')
  170. for (var q = 0; q < data.length; q++) {
  171. if(data[q]!=''){
  172. res.data.records[i].certificateAddressUrlArray.push(data[q])
  173. }
  174. }
  175. // res.data.records[i].certificateAddressUrlArray=obj[i]
  176. }
  177. }
  178. this.mescroll.endBySize(res.data.records.length, res.data.total);
  179. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  180. this.goods = this.goods.concat(res.data.records); //追加新数据
  181. })
  182. .catch(res => {
  183. uni.hideLoading()
  184. uni.showToast({
  185. title: res.message,
  186. icon: 'none',
  187. duration: 2000
  188. })
  189. this.mescroll.endErr();
  190. });
  191. }
  192. }
  193. }
  194. </script>
  195. <style scoped lang="scss">
  196. .good-li {
  197. background: white;
  198. margin: 20rpx;
  199. border-radius: 15rpx;
  200. padding: 40rpx;
  201. position: relative;
  202. .row {
  203. align-items: center;
  204. }
  205. }
  206. .avatar-img {
  207. width: 104rpx;
  208. height: 104rpx;
  209. }
  210. .right-status {
  211. position: absolute;
  212. top: 20rpx;
  213. right: 20rpx;
  214. }
  215. .content-text {
  216. margin-left: 30rpx;
  217. .name {
  218. font-size: 36rpx;
  219. font-weight: 700;
  220. color: #333333;
  221. margin-right: 20rpx;
  222. }
  223. .company {
  224. color: #333333;
  225. }
  226. .left {
  227. align-items: baseline;
  228. .phone {
  229. font-size: 28rpx;
  230. }
  231. }
  232. }
  233. .sqs {
  234. background: #F3F8FF;
  235. margin-top: 40rpx;
  236. color: #F5BA3C;
  237. padding: 20rpx;
  238. border-radius: 15rpx;
  239. }
  240. .row-btn {
  241. margin-top: 40rpx;
  242. }
  243. .sq-btn {
  244. background: #F5BA3C;
  245. font-size: 28rpx;
  246. color: #FFFFFF;
  247. padding: 10rpx 20rpx;
  248. border-radius: 50rpx;
  249. margin-right: 20rpx;
  250. }
  251. .bh-btn,
  252. .sc-btn,
  253. .cxsq-btn {
  254. background: #F8F8F8;
  255. font-size: 28rpx;
  256. color: #333333;
  257. padding: 10rpx 20rpx;
  258. border-radius: 50rpx;
  259. }
  260. </style>