check.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <view class="page" :style="{'min-height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="核销" @goBack="back()"></c-nav-bar>
  4. <view class="types">
  5. <view class="item bg2" @tap="scanCode(0)">
  6. <view class="n">扫码核销</view>
  7. <u-icon name="arrow-right" color="#fff" size="26" label="点击扫描" label-color="#fff" label-size="28" cu
  8. label-pos="left"></u-icon>
  9. </view>
  10. <view class="item bg1" @tap="scanCode(1)">
  11. <view class="n">扫身份证</view>
  12. <u-icon name="arrow-right" color="#fff" size="26" label="点击扫描" label-color="#fff" label-size="28"
  13. label-pos="left"></u-icon>
  14. </view>
  15. </view>
  16. <view class="orderInfo">
  17. <view class="tit">
  18. 订单详情
  19. </view>
  20. <view class="time">{{orderInfo.playDate}} {{orderInfo.playTime}}出发</view>
  21. <view class="bottom">
  22. <text>{{orderInfo.num}}人</text>
  23. <text>出游·{{orderInfo.playLength||0}}小时</text>
  24. <text>¥{{orderInfo.realPrice}}</text>
  25. </view>
  26. </view>
  27. <view class="list">
  28. <view class="tit">{{boatNo}} 共({{data.length}})人</view>
  29. <view class="item" v-for="(i,index) in data" :key="index">
  30. <text class="type" :class="i.remark=='book'?'t1':'t2'">{{i.remark=='book'?'预订单':'现场单'}}</text>
  31. <view class="personInfo">
  32. <view class="name">{{i.touristName|handle(1)}}</view>
  33. <view class="code">
  34. 身份证 {{i.touristCode|handle(3)}}
  35. </view>
  36. <view style="display: flex;justify-content: flex-start;padding: 8rpx 0;">
  37. <view v-if="i.touristJpg.length!=0" >已补充证件照片
  38. <span @click="view(i.touristJpg)" style="background-color: #007A69;color: #007A69;color: #fff;display: inline-block;border-radius: 12rpx;padding: 4rpx 10rpx;margin-right: 8rpx;">查看</span>
  39. </view>
  40. <view v-if="i.touristType==1" @click="idCardUpload(i,index)" style="background-color: #007A69;color: #007A69;color: #fff;display: inline-block;border-radius: 12rpx;padding: 4rpx 10rpx;">
  41. {{i.touristJpg.length!=0?'重新上传':'补充证件照片'}}
  42. </view>
  43. </view>
  44. </view>
  45. <u-icon name="minus-circle" size="36" color="#FEA400" @tap="jian(index)"
  46. ></u-icon>
  47. </view>
  48. </view>
  49. <view class="list">
  50. <view class="tit">选择渔船</view>
  51. <view class="typeItem">
  52. <view class="txt" v-for="(t,i) in types" :key="i" @click="typeIndex=i" :class="typeIndex==i?'on':''">
  53. {{t.boatNo}}
  54. <image v-if="typeIndex==i"
  55. src="https://fsy.shengsi.gov.cn/file/20240320/b458b03f8f654a51a921656b8aa955de.png"></image>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="btn">
  60. <text @click="hexiao">开始发船</text>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. encrypt,
  67. decrypt,
  68. tuomin
  69. } from '../../utils/aes.js'
  70. var that;
  71. export default {
  72. data() {
  73. return {
  74. typeIndex: null,
  75. types: [],
  76. date: new Date().Format('yyyy-MM-dd'),
  77. show: false,
  78. data: [],
  79. merchantId: uni.getStorageSync('merchantId'),
  80. playTime: '',
  81. boatNo: '',
  82. type: '',
  83. orderInfo: {},
  84. keyName: '',
  85. playDate:''
  86. }
  87. },
  88. onLoad(opt) {
  89. that = this;
  90. this.playTime = opt.playTime || '';
  91. this.boatNo = opt.boatNo || '';
  92. this.playDate = opt.playDate || '';
  93. this.getOrderInfo();
  94. this.getTypes();
  95. },
  96. filters: {
  97. handle(val, type) {
  98. return tuomin(val, type);
  99. }
  100. },
  101. methods: {
  102. view(item){
  103. uni.previewImage({
  104. urls:[item]
  105. })
  106. },
  107. idCardUpload(item,index) {
  108. console.log(item)
  109. uni.chooseImage({
  110. sourceType: ['album'], //从相册选择
  111. success: chooseImageRes => {
  112. const tempFilePaths = chooseImageRes.tempFilePaths;
  113. uni.uploadFile({
  114. url: 'https://fsy.shengsi.gov.cn/island-cloud-server/oss/file/aliyunUpload', // 仅为示例,非真实的接口地址
  115. filePath: tempFilePaths[0],
  116. name: 'file',
  117. header: {
  118. token: wx.getStorageSync('access_token')
  119. },
  120. success: res => {
  121. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  122. let data = JSON.parse(res.data);
  123. this.data[index].touristJpg = data.data.url
  124. this.data[index].touristType = 1
  125. }
  126. });
  127. },
  128. fail: err => {
  129. this.myToast('图片上传失败', 'none');
  130. }
  131. });
  132. },
  133. getTypes() {
  134. this.$api.get('/scenic/api/boat/page?sailFlag=0&merchantId=' + this.merchantId, {
  135. page: -1
  136. }).then(res => {
  137. if (res.data.code == 0) {
  138. this.types = res.data.data.list;
  139. }
  140. })
  141. },
  142. back() {
  143. this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
  144. uni.setStorageSync(this.keyName, JSON.stringify(this.data));
  145. //decodeURIComponent
  146. },
  147. getOrderInfo() {
  148. this.$api.post('/scenic/api/order/queryStartOrderInfo', {
  149. merchantId: this.merchantId,
  150. playDate:this.playDate,
  151. boatNo: this.boatNo
  152. }).then(res => {
  153. if (res.data.code == 0) {
  154. this.orderInfo = res.data.data;
  155. this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
  156. if (uni.getStorageSync(this.keyName)) {
  157. this.data = JSON.parse(uni.getStorageSync(this.keyName)) || [];
  158. }
  159. }
  160. })
  161. },
  162. scanCode(type) {
  163. uni.scanCode({
  164. onlyFromCamera: true,
  165. success: (res) => {
  166. console.log('扫码结果:' + res.result);
  167. // 扫码成功后的操作,例如:
  168. that.handleScanResult(res.result, type, '');
  169. },
  170. fail: (err) => {
  171. console.error('扫码失败:' + err);
  172. }
  173. });
  174. },
  175. // 处理扫码结果的函数,可以根据实际需求进行扩展
  176. handleScanResult(result, type, name) {
  177. // 例如:导航到某个页面,或者处理其他业务逻辑
  178. let sendData = {};
  179. sendData.playDate = this.orderInfo.playDate;
  180. sendData.playTime = this.orderInfo.playTime;
  181. sendData.playLength = this.orderInfo.playLength || 1;
  182. sendData.merchantId = this.orderInfo.merchantId;
  183. sendData.orderType = this.orderInfo.orderType;
  184. sendData.type = type;
  185. sendData.boatNo = this.boatNo;
  186. if(type==0) sendData.writeOffCode = result;
  187. else if(type==1){
  188. sendData.touristCode = encrypt(result);
  189. sendData.touristName = encrypt(name);
  190. }
  191. this.$api.post('/scenic/api/order/scanCode', sendData).then(res => {
  192. if (res.data.code == 0) {
  193. if (this.data.findIndex((item) => {
  194. return item.touristCode == res.data.data.touristCode
  195. }) > -1) {
  196. this.$showToast('该核验码已扫')
  197. } else {
  198. if(type==1){
  199. res.data.data.touristType = 0
  200. res.data.data.touristJpg = ''
  201. this.data.push(res.data.data);
  202. }else{
  203. res.data.data.touristType = 1
  204. res.data.data.touristJpg = ''
  205. this.data.push(res.data.data);
  206. }
  207. }
  208. } else {
  209. this.$showToast(res.data.msg)
  210. }
  211. })
  212. },
  213. check() {
  214. uni.navigateTo({
  215. url: '/pagesHouse/Verification/check'
  216. })
  217. },
  218. hexiao() {
  219. let that = this
  220. if (this.data.length == 0) {
  221. return this.$showToast('请选择核销人')
  222. }
  223. if (this.typeIndex == null) {
  224. return this.$showToast('请选择渔船')
  225. }
  226. let boatCode = this.types[this.typeIndex].boatNo;
  227. let newData = JSON.parse(JSON.stringify(this.data));
  228. newData.forEach(d=>{
  229. d.touristCode = encrypt(d.touristCode);
  230. d.touristName = encrypt(d.touristName);
  231. })
  232. uni.showModal({
  233. title: '提示',
  234. content: '确定该操作?',
  235. success: function(res) {
  236. if (res.confirm) {
  237. that.$api.post('/scenic/api/order/sailWriteOff', {
  238. playDate:that.orderInfo.playDate,
  239. playTime:that.orderInfo.playTime,
  240. playLength:that.orderInfo.playLength,
  241. orderType: that.orderInfo.orderType,
  242. orderCode:that.orderInfo.orderCode,
  243. merchantId:that.merchantId,
  244. touristList: newData,
  245. boatCode: boatCode
  246. }).then(res => {
  247. if (res.data.code == 0) {
  248. uni.navigateTo({
  249. url: "/pagesHouse/Verification/success?boatNo=" + that.boatNo + '&price=' +
  250. that.orderInfo.realPrice
  251. })
  252. }else that.$showToast(res.data.msg)
  253. })
  254. }
  255. }
  256. })
  257. uni.removeStorageSync(that.keyName);
  258. },
  259. jian(index){
  260. if(this.data.length>index) this.data.splice(index,1);
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="less" scoped>
  266. /deep/.u-icon {
  267. justify-content: flex-end;
  268. }
  269. .btn {
  270. position: fixed;
  271. bottom: 0;
  272. left: 0;
  273. z-index: 1;
  274. padding: 16rpx 30rpx 36rpx 30rpx;
  275. width: 100%;
  276. box-sizing: border-box;
  277. background: #fff;
  278. text {
  279. display: block;
  280. background-color: #007A69;
  281. color: #007A69;
  282. color: #fff;
  283. height: 88rpx;
  284. line-height: 88rpx;
  285. border-radius: 44rpx;
  286. text-align: center;
  287. font-size: 32rp;
  288. font-weight: bold;
  289. box-sizing: border-box;
  290. }
  291. }
  292. .page {
  293. background: #F5F8FA;
  294. padding: 20rpx 24rpx 160rpx;
  295. box-sizing: border-box;
  296. .types {
  297. display: flex;
  298. gap: 36rpx;
  299. justify-content: space-between;
  300. .n {
  301. margin-bottom: 20rpx;
  302. color: #fff;
  303. }
  304. .item {
  305. width: 330rpx;
  306. height: 156rpx;
  307. padding: 34rpx 24rpx;
  308. font-size: 36rpx;
  309. font-weight: bold;
  310. box-sizing: border-box;
  311. }
  312. .bg2 {
  313. background: url('https://fsy.shengsi.gov.cn/file/20240316/3fc9f6a78557492e98caa50392411e3a.png') no-repeat center;
  314. background-size: 100%;
  315. }
  316. .bg1 {
  317. background: url('https://fsy.shengsi.gov.cn/file/20240316/8a927d5d4da84728b6bb0896541baccf.png') no-repeat center;
  318. background-size: 100%;
  319. }
  320. }
  321. .orderInfo {
  322. background-color: #fff;
  323. color: #333;
  324. padding: 0 24rpx 36rpx;
  325. margin: 20rpx 0 0;
  326. background: #fff;
  327. border-radius: 16rpx;
  328. .tit {
  329. padding: 32rpx 0 24rpx;
  330. font-size: 32rpx;
  331. }
  332. .time {
  333. font-size: 36rpx;
  334. font-weight: bold;
  335. margin-bottom: 32rpx;
  336. }
  337. .bottom {
  338. display: flex;
  339. align-items: center;
  340. text {
  341. &:first-child {
  342. width: 88rpx;
  343. height: 54rpx;
  344. background-color: #007A69;
  345. color: #fff;
  346. font-size: 34rpx;
  347. font-weight: bold;
  348. margin-right: 10rpx;
  349. text-align: center;
  350. border-radius: 12rpx;
  351. }
  352. &:nth-child(2) {
  353. width: 200rpx;
  354. flex: 1;
  355. }
  356. &:last-child {
  357. font-size: 30rpx;
  358. font-weight: bold;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. .list {
  365. box-sizing: border-box;
  366. padding: 0 24rpx 0;
  367. border-radius: 16rpx;
  368. background-color: #fff;
  369. margin-top: 20rpx;
  370. .tit {
  371. font-size: 36rpx;
  372. font-weight: bold;
  373. color: #111;
  374. padding: 36rpx 0 17rpx;
  375. }
  376. .typeItem {
  377. display: flex;
  378. justify-content: space-between;
  379. flex-wrap: wrap;
  380. gap: 20rpx 0;
  381. padding-bottom: 50rpx;
  382. .txt {
  383. display: inline-block;
  384. width: 316rpx;
  385. height: 80rpx;
  386. background: #fff;
  387. border-radius: 16rpx;
  388. text-align: center;
  389. line-height: 80rpx;
  390. border: 2rpx solid #EFEFEF;
  391. color: #333;
  392. position: relative;
  393. &.on {
  394. color: #007A69;
  395. background: rgba(0, 122, 105, 0.06);
  396. border: 2rpx solid #007A69;
  397. image {
  398. position: absolute;
  399. bottom: 0;
  400. right: 0;
  401. width: 34rpx;
  402. height: 26rpx;
  403. z-index: 11;
  404. }
  405. }
  406. }
  407. }
  408. .item {
  409. display: flex;
  410. justify-content: space-between;
  411. padding: 24rpx 0;
  412. align-items: center;
  413. .type {
  414. width: 110rpx;
  415. height: 48rpx;
  416. text-align: center;
  417. display: inline-block;
  418. line-height: 48rpx;
  419. border-radius: 11rpx;
  420. font-size: 26rpx;
  421. font-weight: bold;
  422. color: #111;
  423. margin-right: 16rpx;
  424. }
  425. .t1 {
  426. background-color: #F0F8F6;
  427. color: #007A69;
  428. }
  429. .t2 {
  430. background-color: #E8EFFD;
  431. color: #326EE0;
  432. }
  433. .personInfo {
  434. flex: 1;
  435. .name {
  436. font-size: 30rpx;
  437. color: #111;
  438. margin-bottom: 16rpx;
  439. }
  440. .code {
  441. color: #666;
  442. font-size: 28rpx;
  443. }
  444. }
  445. }
  446. }
  447. </style>