sm.vue 13 KB

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