sm.vue 14 KB

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