sm.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view class="content">
  3. <u-toast ref="uToast" />
  4. <u-popup v-model="show" class="popup" @close="close" mode="bottom" border-radius="30" :closeable="true">
  5. <view class="top">
  6. <view class="top-center-1">收到</view>
  7. </view>
  8. <view class="top-content-2">
  9. <view>来自</view>
  10. <view class="top-content-green">{{user.title}}</view>
  11. <view>的邀请。</view>
  12. </view>
  13. <view class="top-content-3">
  14. 接受邀请后对方将可以查看您的个人粮商信息(姓名、手机号、账户信息和身份证附件等)。
  15. </view>
  16. <div class="content-bottom">
  17. <view v-if="grainMerchantList.length>0" class="title">请选择粮商身份</view>
  18. <view v-if="grainMerchantList.length>0">
  19. <view v-for="(item,index) in grainMerchantList" :key="index">
  20. <view v-if="item.cover!=1" :class="item.check?'item-select':'item'" @click="selectItem(item)">
  21. <image v-if="item.check" class="img" :src="img1" alt=""></image>
  22. <view class="name">{{item.customerName}}</view>
  23. <view class="phone">
  24. <view class="number">{{item.customerPhone}}</view>
  25. <view>({{item.authenticationStatus}})</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="nolist" v-if="grainMerchantList.length==0">
  31. <image class="img" :src="img2" alt=""></image>
  32. <view class="text">您还未认证个人粮商身份</view>
  33. </view>
  34. <button v-if="grainMerchantList.length>0" :class="flag?'':'custom-style'" @click="submit">{{btnVal}}</button>
  35. <button v-if="grainMerchantList.length==0" class="custom-style" @click="toGrainMerchantCertification()">接受并去认证</button>
  36. </div>
  37. </u-popup>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. mapState
  43. } from 'vuex';
  44. export default {
  45. data() {
  46. return {
  47. img1:require("../../../static/img/select.png"),
  48. img2:require("../../../static/img/nolist.png"),
  49. show: true,
  50. identityAuthenticationInfo: {},
  51. grainMerchantList: [],
  52. selectID: "",
  53. btnVal: "接受邀请",
  54. user: {
  55. title: '',
  56. companyId: ''
  57. },
  58. isAllselect:false,
  59. flag : true
  60. }
  61. },
  62. computed: {
  63. ...mapState(['hasLogin', 'userInfo'])
  64. },
  65. onLoad(options) {
  66. //#ifdef APP-PLUS
  67. this.user.title = options.data.split(',')[2]
  68. this.user.companyId = options.data.split(',')[1]
  69. //#endif
  70. console.log("options:",options,this.user.title,this.user.companyId)
  71. },
  72. onShow() {
  73. this.getList()
  74. },
  75. methods: {
  76. selectItem(item) {
  77. console.log("item", item)
  78. if(item.authenticationStatus=="已接受") return
  79. for (let i = 0; i < this.grainMerchantList.length; i++) {
  80. if (this.grainMerchantList[i].id == item.id) {
  81. this.grainMerchantList[i].check = !this.grainMerchantList[i].check
  82. if (this.grainMerchantList[i].check) {
  83. this.selectID = this.grainMerchantList[i].id
  84. }
  85. }
  86. }
  87. },
  88. //查询粮商身份
  89. selectGrainMerchantList() {
  90. //
  91. },
  92. //粮商认证
  93. toGrainMerchantCertification(){
  94. uni.navigateTo({
  95. url:'/pageD/identity/companyIdentity?status=1'
  96. })
  97. },
  98. getList() {
  99. console.log(this.userInfo)
  100. this.identityAuthenticationInfo.commonId = this.userInfo.id
  101. this.grainMerchantList = []
  102. this.$api.doRequest('get', '/identityAuthenticationInfo/selectIdentityAuthenticationInfo', {
  103. pageSize: 100,
  104. currentPage: 1,
  105. commonId: this.userInfo.id,
  106. compId:this.user.companyId,
  107. flag: 3
  108. }, 'application/json;charset=UTF-8').then(res => {
  109. for (var i = 0; i < res.data.data.records.length; i++) {
  110. res.data.data.records[i].basis = "false"
  111. if (res.data.data.records[i].defaultFlag == 1) {
  112. res.data.data.records[i].basis = "true"
  113. }
  114. }
  115. var data = res.data.data.records
  116. for (var i = 0; i < data.length; i++) {
  117. if(data[i].authenticationStatus == "未通过")
  118. {
  119. continue
  120. }
  121. if (data[i].customerTypeFlag == 2) {
  122. if (data[i].compName && data[i].compName.length > 10) {
  123. data[i].compName = data[i].compName.substring(0, 10) + "..."
  124. }
  125. }
  126. if (data[i].authenticationStatus == "已接受") {
  127. data[i].check = true
  128. this.isAllselect = true
  129. } else {
  130. data[i].check = false
  131. this.isAllselect = false
  132. this.flag = false
  133. }
  134. this.grainMerchantList.push(data[i])
  135. }
  136. if(this.flag){
  137. this.btnVal = "已接受"
  138. }
  139. console.log("grainMerchantList",this.grainMerchantList)
  140. })
  141. .catch(res => {
  142. if (res.message) {
  143. uni.showToast({
  144. title: res.message,
  145. icon: 'none',
  146. duration: 2000
  147. })
  148. } else {
  149. uni.showToast({
  150. title: "系统异常,请联系管理员",
  151. icon: 'none',
  152. duration: 2000
  153. })
  154. }
  155. });
  156. },
  157. submit() {
  158. if(this.flag) return
  159. let _isAllCheck = false
  160. for (let i = 0; i < this.grainMerchantList.length; i++) {
  161. if (this.grainMerchantList[i].check) {
  162. _isAllCheck = true
  163. }
  164. }
  165. if (!_isAllCheck) {
  166. this.$refs.uToast.show({
  167. title: '至少选择一个身份',
  168. type: "error",
  169. icon: false
  170. })
  171. }
  172. console.log("this.user.compId",this.user.companyId,this.selectID)
  173. this.$api.doRequest('get', '/identityAuthenticationInfo/saveCompanyIdentity', {
  174. id: this.selectID,
  175. compId:this.user.companyId,
  176. }, 'application/json;charset=UTF-8').then(res => {
  177. console.log(res);
  178. if (res.data.code == 200) {
  179. // this.getList()
  180. uni.navigateBack(-1)
  181. }
  182. })
  183. .catch(res => {
  184. if (res.message) {
  185. uni.showToast({
  186. title: res.message,
  187. icon: 'none',
  188. duration: 2000
  189. })
  190. } else {
  191. uni.showToast({
  192. title: "接受邀请失败,请稍后再试。",
  193. icon: 'none',
  194. duration: 2000
  195. })
  196. }
  197. });
  198. },
  199. close() {
  200. uni.navigateBack(-1)
  201. }
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .content {
  207. background: white;
  208. }
  209. .top {
  210. background: url(../../../static/img/bg@2x.png);
  211. background-size: 100% 100%;
  212. padding: 0 80rpx 0 80rpx;
  213. text-align: center;
  214. height: 310rpx;
  215. }
  216. .content-bottom {
  217. padding: 50rpx 50rpx 50rpx 50rpx;
  218. .title {
  219. font-size: 32rpx;
  220. font-weight: 600;
  221. color: #333333;
  222. text-align: center;
  223. margin-bottom: 30rpx;
  224. }
  225. .active {}
  226. .item-select {
  227. border-radius: 1px;
  228. border: 1px solid #C5CAD5;
  229. padding: 15rpx 40rpx;
  230. background: #F4FAF4;
  231. border: 1px solid #22C572;
  232. margin-bottom: 20rpx;
  233. position: relative;
  234. .img {
  235. position: absolute;
  236. width: 42rpx;
  237. height: 40rpx;
  238. top: 0;
  239. right: 0;
  240. }
  241. .name {
  242. font-size: 32rpx;
  243. font-weight: 600;
  244. color: #22C572;
  245. }
  246. .phone {
  247. display: flex;
  248. align-items: center;
  249. color: #8E93A3;
  250. .number {
  251. margin-right: 20rpx;
  252. }
  253. }
  254. }
  255. .item {
  256. border-radius: 1px;
  257. border: 1px solid #C5CAD5;
  258. padding: 15rpx 40rpx;
  259. margin-bottom: 20rpx;
  260. position: relative;
  261. .img {
  262. position: absolute;
  263. width: 42rpx;
  264. height: 40rpx;
  265. top: 0;
  266. right: 0;
  267. }
  268. .name {
  269. font-size: 32rpx;
  270. font-weight: 600;
  271. }
  272. .phone {
  273. display: flex;
  274. align-items: center;
  275. color: #8E93A3;
  276. .number {
  277. margin-right: 20rpx;
  278. }
  279. }
  280. }
  281. }
  282. .top-center-1 {
  283. font-size: 42rpx;
  284. font-weight: 600;
  285. color: #333333;
  286. position: relative;
  287. top: 88rpx;
  288. }
  289. .top-content-2 {
  290. display: flex;
  291. justify-content: center;
  292. align-items: flex-end;
  293. position: relative;
  294. top: -50px;
  295. }
  296. .top-content-3 {
  297. position: relative;
  298. top: -25px;
  299. padding: 0 81rpx;
  300. }
  301. .top-content-green {
  302. color: #22C572;
  303. font-size: 32rpx;
  304. }
  305. .custom-style {
  306. background: #22C572;
  307. border-radius: 46px;
  308. margin: 50rpx;
  309. color: white;
  310. }
  311. .nolist {
  312. text-align: center;
  313. margin: 50rpx 50rpx 100rpx 50rpx;
  314. .img {
  315. width: 240rpx;
  316. height: 240rpx;
  317. }
  318. .text {
  319. margin: 20rpx;
  320. color: #8E93A3;
  321. }
  322. }
  323. </style>