sellerCoupon.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template name="coupon">
  2. <view class="coupon-template">
  3. <view class="coupon-title" @tap.stop="showPopup">
  4. <text class="text">优惠券:</text>
  5. <text class="text-coupon">-¥{{ coupon.couponAmount | NumFormat }}</text>
  6. <text class="iconfont icon-xiayibu"></text>
  7. </view>
  8. <!-- 优惠券 -->
  9. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup">
  10. <view class="tui-popup-box clearfix">
  11. <view class="title">
  12. <view class="title-l">优惠券</view>
  13. <view class="title-r" @click="showExchangePopup">兑换优惠券</view>
  14. </view>
  15. <div class="tui-popup-main coupon">
  16. <scroll-view class="tui-popup-scroll" scroll-y="true">
  17. <view v-for="(coupon,index) in dataList" :key="index" class="coupon-list" @click.stop="checkedCoupon(index)">
  18. <view class="list-cell-le">
  19. <view class="coupon-maxMoney">
  20. <text class="small">¥</text>
  21. {{ coupon.couponAmount }}
  22. </view>
  23. <view class="coupon-minMoney">
  24. 满{{ coupon.touchPrice }}可用
  25. </view>
  26. </view>
  27. <view class="list-cell-ri">
  28. <view class="list-cell-top">
  29. <view class="list-cell-type">
  30. <view class="list-cell-tags">
  31. <text class="tags">{{ coupon.couponType | TypeFormat }}</text>
  32. </view>
  33. <view class="list-cell-texts">
  34. <text v-if="coupon.couponType == 0">
  35. {{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  36. </text>
  37. <text v-if="coupon.couponType == 1">
  38. {{ coupon.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  39. </text>
  40. <text v-if="coupon.couponType == 3">仅限购买店铺【{{ coupon.shopName }}】的商品</text>
  41. <text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
  42. </view>
  43. </view>
  44. <view class="list-cell-btn">
  45. <view class="list-cell-checkbox">
  46. <view class="checkbox iconfont"
  47. :class="[coupon.ischecked ?'icon-yixuanze':'icon-weixuanze']"
  48. >
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="list-cell-time">{{ coupon.startDate }} - {{ coupon.endDate }}</view>
  54. </view>
  55. </view>
  56. </scroll-view>
  57. </div>
  58. <view class="tui-right-flex tui-popup-btn">
  59. <view class="tui-flex-1">
  60. <view class="tui-button" @click="hidePopup">确定</view>
  61. </view>
  62. </view>
  63. </view>
  64. </tui-bottom-popup>
  65. </view>
  66. </template>
  67. <script>
  68. export default{
  69. name:"coupon",
  70. props:{
  71. couponList:{
  72. type:Array
  73. }
  74. },
  75. data() {
  76. return{
  77. popupShow:false,
  78. isIphoneX:this.$store.state.isIphoneX,
  79. checkedIndex:null,
  80. dataList:[],
  81. coupon:{
  82. couponAmount:0,
  83. clubCouponId:0,
  84. },
  85. }
  86. },
  87. filters:{
  88. NumFormat(value) {//处理金额
  89. return Number(value).toFixed(2);
  90. },
  91. TypeFormat(value) {
  92. switch (value) {
  93. case 0:
  94. return '活动券';
  95. break;
  96. case 1:
  97. return '品类券';
  98. break;
  99. case 2:
  100. return '用户专享券';
  101. break;
  102. case 3:
  103. return '店铺券';
  104. break;
  105. case 4:
  106. return '新用户券';
  107. break;
  108. }
  109. }
  110. },
  111. created(){
  112. this.initData(this.couponList)
  113. },
  114. computed: {
  115. },
  116. methods:{
  117. initData(data){
  118. data.forEach((el,index) => {
  119. this.dataList.push(Object.assign({},el,{ischecked:false}))
  120. })
  121. this.coupon.couponAmount = data[0].couponAmount
  122. this.dataList[0].ischecked = true
  123. },
  124. checkedCoupon(idx){// 选择优惠券
  125. this.checkedIndex = idx;
  126. this.dataList.forEach((el,index) => {
  127. if(this.checkedIndex == index){
  128. el.ischecked = !el.ischecked;
  129. }else{
  130. el.ischecked = false
  131. }
  132. })
  133. },
  134. showExchangePopup(){
  135. this.popupShow = false
  136. this.$parent.isExchangePopup = true
  137. },
  138. showPopup(){
  139. this.popupShow = true
  140. },
  141. hidePopup(){
  142. this.popupShow = false
  143. let coupon = {
  144. couponAmount:0,
  145. clubCouponId:0,
  146. };
  147. this.dataList.forEach((el,index) => {
  148. if(el.ischecked){
  149. coupon.couponAmount = el.couponAmount
  150. coupon.clubCouponId = el.clubCouponId
  151. }
  152. })
  153. this.coupon = coupon
  154. this.$emit('handleChoiceaCoupon',this.coupon);
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. .coupon-template{
  161. width: 100%;
  162. height: auto;
  163. background: #FFFFFF;
  164. float: left;
  165. margin-top: 24rpx;
  166. .coupon-title{
  167. width: 702rpx;
  168. padding: 0 24rpx;
  169. height: 88rpx;
  170. line-height: 88rpx;
  171. position: relative;
  172. .text{
  173. font-size: $font-size-28;
  174. color: $text-color;
  175. }
  176. .text-coupon{
  177. display: inline-block;
  178. float: right;
  179. padding-right: 30rpx;
  180. line-height: 88rpx;
  181. font-size: 28rpx;
  182. color: #f94b4b;
  183. }
  184. .iconfont{
  185. width: 50rpx;
  186. height: 88rpx;
  187. line-height: 88rpx;
  188. color: #999999;
  189. display: block;
  190. position: absolute;
  191. right: 0;
  192. top: 0;
  193. }
  194. }
  195. }
  196. .tui-popup-box {
  197. position: relative;
  198. box-sizing: border-box;
  199. min-height: 220rpx;
  200. padding:24rpx 24rpx 0 24rpx;
  201. .title{
  202. font-size: $font-size-34;
  203. color: $text-color;
  204. line-height: 88rpx;
  205. text-align: center;
  206. float: left;
  207. width: 100%;
  208. height: 88rpx;
  209. display: flex;
  210. box-sizing: border-box;
  211. padding: 0 24rpx;
  212. .title-l{
  213. flex: 1;
  214. text-align: left;
  215. }
  216. .title-r{
  217. flex: 1;
  218. text-align: right;
  219. color: #f94b4b;
  220. }
  221. }
  222. .tui-popup-main{
  223. width: 100%;
  224. float: left;
  225. padding-top: 10rpx;
  226. .tui-popup-scroll{
  227. width: 100%;
  228. height: 600rpx;
  229. .coupon-list{
  230. width: 100%;
  231. height: 200rpx;
  232. margin-bottom: 24rpx;
  233. box-sizing: border-box;
  234. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
  235. background-size: cover;
  236. .list-cell-le{
  237. width: 224rpx;
  238. height: 100%;
  239. box-sizing: border-box;
  240. padding: 37rpx 0;
  241. float: left;
  242. .coupon-maxMoney{
  243. width: 100%;
  244. height: 78rpx;
  245. line-height: 78rpx;
  246. font-size: 56rpx;
  247. color: #FFFFFF;
  248. text-align: center;
  249. .small{
  250. font-size: $font-size-24;
  251. }
  252. }
  253. .coupon-minMoney{
  254. width: 100%;
  255. height: 33rpx;
  256. line-height: 33rpx;
  257. font-size: $font-size-24;
  258. color: #FFFFFF;
  259. text-align: center;
  260. }
  261. }
  262. .list-cell-ri{
  263. width: 478rpx;
  264. height: 100%;
  265. box-sizing: border-box;
  266. padding: 20rpx 24rpx 0 24rpx;
  267. float: right;
  268. .list-cell-top{
  269. width: 100%;
  270. height: 121rpx;
  271. float: left;
  272. border-bottom: 1px solid #e1e1e1;
  273. .list-cell-type{
  274. width: 286rpx;
  275. height: 100%;
  276. float: left;
  277. .list-cell-tags{
  278. width: 100%;
  279. height: 32rpx;
  280. margin-bottom: 7rpx;
  281. .tags{
  282. display: inline-block;
  283. padding: 0 10rpx;
  284. height: 32rpx;
  285. line-height: 32rpx;
  286. background-color: #ffdcce;
  287. color: #f94b4b;
  288. font-size: $font-size-20;
  289. border-radius: 8rpx;
  290. text-align: center;
  291. float: left;
  292. }
  293. }
  294. .list-cell-texts{
  295. width: 100%;
  296. height: auto;
  297. line-height:35rpx;
  298. text-overflow:ellipsis;
  299. display: -webkit-box;
  300. word-break: break-all;
  301. -webkit-box-orient: vertical;
  302. -webkit-line-clamp: 2;
  303. overflow: hidden;
  304. font-size: 26rpx;
  305. color: #333333;
  306. }
  307. }
  308. .list-cell-btn{
  309. width: 128rpx;
  310. height: 100%;
  311. float: right;
  312. .list-cell-checkbox{
  313. width: 100%;
  314. height: 50%;
  315. .checkbox{
  316. width: 40rpx;
  317. line-height: 60rpx;
  318. float: right;
  319. box-sizing: border-box;
  320. text-align: center;
  321. text-decoration: none;
  322. -webkit-tap-highlight-color: transparent;
  323. overflow: hidden;
  324. color: #f94b4b;
  325. }
  326. }
  327. }
  328. }
  329. .list-cell-time{
  330. width: 100%;
  331. height: 58rpx;
  332. line-height: 58rpx;
  333. text-align: left;
  334. font-size: $font-size-20;
  335. color: #999999;
  336. }
  337. }
  338. }
  339. }
  340. .tui-popup-coupon{
  341. width: 100%;
  342. height: 500rpx;
  343. box-sizing: border-box;
  344. padding:30rpx 20rpx;
  345. .tui-popup-h1{
  346. width: 100%;
  347. height: 66rpx;
  348. display: flex;
  349. align-items: center;
  350. .tui-popup-text{
  351. flex: 1;
  352. height: 66rpx;
  353. line-height: 66rpx;
  354. font-size: $font-size-30;
  355. color: #333333;
  356. &.red{
  357. color: #f94b4b;
  358. }
  359. &.bold{
  360. font-weight: bold;
  361. }
  362. &.left{
  363. text-align: left;
  364. }
  365. &.right{
  366. text-align: right;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. .tui-popup-btn {
  373. width: 100%;
  374. height: auto;
  375. float: left;
  376. margin-top: 24rpx;
  377. .tui-button{
  378. width: 100%;
  379. height: 88rpx;
  380. background: $btn-confirm;
  381. line-height: 88rpx;
  382. text-align: center;
  383. color: #FFFFFF;
  384. font-size: $font-size-28;
  385. border-radius: 44rpx;
  386. }
  387. }
  388. }
  389. </style>