check.vue 7.5 KB

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