CheckoutStore.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="div container">
  3. <view class="div cart-item">
  4. <view class="div">
  5. <view class="div store">
  6. <text class="i iconfont">&#xe62d;</text>
  7. <text class="span">{{storeCartList.store_name}}</text>
  8. </view>
  9. <view class="div buy-item">
  10. <view class="div goods-pic"><image mode="aspectFit" class="img" :src="storeCartList.goods_image_url"/></view>
  11. <view class="div goods-info">
  12. <view class="dl">
  13. <view class="dt goods-name">{{storeCartList.goods_name}}</view>
  14. <view class="dd goods-subtotal">
  15. <text class="span goods-price">¥{{storeCartList.goods_price}}</text><text v-if="storeCartList.goods_price<storeCartList.goods_original_price" class="span ml-5 goods-original-price">{{storeCartList.goods_original_price}}</text>
  16. <text class="span goods-count">×{{storeCartList.quantity}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="div cart-subtotal">
  23. <view class="div message">
  24. <view class="div field-line-right"><textarea class="order-message field-input" v-model="message" placeholder="店铺订单留言:" @change="changeMessage()" ></textarea></view>
  25. </view>
  26. <view class="div" v-if="storeCartList.store_voucher_list.length" @click="showPopup('voucherVisible')">
  27. <flex-line class="menu-item" :is-link="true" :show-border="true">
  28. <view class="div">
  29. <text class="span left-icon iconfont">&#xe6f2;</text>
  30. <text class="span">代金券</text>
  31. </view>
  32. <text class="span" slot="right">{{myVoucher}}</text>
  33. </flex-line>
  34. </view>
  35. <checkout-desc class="desc-item mt-5" title="商品金额" v-if="storeCartList.goods_discount_total>0" :subtitle="storeCartList.goods_original_total"></checkout-desc>
  36. <checkout-desc class="desc-item" title="优惠" v-if="storeCartList.goods_discount_total>0" :subtitle="storeCartList.goods_discount_total" :discount="true"></checkout-desc>
  37. <checkout-desc class="desc-item" title="本店合计" :subtitle="totalAmount"></checkout-desc>
  38. </view>
  39. <uni-popup background-color="#fff" ref="voucherVisible" type="right" >
  40. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  41. <view class="div common-header-wrap">
  42. <view :style="'height:'+navHeight+'px'"></view>
  43. <view class="common-header-holder"></view>
  44. <view class="common-header-fixed">
  45. <title-header />
  46. <uni-nav-bar title="代金券" class="common-header" left-icon="back" @clickLeft="hidePopup('voucherVisible')">
  47. <view class="div common-btn btn" slot="right" @click="selectVoucher('')">不使用</view>
  48. </uni-nav-bar>
  49. </view>
  50. </view>
  51. <view class="div common-popup-content">
  52. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  53. <view class="div common-voucher common-voucher02" :class="(item.voucher_state != 1)?'disable':''" v-for="(item,index) in storeCartList.store_voucher_list" :key="item.voucher_id" @click="selectVoucher(item)">
  54. <view class="div par"><view class="p">订单满{{item.voucher_limit}}元</view><text class="sub sign">¥</text><text class="span">{{item.voucher_price}}</text></view>
  55. <view class="div copy">有效期至<view class="p"><br>{{$moment.unix(item.voucher_enddate).format('YYYY.MM.DD')}}</view></view>
  56. <text class="i"></text>
  57. </view>
  58. </scroll-view>
  59. </view>
  60. </view>
  61. </uni-popup>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import TitleHeader from '../../../TitleHeader'
  67. import CheckoutDesc from './CheckoutDesc'
  68. import flexLine from '../../../flexLine'
  69. export default {
  70. name: 'CheckoutStore',
  71. data(){
  72. return {
  73. navHeight: 0,
  74. screenWidth:0,
  75. totalAmount: '',
  76. message: '',
  77. myVoucher: '',
  78. }
  79. },
  80. components:{
  81. TitleHeader,
  82. flexLine,
  83. CheckoutDesc
  84. },
  85. props: ['storeCartList'],
  86. created: function () {
  87. this.calcOrder()
  88. },
  89. mounted(){
  90. // #ifdef MP-WEIXIN
  91. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  92. // #endif
  93. this.screenWidth=uni.getSystemInfoSync().screenWidth
  94. },
  95. methods:{
  96. showPopup(id){
  97. this.$refs[id].open()
  98. },
  99. hidePopup(id){
  100. this.$refs[id].close()
  101. },
  102. changeMessage () {
  103. this.$emit('changeMessage', this.message)
  104. },
  105. selectVoucher (voucherInfo) {
  106. this.hidePopup('voucherVisible')
  107. this.$emit('selectVoucher', voucherInfo)
  108. this.storeCartList.store_voucher_info = voucherInfo
  109. this.calcOrder()
  110. },
  111. calcOrder () {
  112. let price = parseFloat(this.storeCartList.goods_total)
  113. if (this.storeCartList.store_voucher_list.length) {
  114. if (this.storeCartList.store_voucher_info) {
  115. price -= parseFloat(this.storeCartList.store_voucher_info.voucher_price)
  116. this.myVoucher = this.storeCartList.store_voucher_info.voucher_price + '元'
  117. } else {
  118. this.myVoucher = '不使用'
  119. }
  120. }
  121. if (price < 0) {
  122. price = 0
  123. }
  124. this.totalAmount = price
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped lang="scss">
  130. .common-header{
  131. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  132. }
  133. .container{background: #fff;padding:0 $pageSpace}
  134. .store{ position: relative;
  135. z-index: 1;
  136. display: block;
  137. height: 0.9rem;
  138. padding: 0.4rem 0;
  139. font-size:$subFontSize;
  140. line-height: 0.9rem;
  141. background: #fff;
  142. font-weight: 700;
  143. }
  144. .store .i{
  145. font-size: $h2;
  146. margin-right: 0.2rem;
  147. color:$primaryColor;
  148. }
  149. .cart-item{background-color: #FFF;
  150. border-bottom: solid 0.05rem #EEE;}
  151. .buy-item{ display: block;
  152. position: relative;
  153. z-index: 1;
  154. margin:.5rem 0;
  155. box-shadow: 0px 4px 4px #f7f7f7;
  156. }
  157. .buy-item .goods-pic{display: block;
  158. width: 3rem;
  159. height: 3rem;
  160. position: absolute;
  161. z-index: 1;
  162. top: 0rem;
  163. left: 0rem;
  164. }
  165. .buy-item .goods-pic .img{width:100%;
  166. height:100%;border-radius: 0.2rem;}
  167. .buy-item .goods-info{ display: block;
  168. vertical-align: top;
  169. height: 3.1rem;
  170. margin-left:4rem;
  171. position: relative;
  172. z-index: 1;}
  173. .buy-item .goods-info .goods-name {
  174. height:1.6rem;
  175. font-size:$subFontSize;
  176. line-height: .8rem;
  177. overflow: hidden;
  178. display: -webkit-box;
  179. -webkit-line-clamp: 2;
  180. -webkit-box-orient: vertical;
  181. line-clamp: 2;
  182. box-orient: vertical;
  183. margin-bottom:.5rem;
  184. font-weight: normal;
  185. .tag-icon{vertical-align: top}
  186. }
  187. .buy-item .goods-info .goods-type {
  188. overflow: hidden;
  189. white-space: nowrap;
  190. width: 70%;
  191. height: 0.9rem;
  192. font-size:$h6;
  193. line-height: 0.9rem;
  194. color: #999;
  195. text-overflow: ellipsis;
  196. }
  197. .buy-item .goods-info .goods-original-price{text-decoration: line-through;font-size:$fontSize;color:$descTextColor;font-weight: normal}
  198. .buy-item .goods-info .goods-subtotal {
  199. display: block;
  200. height: 1rem;
  201. margin: 0 0.4rem 0 0rem;
  202. line-height: 1rem;
  203. font-size:$subFontSize;
  204. position: relative;
  205. z-index: 1;
  206. }
  207. .buy-item .goods-info .goods-subtotal .goods-price {
  208. color: #DB4453;
  209. font-size:$subFontSize;
  210. font-weight: 600;
  211. }
  212. .buy-item .goods-info .goods-subtotal .goods-count {
  213. font-size:$subFontSize;
  214. line-height: 1rem;
  215. position: absolute;
  216. z-index: 1;
  217. top: 0rem;
  218. right: 0rem;
  219. font-weight: normal;
  220. color:$descTextColor
  221. }
  222. .cart-subtotal{}
  223. .cart-subtotal .dl {
  224. position: relative;
  225. z-index: 1;
  226. height: 1rem;
  227. padding: 0.4rem 0 0;
  228. font-size: 0;
  229. }
  230. .cart-subtotal .dt {
  231. position: absolute;
  232. z-index: 1;
  233. top: 0.4rem;
  234. left: 0.4rem;
  235. display: block;
  236. width: 50%;
  237. height: 1rem;
  238. font-size:$fontSize;
  239. line-height: 1rem;
  240. }
  241. .cart-subtotal .dd {
  242. height: 1rem;
  243. margin: 0 0.4rem 0 50%;
  244. text-align: right;
  245. font-size:$fontSize;
  246. line-height: 1rem;
  247. }
  248. .cart-subtotal .message {
  249. position: relative;
  250. z-index: 1;
  251. display: block;
  252. border-bottom: 1px dashed #eee;
  253. .order-message{
  254. background: #FBFBFB;
  255. margin:.5rem 0;
  256. font-size:$fontSize;
  257. padding:.5rem;
  258. height: 4rem;
  259. border: 0;
  260. box-sizing: border-box;
  261. width: 100%;
  262. }
  263. }
  264. .desc-item {
  265. height: 1.5rem;
  266. }
  267. .common-voucher{margin:0.5rem auto}
  268. .left-icon{float:left;font-size:$h1;margin-right:0.2rem;}
  269. .field-line-right{
  270. .field-input{
  271. text-align: left !important;
  272. }
  273. }
  274. </style>