check.vue 7.5 KB

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