details.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="details">
  3. <view class="top"></view>
  4. <view class="head">
  5. <span class="cuIcon-back" @click="back"></span>
  6. <view class="case">
  7. 服务核销
  8. </view>
  9. </view>
  10. <view class="content">
  11. <view class="product">
  12. <view class="img">
  13. <image :src="product.productImage" mode=""></image>
  14. </view>
  15. <view class="name">
  16. {{product.productName}}
  17. <view class="price">
  18. <span>¥</span>{{product.orderPrice}} <span>/份</span>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="foot">
  24. <view class="btn" @click="verify">
  25. 确认消费
  26. </view>
  27. </view>
  28. <view class="popup " v-if="isSuccess">
  29. <view class="content">
  30. <view class="title">
  31. <span>消费成功</span>
  32. </view>
  33. <view class="center">
  34. <image src="/static/index/close.png" mode=""></image>
  35. <span>消费成功!</span>
  36. </view>
  37. <view class="btn" @click="goIndex">
  38. 确定
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. isSuccess: false,
  49. product:null,
  50. merchantId:''
  51. }
  52. },
  53. methods:{
  54. //返回
  55. back() {
  56. uni.navigateBack({
  57. delta: 1
  58. });
  59. },
  60. verify(){
  61. // this.isSuccess = true
  62. let data = {
  63. merchantId:this.merchantId,
  64. voucherCode:this.product.voucherCode
  65. }
  66. this.$http.post("app/writeOff/add",data).then(res => {
  67. if (res.data.code == 200) {
  68. console.log(res)
  69. this.isSuccess = true
  70. }else{
  71. uni.showToast({
  72. title: res.data.message,
  73. icon:'none'
  74. });
  75. }
  76. })
  77. },
  78. goIndex(){
  79. this.isSuccess = false
  80. uni.switchTab({
  81. url:'/pages/index/index'
  82. })
  83. }
  84. },
  85. onLoad(options) {
  86. this.product =JSON.parse(decodeURIComponent(options.params))
  87. console.log(this.product )
  88. },
  89. onShow() {
  90. let that = this
  91. uni.getStorage({
  92. key: 'login_user_info',
  93. success: function(res) {
  94. that.merchantId = res.data.merchantId
  95. }
  96. })
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .details {
  102. width: 100vw;
  103. height: 100vh;
  104. background: #F7F8FC;
  105. /*#ifdef APP-PLUS*/
  106. .top {
  107. width: 100%;
  108. background: linear-gradient(90deg, #E6FFFF 0%, #CEF7FF 40%, #A3CEFE 73%, #BCD6FF 100%), linear-gradient(0, #F7F8FC 0%, rgba(255, 255, 255, 0) 100%);
  109. height: var(--status-bar-height);
  110. }
  111. /*#endif*/
  112. .head {
  113. width: 100%;
  114. height: 112rpx;
  115. padding: 20rpx;
  116. display: flex;
  117. align-items: center;
  118. background: #fff;
  119. position: relative;
  120. .cuIcon-back {
  121. font-size: 40rpx;
  122. margin-right: 40rpx;
  123. }
  124. .case {
  125. position: absolute;
  126. left: 50%;
  127. transform: translateX(-50%);
  128. font-size: 36rpx;
  129. font-weight: 600;
  130. }
  131. }
  132. .content {
  133. width: 100%;
  134. margin-top: 24rpx;
  135. padding: 24rpx;
  136. .product {
  137. background-color: #fff;
  138. display: flex;
  139. margin-bottom: 20rpx;
  140. padding: 20rpx 16rpx;
  141. border-radius: 16rpx;
  142. .img {
  143. width: 132rpx;
  144. height: 132rpx;
  145. border-radius: 12rpx;
  146. overflow: hidden;
  147. margin-right: 16rpx;
  148. image {
  149. width: 132rpx;
  150. height: 132rpx;
  151. }
  152. }
  153. .name {
  154. flex: 1;
  155. display: flex;
  156. flex-direction: column;
  157. justify-content: space-between;
  158. font-size: 30rpx;
  159. color: #000000;
  160. line-height: 35rpx;
  161. font-weight: 600;
  162. .price {
  163. font-size: 28rpx;
  164. color: #FF6A42;
  165. span{
  166. font-size: 24rpx
  167. }
  168. }
  169. }
  170. }
  171. }
  172. .foot {
  173. width: 100%;
  174. height: 112rpx;
  175. position: fixed;
  176. bottom: 0;
  177. border-top: 1px solid #eeeeee;
  178. padding: 16rpx 24rpx 20rpx;
  179. .btn {
  180. width: 100%;
  181. height: 76rpx;
  182. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  183. border-radius: 53rpx;
  184. font-size: 28rpx;
  185. color: #FFFFFF;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. }
  190. }
  191. .popup {
  192. width: 100vw;
  193. height: 100vh;
  194. position: fixed;
  195. top: 0;
  196. left: 0;
  197. background: rgba(0, 0, 0, 0.4);
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. .content {
  202. width: 570rpx;
  203. background: #FFFFFF;
  204. border-radius: 16rpx;
  205. padding: 0px 24rpx;
  206. padding-bottom: 16rpx;
  207. .title {
  208. width: 100%;
  209. height: 86rpx;
  210. font-size: 32rpx;
  211. color: #333333;
  212. font-weight: 600;
  213. border-bottom: 1px solid #EEEEEE;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. }
  218. .center {
  219. font-size: 30rpx;
  220. color: #333333;
  221. line-height: 35rpx;
  222. display: flex;
  223. flex-direction: column;
  224. align-items: center;
  225. justify-content: center;
  226. padding-top: 28rpx;
  227. border-bottom: 1px solid #EEEEEE;
  228. padding-bottom: 40rpx;
  229. margin-bottom: 16rpx;
  230. image {
  231. width: 100rpx;
  232. height: 100rpx;
  233. margin-bottom: 10rpx;
  234. }
  235. }
  236. .btn {
  237. width: 320rpx;
  238. height: 68rpx;
  239. border-radius: 66rpx;
  240. font-size: 28rpx;
  241. color: #FFFFFF;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. margin: 0rpx auto;
  246. background: #449AFF;
  247. }
  248. .close{
  249. }
  250. }
  251. }
  252. }
  253. </style>