sellerCoupon.vue 9.6 KB

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