couponGoods.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="container">
  3. <view class="cate-nav">
  4. <view class="name">优惠券:{{ couponName }}</view>
  5. </view>
  6. <view class="cate-item">
  7. <view class="b">
  8. <navigator :class="'item ' + ((iindex + 1) % 2 == 0 ? 'item-b' : '')" :url="'/pages/goods/goods?id=' + iitem.id" v-for="(iitem, iindex) in goodsList" :key="iindex">
  9. <image class="img" :src="iitem.picUrl" background-size="cover"></image>
  10. <!-- <text wx:if="{{iitem.type=='2'}}">起</text> -->
  11. <!-- <view class="price">
  12. <view class="retailPrice">¥{{iitem.retailPrice}}</view>
  13. <view class="memberPrice">¥{{iitem.memberPrice}}</view>
  14. <view class="member-price-tag">会员价</view>
  15. </view>
  16. <text class="name">{{iitem.name}}</text> -->
  17. <view style="display: flex; margin-top: 10rpx; height: 71rpx">
  18. <!-- <image wx:if="{{iitem.activited}}"
  19. src="https://7a68-zhaijieshi-3guecm78383ca692-1307626841.tcb.qcloud.la/activity/618.png"
  20. style="width: 39px;height:16px;margin-right: 2px;" /> -->
  21. <text class="name">{{ iitem.name }}</text>
  22. </view>
  23. <view class="price">
  24. <!-- <view class="retailPrice">¥{{iitem.retailPrice}}</view>
  25. <view class="memberPrice">¥{{iitem.memberPrice}}</view>
  26. <view class="member-price-tag">会员价</view> -->
  27. <view v-if="iitem.activited" class="retailPrice">
  28. <text class="price-unit">¥</text>
  29. {{ iitem.activityPrice }}
  30. </view>
  31. <view v-else class="retailPrice">
  32. <text class="price-unit">¥</text>
  33. {{ iitem.retailPrice }}
  34. </view>
  35. <view v-if="iitem.activited || iitem.counterPrice != iitem.retailPrice" class="counterPrice">原价¥{{ iitem.counterPrice }}</view>
  36. </view>
  37. </navigator>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. var util = require('../../../utils/util.js');
  44. var api = require('../../../config/api.js');
  45. var user = require('../../../utils/user.js');
  46. export default {
  47. data() {
  48. return {
  49. couponName: '',
  50. goodsList: [],
  51. couponId: 0,
  52. addressInfo: {},
  53. code: '',
  54. iindex: 0,
  55. iitem: {
  56. id: '',
  57. picUrl: '',
  58. name: '',
  59. activited: '',
  60. counterPrice: '',
  61. retailPrice: ''
  62. }
  63. };
  64. }
  65. /**
  66. * 生命周期函数--监听页面加载
  67. */,
  68. onLoad: function (options) {
  69. if (options.id) {
  70. this.setData({
  71. couponId: options.id
  72. });
  73. }
  74. this.getGoodsList();
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {},
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function () {},
  84. /**
  85. * 生命周期函数--监听页面隐藏
  86. */
  87. onHide: function () {},
  88. /**
  89. * 生命周期函数--监听页面卸载
  90. */
  91. onUnload: function () {},
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh: function () {},
  96. /**
  97. * 页面上拉触底事件的处理函数
  98. */
  99. onReachBottom: function () {},
  100. /**
  101. * 用户点击右上角分享
  102. */
  103. onShareAppMessage: function () {},
  104. methods: {
  105. getGoodsList: function () {
  106. var that = this;
  107. util.request(api.GoodsCoupon, {
  108. couponId: that.couponId
  109. }).then(function (res) {
  110. that.setData({
  111. goodsList: res.data.list,
  112. couponName: res.data.couponName
  113. });
  114. //如果只有一个商品 直接跳转商详页
  115. if (res.data.list.length == 1) {
  116. uni.redirectTo({
  117. url: '/pages/goods/goods?id=' + res.data.list[0].id
  118. });
  119. }
  120. else if(res.data.list.length == 0){//表示全场通用,直接跳转到商品列表页
  121. uni.switchTab({
  122. url: '/pages/tabBar/catalog/catalog'
  123. });
  124. }
  125. });
  126. }
  127. }
  128. };
  129. </script>
  130. <style>
  131. .container {
  132. background: #f9f9f9;
  133. }
  134. .counterPrice {
  135. text-decoration: line-through;
  136. font-size: 24rpx;
  137. margin: 0 0 0 20rpx;
  138. color: #c7c7c7;
  139. }
  140. .cate-nav {
  141. text-align: center;
  142. z-index: 1000;
  143. padding: 20rpx 0;
  144. font-size: 32rpx;
  145. border-bottom: 2rpx solid #e4e4e4;
  146. }
  147. .price-unit {
  148. font-size: 23rpx;
  149. font-weight: 400;
  150. color: #202020;
  151. }
  152. .cate-nav-body {
  153. height: 84rpx;
  154. white-space: nowrap;
  155. background: #fff;
  156. border-top: 1px solid rgba(0, 0, 0, 0.15);
  157. overflow: hidden;
  158. }
  159. .cate-nav .item {
  160. display: inline-block;
  161. height: 84rpx;
  162. min-width: 130rpx;
  163. padding: 0 15rpx;
  164. }
  165. .cate-nav .item .name {
  166. display: block;
  167. height: 84rpx;
  168. padding: 0 20rpx;
  169. line-height: 84rpx;
  170. color: #333;
  171. font-size: 30rpx;
  172. width: auto;
  173. }
  174. .cate-nav .item.active .name {
  175. color: #09afff;
  176. border-bottom: 2px solid #09afff;
  177. }
  178. .cate-item {
  179. height: auto;
  180. overflow: hidden;
  181. }
  182. .cate-item .h {
  183. height: 145rpx;
  184. width: 750rpx;
  185. display: flex;
  186. flex-direction: column;
  187. align-items: center;
  188. justify-content: center;
  189. }
  190. .cate-item .h .name {
  191. display: block;
  192. height: 35rpx;
  193. margin-bottom: 18rpx;
  194. font-size: 30rpx;
  195. color: #333;
  196. }
  197. .cate-item .h .desc {
  198. display: block;
  199. height: 24rpx;
  200. font-size: 24rpx;
  201. color: #999;
  202. }
  203. .cate-item .b {
  204. width: 750rpx;
  205. padding: 0 6.25rpx;
  206. height: auto;
  207. overflow: hidden;
  208. }
  209. .cate-item .b .item {
  210. float: left;
  211. background: #fff;
  212. width: 342rpx;
  213. height: auto;
  214. overflow: hidden;
  215. padding: 15rpx;
  216. border-radius: 15rpx;
  217. margin: 16.5rpx 16.5rpx 8.5rpx 16.5rpx;
  218. }
  219. .cate-item .b .item-b {
  220. margin-left: 6.25rpx;
  221. }
  222. .cate-item .item .img {
  223. width: 362rpx;
  224. height: 362rpx;
  225. }
  226. .cate-item .b .item .mark {
  227. width: 122rpx;
  228. height: 100rpx;
  229. margin-top: -20rpx;
  230. margin-left: 0rpx;
  231. }
  232. .cate-item .item .name {
  233. display: block;
  234. width: 365.625rpx;
  235. margin: 0 0 5rpx 0;
  236. overflow: hidden;
  237. padding: 0 20rpx;
  238. font-size: 26rpx;
  239. color: #1c1c1c;
  240. line-height: 1.3em;
  241. padding-left: 0rpx;
  242. text-align: left;
  243. }
  244. .cate-item .item .brand {
  245. display: block;
  246. width: 365.625rpx;
  247. height: 22rpx;
  248. font-size: 22rpx;
  249. color: #ab956d;
  250. margin-top: 10rpx;
  251. margin-left: 22rpx;
  252. }
  253. .cate-item .item .price {
  254. height: 40rpx;
  255. display: flex;
  256. margin-top: 20rpx;
  257. align-items: flex-end;
  258. }
  259. .retailPrice {
  260. font-size: 30rpx;
  261. height: 30rpx;
  262. line-height: 30rpx;
  263. }
  264. .memberPrice {
  265. font-size: 22rpx;
  266. color: #dd483e;
  267. margin: 0 10rpx 0 20rpx;
  268. }
  269. .member-price-tag {
  270. width: 88rpx;
  271. height: 26rpx;
  272. line-height: 26rpx;
  273. background: url('https://mall.zhaijieshi.cc/file/jzmall/weixin/member/member-price-bg.png') no-repeat center center;
  274. background-size: 100% 100%;
  275. color: #5e3a11;
  276. font-size: 16rpx;
  277. padding: 0 8rpx 0 0;
  278. text-align: right;
  279. margin: 0 0 6rpx 0;
  280. }
  281. </style>