sellerCoupon.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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.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. },
  122. checkedCoupon(idx){// 选择优惠券
  123. this.checkedIndex = idx;
  124. this.dataList.forEach((el,index) => {
  125. if(this.checkedIndex == index){
  126. el.ischecked = !el.ischecked;
  127. }else{
  128. el.ischecked = false
  129. }
  130. })
  131. },
  132. showExchangePopup(){
  133. this.popupShow = false
  134. this.$parent.isExchangePopup = true
  135. },
  136. showPopup(){
  137. this.popupShow = true
  138. },
  139. hidePopup(){
  140. this.popupShow = false
  141. let coupon = {
  142. couponAmount:0,
  143. clubCouponId:0,
  144. };
  145. this.dataList.forEach((el,index) => {
  146. if(el.ischecked){
  147. coupon.couponAmount = el.couponAmount
  148. coupon.clubCouponId = el.clubCouponId
  149. }
  150. })
  151. this.coupon = coupon
  152. this.$emit('handleChoiceaCoupon',this.coupon);
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. .coupon-template{
  159. width: 100%;
  160. height: auto;
  161. background: #FFFFFF;
  162. float: left;
  163. margin-top: 24rpx;
  164. .coupon-title{
  165. width: 702rpx;
  166. padding: 0 24rpx;
  167. height: 88rpx;
  168. line-height: 88rpx;
  169. position: relative;
  170. .text{
  171. font-size: $font-size-28;
  172. color: $text-color;
  173. }
  174. .text-coupon{
  175. display: inline-block;
  176. float: right;
  177. padding-right: 30rpx;
  178. line-height: 88rpx;
  179. font-size: 28rpx;
  180. color: #f94b4b;
  181. }
  182. .iconfont{
  183. width: 50rpx;
  184. height: 88rpx;
  185. line-height: 88rpx;
  186. color: #999999;
  187. display: block;
  188. position: absolute;
  189. right: 0;
  190. top: 0;
  191. }
  192. }
  193. }
  194. .tui-popup-box {
  195. position: relative;
  196. box-sizing: border-box;
  197. min-height: 220rpx;
  198. padding:24rpx 24rpx 0 24rpx;
  199. .title{
  200. font-size: $font-size-34;
  201. color: $text-color;
  202. line-height: 88rpx;
  203. text-align: center;
  204. float: left;
  205. width: 100%;
  206. height: 88rpx;
  207. display: flex;
  208. box-sizing: border-box;
  209. padding: 0 24rpx;
  210. .title-l{
  211. flex: 1;
  212. text-align: left;
  213. }
  214. .title-r{
  215. flex: 1;
  216. text-align: right;
  217. color: #f94b4b;
  218. }
  219. }
  220. .tui-popup-main{
  221. width: 100%;
  222. float: left;
  223. padding-top: 10rpx;
  224. .tui-popup-scroll{
  225. width: 100%;
  226. height: 600rpx;
  227. .coupon-list{
  228. width: 100%;
  229. height: 200rpx;
  230. margin-bottom: 24rpx;
  231. box-sizing: border-box;
  232. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
  233. background-size: cover;
  234. .list-cell-le{
  235. width: 224rpx;
  236. height: 100%;
  237. box-sizing: border-box;
  238. padding: 37rpx 0;
  239. float: left;
  240. .coupon-maxMoney{
  241. width: 100%;
  242. height: 78rpx;
  243. line-height: 78rpx;
  244. font-size: 56rpx;
  245. color: #FFFFFF;
  246. text-align: center;
  247. .small{
  248. font-size: $font-size-24;
  249. }
  250. }
  251. .coupon-minMoney{
  252. width: 100%;
  253. height: 33rpx;
  254. line-height: 33rpx;
  255. font-size: $font-size-24;
  256. color: #FFFFFF;
  257. text-align: center;
  258. }
  259. }
  260. .list-cell-ri{
  261. width: 478rpx;
  262. height: 100%;
  263. box-sizing: border-box;
  264. padding: 20rpx 24rpx 0 24rpx;
  265. float: right;
  266. .list-cell-top{
  267. width: 100%;
  268. height: 121rpx;
  269. float: left;
  270. border-bottom: 1px solid #e1e1e1;
  271. .list-cell-type{
  272. width: 286rpx;
  273. height: 100%;
  274. float: left;
  275. .list-cell-tags{
  276. width: 100%;
  277. height: 32rpx;
  278. margin-bottom: 7rpx;
  279. .tags{
  280. display: inline-block;
  281. padding: 0 10rpx;
  282. height: 32rpx;
  283. line-height: 32rpx;
  284. background-color: #ffdcce;
  285. color: #f94b4b;
  286. font-size: $font-size-20;
  287. border-radius: 8rpx;
  288. text-align: center;
  289. float: left;
  290. }
  291. }
  292. .list-cell-texts{
  293. width: 100%;
  294. height: auto;
  295. line-height:35rpx;
  296. text-overflow:ellipsis;
  297. display: -webkit-box;
  298. word-break: break-all;
  299. -webkit-box-orient: vertical;
  300. -webkit-line-clamp: 2;
  301. overflow: hidden;
  302. font-size: 26rpx;
  303. color: #333333;
  304. }
  305. }
  306. .list-cell-btn{
  307. width: 128rpx;
  308. height: 100%;
  309. float: right;
  310. .list-cell-checkbox{
  311. width: 100%;
  312. height: 50%;
  313. .checkbox{
  314. width: 40rpx;
  315. line-height: 60rpx;
  316. float: right;
  317. box-sizing: border-box;
  318. text-align: center;
  319. text-decoration: none;
  320. -webkit-tap-highlight-color: transparent;
  321. overflow: hidden;
  322. color: #f94b4b;
  323. }
  324. }
  325. }
  326. }
  327. .list-cell-time{
  328. width: 100%;
  329. height: 58rpx;
  330. line-height: 58rpx;
  331. text-align: left;
  332. font-size: $font-size-20;
  333. color: #999999;
  334. }
  335. }
  336. }
  337. }
  338. .tui-popup-coupon{
  339. width: 100%;
  340. height: 500rpx;
  341. box-sizing: border-box;
  342. padding:30rpx 20rpx;
  343. .tui-popup-h1{
  344. width: 100%;
  345. height: 66rpx;
  346. display: flex;
  347. align-items: center;
  348. .tui-popup-text{
  349. flex: 1;
  350. height: 66rpx;
  351. line-height: 66rpx;
  352. font-size: $font-size-30;
  353. color: #333333;
  354. &.red{
  355. color: #f94b4b;
  356. }
  357. &.bold{
  358. font-weight: bold;
  359. }
  360. &.left{
  361. text-align: left;
  362. }
  363. &.right{
  364. text-align: right;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .tui-popup-btn {
  371. width: 100%;
  372. height: auto;
  373. float: left;
  374. margin-top: 24rpx;
  375. .tui-button{
  376. width: 100%;
  377. height: 88rpx;
  378. background: $btn-confirm;
  379. line-height: 88rpx;
  380. text-align: center;
  381. color: #FFFFFF;
  382. font-size: $font-size-28;
  383. border-radius: 44rpx;
  384. }
  385. }
  386. }
  387. </style>