orderVerification.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="ordersVerification">
  3. <view style="height: 24rpx;width: 100%;background:#F9F9F9 ;"></view>
  4. <!-- 表单 -->
  5. <view class="form">
  6. <uni-forms ref="baseForm" :modelValue="FormData">
  7. <uni-forms-item label="收货人" labelWidth="150rpx">
  8. <uni-easyinput v-model="FormData.name" placeholder="请输入收货人" />
  9. </uni-forms-item>
  10. <uni-forms-item label="联系方式" labelWidth="150rpx">
  11. <uni-easyinput v-model="FormData.contact" placeholder="请输入联系方式" />
  12. </uni-forms-item>
  13. <uni-forms-item label="兑换时间" labelWidth="150rpx">
  14. <uni-easyinput v-model="FormData.date" placeholder="请输入兑换时间" />
  15. </uni-forms-item>
  16. </uni-forms>
  17. </view>
  18. <!-- 商品信息 -->
  19. <view class="card" >
  20. <view class="toptitle">
  21. <view>{{hotelName}}</view>
  22. <view v-if="items.status == 3">未核销</view>
  23. <view v-if="items.status == 4">已核销</view>
  24. </view>
  25. <view class="shopCard">
  26. <image style="border-radius: 12rpx;" :src="productImg[0]"></image>
  27. <view style="margin-left: 24rpx;">
  28. <text class="name">{{items.product_name}}</text>
  29. <text class="tag" v-if="items.source_type == 3"> {{items.integral}}积分</text>
  30. </view>
  31. </view>
  32. <view class="points" v-if="items.source_type == 3">
  33. <text class="totalName">共计:</text>
  34. <text class="totalContent">{{items.integral}}积分</text>
  35. </view>
  36. <view class="btn" >
  37. <text>核销</text>
  38. </view>
  39. </view>
  40. <!-- 核销订单按钮 -->
  41. <view class="bottombtn" @click="verificationOrder">
  42. <view class="btnitem">
  43. <text>核销订单</text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default{
  50. data(){
  51. return{
  52. //产品图片
  53. productImg:'',
  54. //酒店名称
  55. hotelName:'',
  56. //订单号
  57. order_no:'',
  58. //订单详情
  59. items:'',
  60. //订单id
  61. order_id:'',
  62. // 表单数据
  63. FormData:{
  64. name:'',
  65. contact:'',
  66. date:'',
  67. },
  68. }
  69. },
  70. onLoad(o) {
  71. if(o.order_no){
  72. this.order_no = o.order_no
  73. this.orderDetail()
  74. }
  75. },
  76. methods:{
  77. //订单详情
  78. orderDetail(){
  79. this.$api.orders.confirmOrderDetail({
  80. order_no:this.order_no
  81. }).then(res=>{
  82. if(res.code == 0){
  83. this.items = res.data
  84. this.FormData.name = res.data.receiver
  85. this.FormData.contact = res.data.phone
  86. this.FormData.date = res.data.created_at
  87. this.order_no = res.data.order_no
  88. this.productImg = JSON.parse(res.data.img_urls)
  89. //酒店详情
  90. this.hotelDetail(res.data.hotel_id)
  91. }else{
  92. uni.showToast({
  93. icon:'none',
  94. title:res.msg
  95. })
  96. setTimeout(()=>{
  97. uni.redirectTo({
  98. url:'/pages/my/verification/verification'
  99. })
  100. },500)
  101. }
  102. })
  103. },
  104. //酒店详情
  105. hotelDetail(id){
  106. this.$api.hotel.getHotelDetail({
  107. hotel_id:id
  108. }).then(res=>{
  109. this.hotelName = res.data.name
  110. })
  111. },
  112. // 核销订单
  113. verificationOrder(){
  114. let _this = this
  115. uni.showModal({
  116. title: '提示',
  117. content: '是否核销订单',
  118. cancelColor:'#333333',
  119. confirmColor:'#FF6200',
  120. success: function (res) {
  121. if (res.confirm) {
  122. _this.$api.orders.confirmOrder({
  123. order_no:_this.order_no
  124. }).then(res=>{
  125. if(res.code == 0){
  126. uni.showToast({
  127. icon:'none',
  128. title:'核销成功'
  129. })
  130. _this.orderDetail()
  131. setTimeout(()=>{
  132. uni.redirectTo({
  133. url:'/pages/my/verification/verification?type='+2
  134. })
  135. },500)
  136. }else{
  137. uni.showToast({
  138. icon:'none',
  139. title:res.msg
  140. })
  141. }
  142. })
  143. } else if (res.cancel) {
  144. console.log('用户点击取消');
  145. }
  146. }
  147. });
  148. },
  149. // // 选择兑换时间
  150. // bindDateChange: function(e) {
  151. // this.FormData.date=e.detail.value
  152. // },
  153. // 获取时间
  154. // getDate(type) {
  155. // const date = new Date();
  156. // let year = date.getFullYear();
  157. // let month = date.getMonth() + 1;
  158. // let day = date.getDate();
  159. // if (type === 'start') {
  160. // year = year - 60;
  161. // } else if (type === 'end') {
  162. // year = year + 2;
  163. // }
  164. // month = month > 9 ? month : '0' + month;
  165. // day = day > 9 ? day : '0' + day;
  166. // return `${year}-${month}-${day}`;
  167. // }
  168. },
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. $pageColor:#F9F9F9;
  173. $bgColor:#FFFFFF;
  174. // flex布局居中对齐
  175. @mixin flexlayout {
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. }
  180. .ordersVerification {
  181. height: 100%;
  182. background: $pageColor;
  183. }
  184. ::v-deep .uni-forms-item.is-direction-left{
  185. border-bottom: 2rpx solid #F0F0F0;
  186. }
  187. ::v-deep .uni-forms-item.is-direction-left:last-child{
  188. border-bottom: 0rpx solid #F0F0F0;
  189. }
  190. ::v-deep .is-input-border {
  191. border: none;
  192. }
  193. .form {
  194. width: 750rpx;
  195. height: 328rpx;
  196. background: $bgColor;
  197. border-radius: 16rpx;
  198. padding:10rpx 30rpx;
  199. box-sizing: border-box;
  200. }
  201. .card{
  202. margin-top: 24rpx;
  203. // width: 750rpx;
  204. // height: 426rpx;
  205. background: $bgColor;
  206. border-radius: 16rpx;
  207. padding:32rpx 28rpx 24rpx 28rpx;
  208. box-sizing: border-box;
  209. .toptitle{
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. font-size: 28rpx;
  214. font-family: PingFang-SC-Bold, PingFang-SC;
  215. font-weight: bold;
  216. color: #080F18;
  217. }
  218. .shopCard{
  219. margin-top: 28rpx;
  220. width: 694rpx;
  221. height: 164rpx;
  222. background: #F4F5F6;
  223. border-radius: 10rpx;
  224. display: flex;
  225. align-items: center;
  226. image{
  227. width: 132rpx;
  228. height: 132rpx;
  229. margin-left: 16rpx;
  230. display: inline-block;
  231. }
  232. .name{
  233. font-size: 28rpx;
  234. font-family: PingFangSC-Medium, PingFang SC;
  235. font-weight: 500;
  236. color: #080F18;
  237. display: block;
  238. }
  239. .tag{
  240. font-size: 24rpx;
  241. font-family: PingFang-SC-Medium, PingFang-SC;
  242. font-weight: 500;
  243. color: #666666;
  244. }
  245. }
  246. .points{
  247. display: flex;
  248. justify-content: flex-end;
  249. align-items: center;
  250. margin-top: 30rpx;
  251. .totalName{
  252. font-size: 22rpx;
  253. font-family: PingFang-SC-Medium, PingFang-SC;
  254. font-weight: 500;
  255. color: #080F18;
  256. margin-right: 10rpx;
  257. }
  258. .totalContent{
  259. font-size: 30rpx;
  260. font-family: PingFang-SC-Heavy, PingFang-SC;
  261. font-weight: 800;
  262. color: #080F18;
  263. }
  264. }
  265. .btn{
  266. width: 170rpx;
  267. height: 60rpx;
  268. background: #FFFFFF;
  269. border-radius: 30rpx;
  270. border: 2rpx solid #D0D0D0;
  271. margin-left: 524rpx;
  272. margin-top: 15rpx;
  273. @include flexlayout()
  274. text{
  275. font-size: 26rpx;
  276. font-family: PingFang-SC-Medium, PingFang-SC;
  277. font-weight: 500;
  278. color: #080F18;
  279. }
  280. }
  281. }
  282. .bottombtn{
  283. width: 690rpx;
  284. height: 92rpx;
  285. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  286. border-radius: 12rpx;
  287. margin-left: 30rpx;
  288. position: fixed;
  289. bottom: 72rpx;
  290. @include flexlayout()
  291. .btnitem{
  292. @include flexlayout()
  293. text{
  294. font-size: 30rpx;
  295. font-family: PingFang-SC-Bold, PingFang-SC;
  296. font-weight: bold;
  297. color: $bgColor;
  298. }
  299. }
  300. }
  301. .date{
  302. width: 545rpx;
  303. height: 74rpx;
  304. background: #FFFFFF;
  305. display: flex;
  306. align-items:center;
  307. padding-left: 20rpx;
  308. box-sizing: border-box;
  309. position: relative;
  310. }
  311. </style>