verification.vue 8.2 KB

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