sm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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'"
  35. @click="submit">{{btnVal}}</button>
  36. <button v-if="grainMerchantList.length==0" class="custom-style"
  37. @click="toGrainMerchantCertification()">接受并去认证</button>
  38. </div>
  39. </u-popup>
  40. <u-toast ref="warning" />
  41. <u-popup v-model="show1" class="popup" @close="close" mode="bottom" border-radius="30" :closeable="true">
  42. <view class="buns_item">
  43. <view class="but_css" @click="skip(1)" v-if="getRoles('acquisitionQuality.initial') && status == '已初检'">
  44. 去初检
  45. </view>
  46. <view class="but_css" @click="skip(2)"
  47. v-if="getRoles('acquisitionQuality.again') && !payStatus && (status == '已初检'|| status == '已复检')">去复检</view>
  48. <view class="but_css" @click="skip(3)"
  49. v-if="getRoles('acquisitionWeight.mao') && weightStatus != '已称皮重' && (weightStatus == '已质检'|| weightStatus == '已称毛重')">
  50. 去称毛重</view>
  51. <view class="but_css" @click="skip(4)"
  52. v-if="getRoles('acquisitionWeight.weight') && !payStatus && (weightStatus == '已称毛重' || weightStatus == '已称皮重')">
  53. 去称皮重
  54. </view>
  55. <view class="but_css" @click="skip(5)"
  56. v-if="getRoles('acquisitionQuality.con') && confirm != '1' && status == '已复检'">
  57. 去确认质检
  58. </view>
  59. <view class="but_css" @click="close">返回</view>
  60. </view>
  61. </u-popup>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapState
  67. } from 'vuex';
  68. export default {
  69. data() {
  70. return {
  71. img1: require("../../../static/img/select.png"),
  72. img2: require("../../../static/img/nolist.png"),
  73. show: false,
  74. show1: true,
  75. identityAuthenticationInfo: {},
  76. grainMerchantList: [],
  77. selectID: "",
  78. btnVal: "接受邀请",
  79. user: {
  80. title: '',
  81. companyId: ''
  82. },
  83. isAllselect: false,
  84. flag: true,
  85. cangid: "", //仓库id
  86. managementType: 1,
  87. warehouseName: "", //仓库名
  88. status: "", //质检状态
  89. weightStatus: "", //检斤状态
  90. qualityNo: "",
  91. confirm: "", //确认初检确认状态
  92. payStatus:"",//结算状态
  93. detailData: {},
  94. userName: "", //仓库负责人
  95. companyId: "",
  96. decide: false
  97. }
  98. },
  99. computed: {
  100. ...mapState(['hasLogin', 'userInfo'])
  101. },
  102. onLoad(options) {
  103. let _list = [];
  104. if(options.data){
  105. for (var p1 in options) {
  106. if (options.hasOwnProperty(p1)){
  107. _list.push(p1);
  108. }
  109. }
  110. }
  111. //#ifdef APP-PLUS
  112. this.user.title = options.data.split(',')[2]
  113. this.user.companyId = options.data.split(',')[1]
  114. this.compId = options.data
  115. this.qualityNo = _list[1]
  116. this.cangid = _list[2]
  117. //#endif
  118. },
  119. onShow() {
  120. // this.compId = "2710b21efc1e4393930c5dc800010dc4"
  121. // this.qualityNo = "SGRK202112200080001"
  122. // this.cangid = "715d87adeea548cc9a70d03f72952816"
  123. console.log("查看",this.qualityNo,this.compId,this.cangid)
  124. if (this.cangid) { //判断是在哪扫码进入的
  125. if(this.compId.indexOf(",") != -1){
  126. this.compId = this.compId.split(",")[1]
  127. }
  128. this.show = false
  129. this.show1 = true
  130. this.companyId = uni.getStorageSync('pcUserInfo').compId
  131. this.userName = uni.getStorageSync('userInfo').userName.split("-")[1]
  132. if (this.companyId == this.compId) {
  133. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  134. id: this.cangid
  135. }).then(res => {
  136. let cangList = res.data.data
  137. let person = cangList.otherPersonCharge.split(",")
  138. person.push(cangList.personCharge)
  139. for (let i = 0; i < person.length; i++) {
  140. if (person[i].indexOf(uni.getStorageSync('userInfo').userName.split("-")[1]) != -1) {
  141. this.decide = true
  142. this.getShow()
  143. return
  144. }
  145. }
  146. if (!this.decide) {
  147. this.$refs.warning.show({
  148. title: '当前身份不可操作',
  149. type: "error",
  150. icon: false
  151. })
  152. }
  153. }).catch(res => {});
  154. }else{
  155. this.$api.msg('当前身份不可操作!')
  156. }
  157. } else {//邀请客户
  158. this.show = true
  159. this.show1 = false
  160. this.getList()
  161. }
  162. // this.getShow()
  163. },
  164. methods: {
  165. //查看权限
  166. getRoles: function(role) {
  167. let _roles = uni.getStorageSync('rolesList')
  168. for (let i = 0; i < _roles.length; i++) {
  169. if (_roles[i] == role) {
  170. return true
  171. }
  172. }
  173. return false
  174. },
  175. getShow() {
  176. let tmp = {
  177. compId: this.compId,
  178. number: this.qualityNo,
  179. warehouseId: this.cangid
  180. }
  181. this.$api.doRequest('get', '/weighingManagement/getQRcode', tmp).then(res => {
  182. this.detailData = res.data.data
  183. this.status = this.detailData.qualityInspectionManagement.status
  184. this.confirm = this.detailData.qualityInspectionManagement.confirm
  185. this.weightStatus = this.detailData.status
  186. this.payStatus = this.detailData.paymentManagement.approveStatus
  187. })
  188. .catch(res => {
  189. if (res.message) {
  190. uni.showToast({
  191. title: res.message,
  192. icon: 'none',
  193. duration: 2000
  194. })
  195. } else {
  196. uni.showToast({
  197. title: "请稍后再试!",
  198. icon: 'none',
  199. duration: 2000
  200. })
  201. }
  202. });
  203. },
  204. //跳转
  205. skip(val) {
  206. if (val == 1) {
  207. uni.navigateTo({
  208. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  209. .qualityInspectionManagement.id + '&managementType=' + this
  210. .managementType + '&cangid=' + this.cangid + '&flag=' + '0'
  211. })
  212. } else if (val == 2) {
  213. uni.navigateTo({
  214. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  215. .qualityInspectionManagement.id + '&managementType=' + this
  216. .managementType + '&cangid=' + this.cangid + '&flag=' + '1'
  217. })
  218. } else if (val == 3) {
  219. this.detailData.warehouseId = this.cangid
  220. uni.navigateTo({
  221. url: '/pages/erpbusiness/acquisitionInspection/grossWeightDetail?detailData=' +
  222. JSON.stringify(this.detailData)
  223. })
  224. } else if (val == 4) {
  225. this.detailData.warehouseId = this.cangid
  226. uni.navigateTo({
  227. url: '/pages/erpbusiness/acquisitionInspection/tareDetail??detailData=' + JSON
  228. .stringify(this.detailData)
  229. })
  230. } else if (val == 5) {
  231. uni.navigateTo({
  232. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  233. .qualityInspectionManagement.id + '&managementType=' + this
  234. .managementType + '&cangid=' + this.cangid + '&flag=' + '2'
  235. })
  236. }
  237. },
  238. selectItem(item) {
  239. if (item.authenticationStatus == "已接受") return
  240. for (let i = 0; i < this.grainMerchantList.length; i++) {
  241. if (this.grainMerchantList[i].id == item.id) {
  242. this.grainMerchantList[i].check = !this.grainMerchantList[i].check
  243. if (this.grainMerchantList[i].check) {
  244. this.selectID = this.grainMerchantList[i].id
  245. }
  246. }
  247. }
  248. },
  249. //查询粮商身份
  250. selectGrainMerchantList() {
  251. //
  252. },
  253. //粮商认证
  254. toGrainMerchantCertification() {
  255. var that = this
  256. // url: `/pageA/product/list?keywords=${key}&TabCur=${TabCur}`
  257. uni.navigateTo({
  258. url: `/pageD/identity/companyIdentity?status=1&compId=${that.user.companyId}&ids=${that.user.title}`,
  259. })
  260. },
  261. getList() {
  262. this.identityAuthenticationInfo.commonId = this.userInfo.id
  263. this.grainMerchantList = []
  264. this.$api.doRequest('get', '/identityAuthenticationInfo/selectIdentityAuthenticationInfo', {
  265. pageSize: 100,
  266. currentPage: 1,
  267. commonId: this.userInfo.id,
  268. compId: this.user.companyId,
  269. flag: 3
  270. }, 'application/json;charset=UTF-8').then(res => {
  271. for (var i = 0; i < res.data.data.records.length; i++) {
  272. res.data.data.records[i].basis = "false"
  273. if (res.data.data.records[i].defaultFlag == 1) {
  274. res.data.data.records[i].basis = "true"
  275. }
  276. }
  277. var data = res.data.data.records
  278. for (var i = 0; i < data.length; i++) {
  279. if (data[i].authenticationStatus == "未通过") {
  280. continue
  281. }
  282. if (data[i].customerTypeFlag == 2) {
  283. if (data[i].compName && data[i].compName.length > 10) {
  284. data[i].compName = data[i].compName.substring(0, 10) + "..."
  285. }
  286. }
  287. if (data[i].authenticationStatus == "已接受") {
  288. data[i].check = true
  289. this.isAllselect = true
  290. } else {
  291. data[i].check = false
  292. this.isAllselect = false
  293. this.flag = false
  294. }
  295. this.grainMerchantList.push(data[i])
  296. }
  297. if (this.flag) {
  298. this.btnVal = "已接受"
  299. }
  300. })
  301. .catch(res => {
  302. if (res.message) {
  303. uni.showToast({
  304. title: res.message,
  305. icon: 'none',
  306. duration: 2000
  307. })
  308. } else {
  309. uni.showToast({
  310. title: "系统异常,请联系管理员",
  311. icon: 'none',
  312. duration: 2000
  313. })
  314. }
  315. });
  316. },
  317. submit() {
  318. if (this.flag) return
  319. let _isAllCheck = false
  320. for (let i = 0; i < this.grainMerchantList.length; i++) {
  321. if (this.grainMerchantList[i].check) {
  322. _isAllCheck = true
  323. }
  324. }
  325. if (!_isAllCheck) {
  326. this.$refs.uToast.show({
  327. title: '至少选择一个身份',
  328. type: "error",
  329. icon: false
  330. })
  331. }
  332. this.$api.doRequest('get', '/identityAuthenticationInfo/saveCompanyIdentity', {
  333. id: this.selectID,
  334. compId: this.user.companyId,
  335. }, 'application/json;charset=UTF-8').then(res => {
  336. console.log(res);
  337. if (res.data.code == 200) {
  338. // this.getList()
  339. uni.navigateBack(-1)
  340. }
  341. })
  342. .catch(res => {
  343. if (res.message) {
  344. uni.showToast({
  345. title: res.message,
  346. icon: 'none',
  347. duration: 2000
  348. })
  349. } else {
  350. uni.showToast({
  351. title: "接受邀请失败,请稍后再试。",
  352. icon: 'none',
  353. duration: 2000
  354. })
  355. }
  356. });
  357. },
  358. close() {
  359. uni.navigateBack(-1)
  360. }
  361. }
  362. }
  363. </script>
  364. <style scoped lang="scss">
  365. .content {
  366. background: white;
  367. }
  368. .top {
  369. background: url(../../../static/img/bg@2x.png);
  370. background-size: 100% 100%;
  371. padding: 0 80rpx 0 80rpx;
  372. text-align: center;
  373. height: 310rpx;
  374. }
  375. .content-bottom {
  376. padding: 50rpx 50rpx 50rpx 50rpx;
  377. .title {
  378. font-size: 32rpx;
  379. font-weight: 600;
  380. color: #333333;
  381. text-align: center;
  382. margin-bottom: 30rpx;
  383. }
  384. .active {}
  385. .item-select {
  386. border-radius: 1px;
  387. border: 1px solid #C5CAD5;
  388. padding: 15rpx 40rpx;
  389. background: #F4FAF4;
  390. border: 1px solid #22C572;
  391. margin-bottom: 20rpx;
  392. position: relative;
  393. .img {
  394. position: absolute;
  395. width: 42rpx;
  396. height: 40rpx;
  397. top: 0;
  398. right: 0;
  399. }
  400. .name {
  401. font-size: 32rpx;
  402. font-weight: 600;
  403. color: #22C572;
  404. }
  405. .phone {
  406. display: flex;
  407. align-items: center;
  408. color: #8E93A3;
  409. .number {
  410. margin-right: 20rpx;
  411. }
  412. }
  413. }
  414. .item {
  415. border-radius: 1px;
  416. border: 1px solid #C5CAD5;
  417. padding: 15rpx 40rpx;
  418. margin-bottom: 20rpx;
  419. position: relative;
  420. .img {
  421. position: absolute;
  422. width: 42rpx;
  423. height: 40rpx;
  424. top: 0;
  425. right: 0;
  426. }
  427. .name {
  428. font-size: 32rpx;
  429. font-weight: 600;
  430. }
  431. .phone {
  432. display: flex;
  433. align-items: center;
  434. color: #8E93A3;
  435. .number {
  436. margin-right: 20rpx;
  437. }
  438. }
  439. }
  440. }
  441. .top-center-1 {
  442. font-size: 42rpx;
  443. font-weight: 600;
  444. color: #333333;
  445. position: relative;
  446. top: 88rpx;
  447. }
  448. .top-content-2 {
  449. display: flex;
  450. justify-content: center;
  451. align-items: flex-end;
  452. position: relative;
  453. top: -50px;
  454. }
  455. .top-content-3 {
  456. position: relative;
  457. top: -25px;
  458. padding: 0 81rpx;
  459. }
  460. .top-content-green {
  461. color: #22C572;
  462. font-size: 32rpx;
  463. }
  464. .custom-style {
  465. background: #22C572;
  466. border-radius: 46px;
  467. margin: 50rpx;
  468. color: white;
  469. }
  470. .nolist {
  471. text-align: center;
  472. margin: 50rpx 50rpx 100rpx 50rpx;
  473. .img {
  474. width: 240rpx;
  475. height: 240rpx;
  476. }
  477. .text {
  478. margin: 20rpx;
  479. color: #8E93A3;
  480. }
  481. }
  482. .but_css {
  483. width: 200rpx;
  484. height: 80rpx;
  485. background-color: #22C572;
  486. margin: 20rpx auto;
  487. color: #FFFFFF;
  488. line-height: 80rpx;
  489. border-radius: 20rpx;
  490. text-align: center;
  491. }
  492. .buns_item{
  493. margin: 100rpx;
  494. }
  495. </style>