sm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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 && confirm != '1' && (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. // debugger
  164. // this.getRoles("acquisitionWeight.mao")
  165. },
  166. methods: {
  167. //查看权限
  168. getRoles: function(role) {
  169. // debugger
  170. let _roles = uni.getStorageSync('rolesList')
  171. for (let i = 0; i < _roles.length; i++) {
  172. if (_roles[i] == role) {
  173. return true
  174. }
  175. }
  176. return false
  177. },
  178. getShow() {
  179. let tmp = {
  180. compId: this.compId,
  181. number: this.qualityNo,
  182. warehouseId: this.cangid
  183. }
  184. this.$api.doRequest('get', '/weighingManagement/getQRcode', tmp).then(res => {
  185. this.detailData = res.data.data
  186. this.status = this.detailData.qualityInspectionManagement.status
  187. this.confirm = this.detailData.qualityInspectionManagement.confirm
  188. this.weightStatus = this.detailData.status
  189. this.payStatus = this.detailData.paymentManagement.approveStatus
  190. })
  191. .catch(res => {
  192. if (res.message) {
  193. uni.showToast({
  194. title: res.message,
  195. icon: 'none',
  196. duration: 2000
  197. })
  198. } else {
  199. uni.showToast({
  200. title: "请稍后再试!",
  201. icon: 'none',
  202. duration: 2000
  203. })
  204. }
  205. });
  206. },
  207. //跳转
  208. skip(val) {
  209. if (val == 1) {
  210. uni.navigateTo({
  211. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  212. .qualityInspectionManagement.id + '&managementType=' + this
  213. .managementType + '&cangid=' + this.cangid + '&flag=' + '0'
  214. })
  215. } else if (val == 2) {
  216. uni.navigateTo({
  217. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  218. .qualityInspectionManagement.id + '&managementType=' + this
  219. .managementType + '&cangid=' + this.cangid + '&flag=' + '1'
  220. })
  221. } else if (val == 3) {
  222. this.detailData.warehouseId = this.cangid
  223. uni.navigateTo({
  224. url: '/pages/erpbusiness/acquisitionInspection/grossWeightDetail?detailData=' +
  225. JSON.stringify(this.detailData)
  226. })
  227. } else if (val == 4) {
  228. this.detailData.warehouseId = this.cangid
  229. uni.navigateTo({
  230. url: '/pages/erpbusiness/acquisitionInspection/tareDetail??detailData=' + JSON
  231. .stringify(this.detailData)
  232. })
  233. } else if (val == 5) {
  234. uni.navigateTo({
  235. url: '/pages/erpbusiness/edit_quality_testing?id=' + this.detailData
  236. .qualityInspectionManagement.id + '&managementType=' + this
  237. .managementType + '&cangid=' + this.cangid + '&flag=' + '2'
  238. })
  239. }
  240. },
  241. selectItem(item) {
  242. if (item.authenticationStatus == "已接受") return
  243. for (let i = 0; i < this.grainMerchantList.length; i++) {
  244. if (this.grainMerchantList[i].id == item.id) {
  245. this.grainMerchantList[i].check = !this.grainMerchantList[i].check
  246. if (this.grainMerchantList[i].check) {
  247. this.selectID = this.grainMerchantList[i].id
  248. }
  249. }
  250. }
  251. },
  252. //查询粮商身份
  253. selectGrainMerchantList() {
  254. //
  255. },
  256. //粮商认证
  257. toGrainMerchantCertification() {
  258. var that = this
  259. // url: `/pageA/product/list?keywords=${key}&TabCur=${TabCur}`
  260. uni.navigateTo({
  261. url: `/pageD/identity/companyIdentity?status=1&compId=${that.user.companyId}&ids=${that.user.title}`,
  262. })
  263. },
  264. getList() {
  265. this.identityAuthenticationInfo.commonId = this.userInfo.id
  266. this.grainMerchantList = []
  267. this.$api.doRequest('get', '/identityAuthenticationInfo/selectIdentityAuthenticationInfo', {
  268. pageSize: 100,
  269. currentPage: 1,
  270. commonId: this.userInfo.id,
  271. compId: this.user.companyId,
  272. flag: 3
  273. }, 'application/json;charset=UTF-8').then(res => {
  274. for (var i = 0; i < res.data.data.records.length; i++) {
  275. res.data.data.records[i].basis = "false"
  276. if (res.data.data.records[i].defaultFlag == 1) {
  277. res.data.data.records[i].basis = "true"
  278. }
  279. }
  280. var data = res.data.data.records
  281. for (var i = 0; i < data.length; i++) {
  282. if (data[i].authenticationStatus == "未通过") {
  283. continue
  284. }
  285. if (data[i].customerTypeFlag == 2) {
  286. if (data[i].compName && data[i].compName.length > 10) {
  287. data[i].compName = data[i].compName.substring(0, 10) + "..."
  288. }
  289. }
  290. if (data[i].authenticationStatus == "已接受") {
  291. data[i].check = true
  292. this.isAllselect = true
  293. } else {
  294. data[i].check = false
  295. this.isAllselect = false
  296. this.flag = false
  297. }
  298. this.grainMerchantList.push(data[i])
  299. }
  300. if (this.flag) {
  301. this.btnVal = "已接受"
  302. }
  303. })
  304. .catch(res => {
  305. if (res.message) {
  306. uni.showToast({
  307. title: res.message,
  308. icon: 'none',
  309. duration: 2000
  310. })
  311. } else {
  312. uni.showToast({
  313. title: "系统异常,请联系管理员",
  314. icon: 'none',
  315. duration: 2000
  316. })
  317. }
  318. });
  319. },
  320. submit() {
  321. if (this.flag) return
  322. let _isAllCheck = false
  323. for (let i = 0; i < this.grainMerchantList.length; i++) {
  324. if (this.grainMerchantList[i].check) {
  325. _isAllCheck = true
  326. }
  327. }
  328. if (!_isAllCheck) {
  329. this.$refs.uToast.show({
  330. title: '至少选择一个身份',
  331. type: "error",
  332. icon: false
  333. })
  334. }
  335. this.$api.doRequest('get', '/identityAuthenticationInfo/saveCompanyIdentity', {
  336. id: this.selectID,
  337. compId: this.user.companyId,
  338. }, 'application/json;charset=UTF-8').then(res => {
  339. console.log(res);
  340. if (res.data.code == 200) {
  341. // this.getList()
  342. uni.navigateBack(-1)
  343. }
  344. })
  345. .catch(res => {
  346. if (res.message) {
  347. uni.showToast({
  348. title: res.message,
  349. icon: 'none',
  350. duration: 2000
  351. })
  352. } else {
  353. uni.showToast({
  354. title: "接受邀请失败,请稍后再试。",
  355. icon: 'none',
  356. duration: 2000
  357. })
  358. }
  359. });
  360. },
  361. close() {
  362. uni.navigateBack(-1)
  363. }
  364. }
  365. }
  366. </script>
  367. <style scoped lang="scss">
  368. .content {
  369. background: white;
  370. }
  371. .top {
  372. background: url(../../../static/img/bg@2x.png);
  373. background-size: 100% 100%;
  374. padding: 0 80rpx 0 80rpx;
  375. text-align: center;
  376. height: 310rpx;
  377. }
  378. .content-bottom {
  379. padding: 50rpx 50rpx 50rpx 50rpx;
  380. .title {
  381. font-size: 32rpx;
  382. font-weight: 600;
  383. color: #333333;
  384. text-align: center;
  385. margin-bottom: 30rpx;
  386. }
  387. .active {}
  388. .item-select {
  389. border-radius: 1px;
  390. border: 1px solid #C5CAD5;
  391. padding: 15rpx 40rpx;
  392. background: #F4FAF4;
  393. border: 1px solid #22C572;
  394. margin-bottom: 20rpx;
  395. position: relative;
  396. .img {
  397. position: absolute;
  398. width: 42rpx;
  399. height: 40rpx;
  400. top: 0;
  401. right: 0;
  402. }
  403. .name {
  404. font-size: 32rpx;
  405. font-weight: 600;
  406. color: #22C572;
  407. }
  408. .phone {
  409. display: flex;
  410. align-items: center;
  411. color: #8E93A3;
  412. .number {
  413. margin-right: 20rpx;
  414. }
  415. }
  416. }
  417. .item {
  418. border-radius: 1px;
  419. border: 1px solid #C5CAD5;
  420. padding: 15rpx 40rpx;
  421. margin-bottom: 20rpx;
  422. position: relative;
  423. .img {
  424. position: absolute;
  425. width: 42rpx;
  426. height: 40rpx;
  427. top: 0;
  428. right: 0;
  429. }
  430. .name {
  431. font-size: 32rpx;
  432. font-weight: 600;
  433. }
  434. .phone {
  435. display: flex;
  436. align-items: center;
  437. color: #8E93A3;
  438. .number {
  439. margin-right: 20rpx;
  440. }
  441. }
  442. }
  443. }
  444. .top-center-1 {
  445. font-size: 42rpx;
  446. font-weight: 600;
  447. color: #333333;
  448. position: relative;
  449. top: 88rpx;
  450. }
  451. .top-content-2 {
  452. display: flex;
  453. justify-content: center;
  454. align-items: flex-end;
  455. position: relative;
  456. top: -50px;
  457. }
  458. .top-content-3 {
  459. position: relative;
  460. top: -25px;
  461. padding: 0 81rpx;
  462. }
  463. .top-content-green {
  464. color: #22C572;
  465. font-size: 32rpx;
  466. }
  467. .custom-style {
  468. background: #22C572;
  469. border-radius: 46px;
  470. margin: 50rpx;
  471. color: white;
  472. }
  473. .nolist {
  474. text-align: center;
  475. margin: 50rpx 50rpx 100rpx 50rpx;
  476. .img {
  477. width: 240rpx;
  478. height: 240rpx;
  479. }
  480. .text {
  481. margin: 20rpx;
  482. color: #8E93A3;
  483. }
  484. }
  485. .but_css {
  486. width: 200rpx;
  487. height: 80rpx;
  488. background-color: #22C572;
  489. margin: 20rpx auto;
  490. color: #FFFFFF;
  491. line-height: 80rpx;
  492. border-radius: 20rpx;
  493. text-align: center;
  494. }
  495. .buns_item{
  496. margin: 100rpx;
  497. }
  498. </style>