sm.vue 14 KB

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