verification.vue 8.4 KB

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