verification.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="verification">
  3. <view class="nav">
  4. <!-- 搜索栏 -->
  5. <view class="navbox">
  6. <view class="search">
  7. <u-input placeholderStyle='color:#999' placeholder="搜索" border='none' v-model="search" @input="searchText">
  8. <template slot="suffix" style='margin-right:40rpx;'>
  9. <u-image :showLoading="true" :showError='true' src="/static/icon/search.png" width="40rpx"
  10. height="32rpx"></u-image>
  11. </template>
  12. </u-input>
  13. </view>
  14. <view>
  15. <image src="/static/icon/scan.png" style="width: 48rpx ;height: 48rpx;" @click="scanCode"></image>
  16. </view>
  17. </view>
  18. <!-- 分段器 -->
  19. <view class="segmented">
  20. <view class="tab_nav">
  21. <view class="navTitle" v-for="(item,index) in items" :key="index">
  22. <view :class="{'active':isActive == index}" @click="checked(index)">
  23. {{item}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 占位 -->
  30. <view style="width: 100%;height: 216rpx;"></view>
  31. <view class="msg-null" v-if="orderList.length == 0 ">
  32. <image src="https://t9.9026.com/imgs/dataNull.png" style="width: 394rpx;height: 396rpx;" mode=""></image>
  33. <view class="msg-null-text">
  34. <text>暂无数据</text>
  35. </view>
  36. </view>
  37. <view v-if="orderList.length > 0 " style="background-color: #f9f9f9;">
  38. <view class="card" v-for="(item,index) in orderList" :key="index" @click="goOrderDetail(item.order_no)" >
  39. <view class="toptitle">
  40. <view>{{item.hotel.name}}</view>
  41. <view v-if="item.status == 3">未核销</view>
  42. <view v-if="item.status == 4">已核销</view>
  43. </view>
  44. <view class="shopCard">
  45. <image v-if="item.product_type != 3 " :src="JSON.parse(item.img_urls)[0]"></image>
  46. <image v-if="item.product_type == 3 " :src="item.img_urls"></image>
  47. <view style="margin-left: 24rpx;">
  48. <text class="name">{{item.product_name}}</text>
  49. <!-- <text class="tag" v-if="item.source_type == 3" >{{item.integral}}积分</text> -->
  50. <text class="tag" v-if="item.source_type == 3">{{item.attr_text}} {{item.integral}}积分</text>
  51. </view>
  52. </view>
  53. <view class="points" v-if="item.source_type == 3" >
  54. <text class="totalName">共计:</text>
  55. <text class="totalContent">{{item.integral}}积分</text>
  56. </view>
  57. <view class="btn" @click.stop="goOrderVF(item.order_no)" v-if="item.status == 3">
  58. <text>核销</text>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 已经到底啦 -->
  63. <view style="margin-top: 88rpx;padding-bottom: 60rpx;" v-if="orderList.length > 0 ">
  64. <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText"/>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import util from './../../../utils/util.js'
  70. export default{
  71. data(){
  72. return{
  73. hotelName:'',
  74. // 搜索
  75. search:'',
  76. // 分段器标题
  77. items: ['未核销', '已核销', '我的'],
  78. isActive: 0,
  79. contentText: {
  80. contentdown: '查看更多',
  81. contentrefresh: '加载中',
  82. contentnomore: '—— 已经到底啦 ——'
  83. },
  84. // 订单列表
  85. orderList:[],
  86. // 分页
  87. page: 1,
  88. pagesize: 15,
  89. totalElements: '',
  90. allListItem: '',
  91. // 组件uni-load-more
  92. status: 'noMore',
  93. //当前页条数
  94. allTotal:'',
  95. }
  96. },
  97. onLoad(o) {
  98. if(o.type == 2){
  99. let type = parseInt(o.type)
  100. this.checked(type)
  101. }else{
  102. this.getMyOrder(1)
  103. }
  104. },
  105. // 触底加载
  106. onReachBottom() {
  107. // 触底的时候请求数据,即为上拉加载更多
  108. this.allTotal = this.page * this.pagesize
  109. console.log(this.allTotal,'----allTotal');
  110. //this.page为加载次数,this.pagesize为每一次加载的数据条数
  111. if (this.allTotal < this.totalElements) {
  112. //this.totalElements为请求数据的总条数。只要现有条数小于总条数就就执行一下代码
  113. this.allListItem = false;
  114. this.page++;
  115. //加载次数递加
  116. this.status = "loading"
  117. this.$api.orders.getOrderList({ //请求更多数据列表
  118. page: this.page,
  119. confirm_status:this.isActive+1,
  120. keyword:this.search
  121. }).then(res => {
  122. let ret = [...this.orderList, ...res.data.data]
  123. this.orderList = ret
  124. console.log(ret)
  125. })
  126. } else {
  127. this.allListItem = true;
  128. console.log('已加载全部数据')
  129. this.status = "noMore"
  130. }
  131. },
  132. methods:{
  133. // 跳转订单详情
  134. goOrderDetail(order_no) {
  135. uni.navigateTo({
  136. url: '/pages/my/myorders/orderDetail?order_no=' + order_no
  137. })
  138. },
  139. // 获取订单列表
  140. getMyOrder(type){
  141. this.$api.orders.getOrderList({
  142. page:1,
  143. confirm_status:type||'',
  144. keyword:this.search
  145. }).then(res=>{
  146. console.log(res,type,"订单列表")
  147. if(res.code==0){
  148. this.orderList=res.data.data
  149. this.totalElements = res.data.total
  150. this.pagesize = res.data.per_page
  151. }
  152. })
  153. },
  154. //菜单index切换
  155. checked(index) {
  156. this.page = 1
  157. this.isActive = index
  158. this.getMyOrder(index+1)
  159. },
  160. // 搜索防抖
  161. searchText:util.debounce(function(){
  162. this.goSearch()
  163. },1000),
  164. // 搜索
  165. goSearch(){
  166. this.$api.orders.getOrderList({
  167. confirm_status:this.isActive+1,
  168. page:1,
  169. keyword:this.search
  170. }).then(res=>{
  171. console.log(res,"搜索活动项目列表")
  172. if(res.code==0){
  173. this.orderList=res.data.data
  174. this.totalElements = res.data.total
  175. this.pagesize = res.data.per_page
  176. }
  177. })
  178. },
  179. // 跳转核销订单
  180. goOrderVF(order_no){
  181. uni.navigateTo({
  182. url:'/pages/my/verification/orderVerification?order_no='+order_no
  183. })
  184. },
  185. // 扫码
  186. scanCode(){
  187. uni.scanCode({
  188. scanType: ['qrCode'],
  189. success: function (res) {
  190. console.log(res,'res');
  191. if(res.scanType == 'QR_CODE'){
  192. uni.redirectTo({
  193. url:'/pages/my/verification/orderVerification?order_no='+res.result
  194. })
  195. }
  196. // console.log(res);
  197. // console.log('条码类型:' + res.scanType);
  198. // console.log('条码内容:' + res.result);
  199. },
  200. fail:function(res){
  201. uni.showToast({
  202. icon:'none',
  203. title:'扫码识别失败'
  204. })
  205. }
  206. });
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. $pageColor:#F9F9F9;
  213. $bgColor:#FFFFFF;
  214. // flex布局居中对齐
  215. @mixin flexlayout {
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. }
  220. .verification {
  221. height: 100%;
  222. background: $pageColor;
  223. }
  224. .msg-null{
  225. padding-top: 60rpx;
  226. display: flex;
  227. flex-direction: column;
  228. align-items: center;
  229. justify-content: center;
  230. .msg-null-text{
  231. margin-top: 40rpx;
  232. font-size: 28rpx;
  233. color: #333;
  234. }
  235. }
  236. .nav {
  237. position: fixed;
  238. top: 0;
  239. z-index: 999;
  240. height: 216rpx;
  241. width: 750rpx;
  242. background: $bgColor;
  243. box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  244. border-radius: 0px 0px 16rpx 16rpx;
  245. .navbox {
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. padding: 0 30rpx;
  250. box-sizing: border-box;
  251. margin-bottom: 15rpx;
  252. // 搜索
  253. .search {
  254. height: 124rpx;
  255. width: 614rpx;
  256. background-color: $bgColor;
  257. @include flexlayout;
  258. ::v-deep .u-input {
  259. width: 690rpx !important;
  260. height: 68rpx !important;
  261. background: #F1F1F1;
  262. border-radius: 74rpx;
  263. }
  264. ::v-deep .u-input__content__field-wrapper {
  265. padding-left: 36rpx;
  266. }
  267. ::v-deep .u-input__content__field-wrapper__field{
  268. color:#999999 !important;
  269. font-size: 28rpx !important;
  270. }
  271. }
  272. }
  273. .segmented {
  274. width: 750rpx;
  275. box-sizing: border-box;
  276. //菜单切换
  277. .tab_nav {
  278. width: 750rpx;
  279. display: flex;
  280. justify-content: space-between;
  281. align-items: center;
  282. padding:0 30rpx;
  283. font-family: PingFang-SC-Heavy, PingFang-SC;
  284. }
  285. .tab_nav .navTitle {
  286. @include flexlayout()
  287. width: 128rpx;
  288. flex: none;
  289. height: 28rpx;
  290. font-size: 32rpx;
  291. color: #666;
  292. position: relative;
  293. }
  294. .active {
  295. color: #D9A94D;
  296. font-weight: bold;
  297. box-sizing: border-box;
  298. &::after {
  299. display: inline-block;
  300. content: '';
  301. width: 48rpx;
  302. height: 12rpx;
  303. background: linear-gradient(90deg, #F3D69F 0%, #D9A94D 100%);
  304. border-radius: 6px;
  305. position: absolute;
  306. bottom: -28rpx;
  307. left: 42rpx;
  308. }
  309. }
  310. }
  311. }
  312. .card{
  313. margin-top: 24rpx;
  314. // width: 750rpx;
  315. // height: 426rpx;
  316. background: $bgColor;
  317. border-radius: 16rpx;
  318. padding:32rpx 28rpx 24rpx 28rpx;
  319. box-sizing: border-box;
  320. .toptitle{
  321. display: flex;
  322. justify-content: space-between;
  323. align-items: center;
  324. font-size: 28rpx;
  325. font-family: PingFang-SC-Bold, PingFang-SC;
  326. font-weight: bold;
  327. color: #080F18;
  328. }
  329. .shopCard{
  330. margin-top: 28rpx;
  331. width: 694rpx;
  332. height: 164rpx;
  333. background: #F4F5F6;
  334. border-radius: 10rpx;
  335. display: flex;
  336. align-items: center;
  337. image{
  338. width: 132rpx;
  339. height: 132rpx;
  340. margin-left: 16rpx;
  341. display: inline-block;
  342. border-radius: 12rpx;
  343. }
  344. .name{
  345. font-size: 28rpx;
  346. font-family: PingFangSC-Medium, PingFang SC;
  347. font-weight: 500;
  348. color: #080F18;
  349. display: block;
  350. }
  351. .tag{
  352. font-size: 24rpx;
  353. font-family: PingFang-SC-Medium, PingFang-SC;
  354. font-weight: 500;
  355. color: #666666;
  356. }
  357. }
  358. .points{
  359. display: flex;
  360. justify-content: flex-end;
  361. align-items: center;
  362. margin-top: 30rpx;
  363. .totalName{
  364. font-size: 22rpx;
  365. font-family: PingFang-SC-Medium, PingFang-SC;
  366. font-weight: 500;
  367. color: #080F18;
  368. margin-right: 10rpx;
  369. }
  370. .totalContent{
  371. font-size: 30rpx;
  372. font-family: PingFang-SC-Heavy, PingFang-SC;
  373. font-weight: 800;
  374. color: #080F18;
  375. }
  376. }
  377. .btn{
  378. width: 170rpx;
  379. height: 60rpx;
  380. background: #FFFFFF;
  381. border-radius: 30rpx;
  382. border: 2rpx solid #D0D0D0;
  383. margin-left: 524rpx;
  384. margin-top: 15rpx;
  385. @include flexlayout()
  386. text{
  387. font-size: 26rpx;
  388. font-family: PingFang-SC-Medium, PingFang-SC;
  389. font-weight: 500;
  390. color: #080F18;
  391. }
  392. }
  393. }
  394. .home-bottom {
  395. padding-top: 80rpx;
  396. background-color: #f9f9f9;
  397. }
  398. </style>