index.vue 8.3 KB

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