check.vue 7.4 KB

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