index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view>
  3. <block v-if="bargain.length>0">
  4. <div class="bargain-record" ref="container">
  5. <div class="item" v-for="(item, index) in bargain" :key="index">
  6. <div class="picTxt acea-row row-between-wrapper">
  7. <div class="pictrue">
  8. <image :src="item.product.image" />
  9. </div>
  10. <div class="text acea-row row-column-around">
  11. <div class="line1" style="width: 100%;">{{ item.product.store_name }}</div>
  12. <count-down :justify-left="'justify-content:left'" :is-day="true" :tip-text="'倒计时 '" :day-text="' 天 '" :hour-text="' 时 '" :minute-text="' 分 '"
  13. :second-text="' 秒'" :datatime="item.stop_time" v-if="item.status === 1" :id="item.product_assist_set_id"></count-down>
  14. <view class='money font-color'>
  15. 助力价: ¥
  16. <text class='num'>{{item.assistSku[0].assist_price}}</text>
  17. </view>
  18. </div>
  19. </div>
  20. <div class="bottom acea-row row-between-wrapper">
  21. <div class="purple" v-if="item.status === 1 || item.status === 0">活动进行中</div>
  22. <div class="success" v-if="item.status === 10 || item.status === 20">助力成功</div>
  23. <div class="end" v-if="item.status === -1">活动已结束</div>
  24. <div class="acea-row row-middle row-right">
  25. <div v-if="item.status === 1 || item.status === 0">
  26. <div class="bnt cancel" @click="getBargainUserCancel(item.product_assist_set_id)">
  27. 取消活动
  28. </div>
  29. <div class="bnt bg-color-red" @click="getInvitation(item.product_assist_set_id)">
  30. 邀请助力
  31. </div>
  32. </div>
  33. <div v-if="item.status === 10 || item.status === 20">
  34. <view v-if="(item.order.paid == 0 || item.order.paid == 1) && item.status === 20"class="bnt bg-color-red" @click="goOrderDetail(item.order)">查看详情</view>
  35. <view v-else class="bnt bg-color-red" @click="goPay(item)">立即付款</view>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <Loading :loaded="status" :loading="loadingList"></Loading>
  41. </div>
  42. </block>
  43. <block v-if="bargain.length == 0">
  44. <emptyPage title="暂无记录~"></emptyPage>
  45. </block>
  46. <home></home>
  47. </view>
  48. </template>
  49. <script>
  50. import CountDown from "@/components/countDown";
  51. import emptyPage from '@/components/emptyPage.vue'
  52. import {
  53. getBargainUserList,
  54. getBargainUserCancel
  55. } from "@/api/activity";
  56. import {
  57. postCartAdd
  58. } from '../../../api/store.js';
  59. import Loading from "@/components/Loading";
  60. import home from '@/components/home';
  61. export default {
  62. name: "BargainRecord",
  63. components: {
  64. CountDown,
  65. Loading,
  66. emptyPage,
  67. home
  68. },
  69. props: {},
  70. data: function() {
  71. return {
  72. bargain: [],
  73. status: false, //助力列表是否获取完成 false 未完成 true 完成
  74. loadingList: false, //当前接口是否请求完成 false 完成 true 未完成
  75. page: 1, //页码
  76. limit: 20, //数量
  77. };
  78. },
  79. onLoad: function() {
  80. this.getBargainUserList();
  81. },
  82. onReady() {
  83. uni.$once('endTime',(data)=>{
  84. this.bargain.forEach((el,index)=>{
  85. if(el.product_assist_set_id == data){
  86. el.status = -1
  87. }
  88. })
  89. })
  90. },
  91. methods: {
  92. goDetail: function(id) {
  93. uni.navigateTo({
  94. url: `/pages/activity/assist_detail/index?id=${id}`
  95. })
  96. },
  97. getBargainUserList: function() {
  98. var that = this;
  99. if (that.loadingList) return;
  100. if (that.status) return;
  101. getBargainUserList({
  102. page: that.page,
  103. limit: that.limit
  104. })
  105. .then(res => {
  106. that.status = res.data.list.length < that.limit;
  107. that.bargain.push.apply(that.bargain, res.data.list);
  108. that.page++;
  109. that.loadingList = false;
  110. })
  111. .catch(res => {
  112. that.$util.Tips({
  113. title: res
  114. })
  115. });
  116. },
  117. // 立即购买
  118. goPay: function(item) { //立即支付
  119. var that = this;
  120. var data = {
  121. product_id : item.product_assist_set_id,
  122. product_attr_unique: item.assistSku[0].unique,
  123. cart_num: 1,
  124. product_type: 3,
  125. is_new: 1
  126. };
  127. postCartAdd(data).then(res => {
  128. uni.navigateTo({
  129. url: '/pages/users/order_confirm/index?new=1&cartId=' + res.data.cart_id
  130. });
  131. }).catch(err => {
  132. return that.$util.Tips({title:err})
  133. });
  134. },
  135. // 邀请助力
  136. getInvitation: function(id){
  137. uni.navigateTo({
  138. url: '/pages/activity/assist_detail/index?id=' + id
  139. });
  140. },
  141. // 查看详情
  142. goOrderDetail: function(order) {
  143. if(order.paid == 1){
  144. uni.navigateTo({
  145. url: '/pages/order_details/index?order_id='+order.order_id,
  146. })
  147. }else{
  148. uni.navigateTo({
  149. url: '/pages/order_details/stay?order_id='+order.group_order_id,
  150. })
  151. }
  152. },
  153. // 取消
  154. getBargainUserCancel: function(id) {
  155. var that = this;
  156. getBargainUserCancel(id)
  157. .then(res => {
  158. that.status = false;
  159. that.loadingList = false;
  160. that.page = 1;
  161. that.$util.Tips({
  162. title: res.message
  163. })
  164. setTimeout(function(){
  165. that.bargain = [];
  166. that.getBargainUserList();
  167. },3000)
  168. })
  169. .catch(res => {
  170. that.$util.Tips({
  171. title: res
  172. })
  173. });
  174. },
  175. },
  176. onReachBottom() {
  177. this.getBargainUserList();
  178. }
  179. };
  180. </script>
  181. <style lang="scss">
  182. /*助力记录*/
  183. .bargain-record .item .picTxt .text .time .styleAll {
  184. color: #fc4141;
  185. font-size:24rpx;
  186. }
  187. .bargain-record .item .picTxt .text .time .red {
  188. color: #999;
  189. font-size:24rpx;
  190. }
  191. .bargain-record .item {
  192. background-color: #fff;
  193. margin-bottom: 12upx;
  194. }
  195. .bargain-record .item .picTxt {
  196. height: 210upx;
  197. border-bottom: 1px solid #f0f0f0;
  198. padding: 0 30upx;
  199. }
  200. .bargain-record .item .picTxt .pictrue {
  201. width: 150upx;
  202. height: 150upx;
  203. }
  204. .bargain-record .item .picTxt .pictrue image {
  205. width: 100%;
  206. height: 100%;
  207. border-radius: 6upx;
  208. }
  209. .bargain-record .item .picTxt .text {
  210. width: 515upx;
  211. font-size: 30upx;
  212. color: #282828;
  213. height: 150upx;
  214. }
  215. .bargain-record .item .picTxt .text .time {
  216. font-size: 24upx;
  217. color: #868686;
  218. justify-content: left !important;
  219. }
  220. .bargain-record .item .picTxt .text .successTxt{
  221. font-size:24rpx;
  222. }
  223. .bargain-record .item .picTxt .text .endTxt{
  224. font-size:24rpx;
  225. color: #999;
  226. }
  227. .bargain-record .item .picTxt .text .money {
  228. font-size: 24upx;
  229. }
  230. .bargain-record .item .picTxt .text .money .num {
  231. font-size: 32upx;
  232. font-weight: bold;
  233. }
  234. .bargain-record .item .picTxt .text .money .symbol {
  235. font-weight: bold;
  236. }
  237. .bargain-record .item .bottom {
  238. height: 100upx;
  239. padding: 0 30upx;
  240. font-size: 27upx;
  241. }
  242. .bargain-record .item .bottom .purple {
  243. color: #f78513;
  244. }
  245. .bargain-record .item .bottom .end {
  246. color: #999;
  247. }
  248. .bargain-record .item .bottom .success {
  249. color: #e93323;
  250. }
  251. .bargain-record .item .bottom .bnt {
  252. font-size: 27upx;
  253. color: #fff;
  254. width: 176upx;
  255. height: 60upx;
  256. border-radius: 32upx;
  257. text-align: center;
  258. line-height: 60upx;
  259. display: inline-block;
  260. }
  261. .bargain-record .item .bottom .bnt.cancel {
  262. color: #aaa;
  263. border: 1px solid #ddd;
  264. }
  265. .bargain-record .item .bottom .bnt~.bnt {
  266. margin-left: 18upx;
  267. }
  268. </style>