check.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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}}</view>
  33. <view class="code">
  34. 身份证 {{i.touristCode}}
  35. </view>
  36. </view>
  37. <u-icon name="minus-circle" size="36" color="#FEA400" @tap="jian(item)"
  38. v-if="i.remark!='book'"></u-icon>
  39. </view>
  40. </view>
  41. <view class="list">
  42. <view class="tit">选择渔船</view>
  43. <view class="typeItem">
  44. <view class="txt" v-for="(t,i) in types" :key="i" @click="typeIndex=i" :class="typeIndex==i?'on':''">
  45. {{t}}
  46. <image v-if="typeIndex==i" src="https://i.ringzle.com/file/20240320/b458b03f8f654a51a921656b8aa955de.png"></image>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="btn">
  51. <text @click="hexiao">开始发船</text>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. var that;
  57. export default {
  58. data() {
  59. return {
  60. typeIndex:null,
  61. types: ['浙嵊渔休30015',
  62. '浙嵊渔休30016',
  63. '浙嵊渔休30017',
  64. '浙嵊渔休30018',
  65. '浙嵊渔休30019',
  66. '浙嵊渔休30020',
  67. '浙嵊渔休30021',
  68. '浙嵊渔休30022',
  69. '浙嵊渔休30023',
  70. '浙嵊渔休30025',
  71. ],
  72. date: new Date().Format('yyyy-MM-dd'),
  73. show: false,
  74. data: [],
  75. merchantId: uni.getStorageSync('merchantId'),
  76. playTime: '',
  77. boatNo: '',
  78. type: '',
  79. orderInfo: {},
  80. keyName: ''
  81. }
  82. },
  83. onLoad(opt) {
  84. that = this;
  85. this.playTime = opt.playTime || '';
  86. this.boatNo = opt.boatNo || '';
  87. this.getOrderInfo();
  88. //获取上次核销缓存
  89. },
  90. methods: {
  91. back() {
  92. this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
  93. uni.setStorageSync(this.keyName, JSON.stringify(this.data));
  94. //decodeURIComponent
  95. },
  96. getOrderInfo() {
  97. this.$api.post('/scenic/order/queryStartOrderInfo', {
  98. merchantId: this.merchantId,
  99. boatNo: this.boatNo
  100. }).then(res => {
  101. console.log(res.data)
  102. if (res.data.code == 0) {
  103. console.log(res)
  104. this.orderInfo = res.data.data;
  105. this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
  106. console.log(uni.getStorageSync(this.keyName))
  107. if(uni.getStorageSync(this.keyName)){
  108. this.data = JSON.parse(uni.getStorageSync(this.keyName)) || [];
  109. }
  110. console.log(this.data)
  111. }
  112. })
  113. },
  114. scanCode(type) {
  115. uni.scanCode({
  116. onlyFromCamera: true,
  117. success: (res) => {
  118. console.log('扫码结果:' + res.result);
  119. // 扫码成功后的操作,例如:
  120. that.handleScanResult(res.result, type);
  121. },
  122. fail: (err) => {
  123. console.error('扫码失败:' + err);
  124. }
  125. });
  126. },
  127. // 处理扫码结果的函数,可以根据实际需求进行扩展
  128. handleScanResult(result, type) {
  129. // 例如:导航到某个页面,或者处理其他业务逻辑
  130. let sendData = {};
  131. sendData.playDate = this.orderInfo.playDate;
  132. sendData.playTime = this.orderInfo.playTime;
  133. sendData.playLength = this.orderInfo.playLength || 1;
  134. sendData.merchantId = this.orderInfo.merchantId;
  135. sendData.orderType = this.orderInfo.orderType;
  136. sendData.type = type;
  137. sendData.writeOffCode = result;
  138. console.log(sendData)
  139. this.$api.post('/scenic/order/scanCode', sendData).then(res => {
  140. console.log(res.data)
  141. if (res.data.code == 0) {
  142. console.log(this.data.findIndex(item => {
  143. item.touristCode == res.data.data.touristCode
  144. }))
  145. if (this.data.findIndex((item) => {
  146. return item.touristCode == res.data.data.touristCode
  147. }) > -1) {
  148. this.$showToast('该核验码已扫')
  149. } else {
  150. this.data.push(res.data.data)
  151. }
  152. } else {
  153. this.$showToast(res.data.msg)
  154. }
  155. })
  156. },
  157. check() {
  158. uni.navigateTo({
  159. url: '/pagesHouse/Verification/check'
  160. })
  161. },
  162. hexiao() {
  163. if (this.data.length == 0) {
  164. return this.$showToast('请选择核销人')
  165. }
  166. if (this.typeIndex==null) {
  167. return this.$showToast('请选择渔船')
  168. }
  169. let boatCode=this.types[this.typeIndex];
  170. this.$api.post('/scenic/order/sailWriteOff', {
  171. orderType: this.orderInfo.orderType,
  172. touristList: this.data,
  173. boatCode:boatCode
  174. }).then(res => {
  175. if (res.data.code == 0) {
  176. uni.redirectTo({
  177. url: "/pagesHouse/Verification/success?boatNo=" + this.boatNo + '&price=' +
  178. this.orderInfo.realPrice
  179. })
  180. }
  181. })
  182. uni.removeStorageSync(this.keyName);
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="less" scoped>
  188. /deep/.u-icon {
  189. justify-content: flex-end;
  190. }
  191. .btn {
  192. position: fixed;
  193. bottom: 0;
  194. left: 0;
  195. z-index: 1;
  196. padding: 16rpx 30rpx 36rpx 30rpx;
  197. width: 100%;
  198. box-sizing: border-box;
  199. background: #fff;
  200. text {
  201. display: block;
  202. background-color: #007A69;
  203. color: #007A69;
  204. color: #fff;
  205. height: 88rpx;
  206. line-height: 88rpx;
  207. border-radius: 44rpx;
  208. text-align: center;
  209. font-size: 32rp;
  210. font-weight: bold;
  211. box-sizing: border-box;
  212. }
  213. }
  214. .page {
  215. background: #F5F8FA;
  216. padding: 20rpx 24rpx 160rpx;
  217. box-sizing: border-box;
  218. .types {
  219. display: flex;
  220. gap: 36rpx;
  221. justify-content: space-between;
  222. .n {
  223. margin-bottom: 20rpx;
  224. color: #fff;
  225. }
  226. .item {
  227. width: 330rpx;
  228. height: 156rpx;
  229. padding: 34rpx 24rpx;
  230. font-size: 36rpx;
  231. font-weight: bold;
  232. box-sizing: border-box;
  233. }
  234. .bg2 {
  235. background: url('https://i.ringzle.com/file/20240316/3fc9f6a78557492e98caa50392411e3a.png') no-repeat center;
  236. background-size: 100%;
  237. }
  238. .bg1 {
  239. background: url('https://i.ringzle.com/file/20240316/8a927d5d4da84728b6bb0896541baccf.png') no-repeat center;
  240. background-size: 100%;
  241. }
  242. }
  243. .orderInfo {
  244. background-color: #fff;
  245. color: #333;
  246. padding: 0 24rpx 36rpx;
  247. margin: 20rpx 0 0;
  248. background: #fff;
  249. border-radius: 16rpx;
  250. .tit {
  251. padding: 32rpx 0 24rpx;
  252. font-size: 32rpx;
  253. }
  254. .time {
  255. font-size: 36rpx;
  256. font-weight: bold;
  257. margin-bottom: 32rpx;
  258. }
  259. .bottom {
  260. display: flex;
  261. align-items: center;
  262. text {
  263. &:first-child {
  264. width: 88rpx;
  265. height: 54rpx;
  266. background-color: #007A69;
  267. color: #fff;
  268. font-size: 34rpx;
  269. font-weight: bold;
  270. margin-right: 10rpx;
  271. text-align: center;
  272. border-radius: 12rpx;
  273. }
  274. &:nth-child(2) {
  275. width: 200rpx;
  276. flex: 1;
  277. }
  278. &:last-child {
  279. font-size: 30rpx;
  280. font-weight: bold;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. .list {
  287. box-sizing: border-box;
  288. padding: 0 24rpx 0;
  289. border-radius: 16rpx;
  290. background-color: #fff;
  291. margin-top: 20rpx;
  292. .tit {
  293. font-size: 36rpx;
  294. font-weight: bold;
  295. color: #111;
  296. padding: 36rpx 0 17rpx;
  297. }
  298. .typeItem{
  299. display: flex;
  300. justify-content: space-between;
  301. flex-wrap: wrap;
  302. gap:20rpx 0;
  303. padding-bottom: 50rpx;
  304. .txt{
  305. display: inline-block;
  306. width: 316rpx;
  307. height: 80rpx;
  308. background: #fff;
  309. border-radius: 16rpx;
  310. text-align: center;
  311. line-height: 80rpx;
  312. border: 2rpx solid #EFEFEF;
  313. color:#333;
  314. position: relative;
  315. &.on{
  316. color:#007A69 ;
  317. background: rgba(0,122,105,0.06);
  318. border: 2rpx solid #007A69;
  319. image{
  320. position: absolute;
  321. bottom: 0;
  322. right: 0;
  323. width: 34rpx;
  324. height: 26rpx;
  325. z-index: 11;
  326. }
  327. }
  328. }
  329. }
  330. .item {
  331. display: flex;
  332. justify-content: space-between;
  333. padding: 24rpx 0;
  334. align-items: center;
  335. .type {
  336. width: 110rpx;
  337. height: 48rpx;
  338. text-align: center;
  339. display: inline-block;
  340. line-height: 48rpx;
  341. border-radius: 11rpx;
  342. font-size: 26rpx;
  343. font-weight: bold;
  344. color: #111;
  345. margin-right: 16rpx;
  346. }
  347. .t1 {
  348. background-color: #F0F8F6;
  349. color: #007A69;
  350. }
  351. .t2 {
  352. background-color: #E8EFFD;
  353. color: #326EE0;
  354. }
  355. .personInfo {
  356. flex: 1;
  357. .name {
  358. font-size: 30rpx;
  359. color: #111;
  360. margin-bottom: 16rpx;
  361. }
  362. .code {
  363. color: #666;
  364. font-size: 28rpx;
  365. }
  366. }
  367. }
  368. }
  369. </style>