activity.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033
  1. <template>
  2. <app-layout>
  3. <scroll-view @scrolltolower="getMore" :scroll-top="scrollTop" scroll-y @scroll="scroll"
  4. :style="{'height':`${windowHeight}px`}">
  5. <app-head v-if="getTheme" :theme="getTheme"></app-head>
  6. <!-- 团长信息 -->
  7. <view @click="toList" class="middleman dir-top-nowrap main-center">
  8. <view class="location t-omit">{{middleman.location}}</view>
  9. <view v-if="middleman.id > 0" class="middleman-info dir-left-nowrap">
  10. <image class="avatar" :src="middleman.avatar"></image>
  11. <view class="user-info">
  12. <view class="t-omit">{{middleman.name}} {{setting.middleman}} {{middleman.mobile}}</view>
  13. <view>
  14. <image class="icon" src="./../image/address.png"></image>
  15. <text>提货地址:{{middleman.province}}<text
  16. v-if="middleman.province != middleman.city">{{middleman.city}}</text>{{middleman.district}}{{middleman.detail}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view v-if="middleman.is_allow_change == 1" class="space">距离最近{{space}}</view>
  21. <image v-if="middleman.is_allow_change == 1" class="arrow-image"
  22. src="/static/image/icon/arrow-right-white.png"></image>
  23. </view>
  24. <!-- 团购活动状态 -->
  25. <view v-if="activity.time > 0" class="time dir-left-nowrap cross-center">
  26. <image class="icon" src="./../image/timeline.png"></image>
  27. <view>距离本次团购活动开始还有{{d}}天{{h}}时{{m}}分{{s}}秒</view>
  28. </view>
  29. <view v-if="activity.activity_status == 2" class="time">
  30. <text>团购已结束,下次记得早点来哦</text>
  31. </view>
  32. <view class="status-area" v-if="activity.activity_status == 1">
  33. <view class="status dir-top-nowrap main-center cross-center">
  34. <view v-if="activity.condition == 0" class="end-time">{{activity.end_at}}结束</view>
  35. <view v-else class="condition main-between">
  36. <view>
  37. <text v-if="activity.num - activity.condition_count > 0">还差<text
  38. class="end-time">{{activity.num - activity.condition_count}}</text>{{activity.condition == 1 ? '人':'件商品'}}</text>拼团成功
  39. </view>
  40. <view class="end-time">{{activity.end_at}}结束</view>
  41. </view>
  42. <!-- 进度条 -->
  43. <view class="progress" v-if="activity.condition > 0">
  44. <view :style="{'width': `${activity.rate}%`,'backgroundImage':`url(${bonusImg.progress})`}">
  45. </view>
  46. </view>
  47. <!-- 下单人数 -->
  48. <view class="main-center cross-center buy-user">
  49. <view class="user-list dir-right-nowrap">
  50. <image v-for="(item,index) in user_list" :key="index" class="avatar" :src="item.avatar">
  51. </image>
  52. </view>
  53. <view class="sales">
  54. <text>{{activity.user_num}}</text>
  55. 人已抢<text>{{activity.all_sales > activity.condition_count ? activity.all_sales : activity.condition_count}}</text>件
  56. </view>
  57. </view>
  58. <!-- 最新下单状态 -->
  59. <view v-if="user_list.length > 0" class="main-center cross-center new-buy">
  60. <image class="avatar" :src="user_list[user_list.length - 1].avatar"></image>
  61. <view>{{end_time}}参与团购</view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 商品 -->
  66. <view class="list">
  67. <view @click="toGoods(item)" class="goods dir-left-nowrap" v-for="item in list" :key="item.id">
  68. <view v-if="item.goods_stock === 0" class="out-dialog">
  69. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic">
  70. </image>
  71. </view>
  72. <image class="cover" mode='aspectFill' :src="item.cover_pic"></image>
  73. <view class="info">
  74. <view class="name t-omit-two">{{item.name}}</view>
  75. <view class="sale" :class="getTheme + '-m-text ' + getTheme +' '+getTheme+'-m-border'">
  76. <view style="position: relative">
  77. {{item.sales}}
  78. <view class="sale-bg" :class="getTheme + '-m-back ' + getTheme"></view>
  79. </view>
  80. <view class="stock">剩{{item.goods_stock}}{{item.goodsWarehouse.unit}}</view>
  81. </view>
  82. <view class="price" :class="getTheme + '-m-text ' + getTheme">¥{{item.min_price}}</view>
  83. <view class="cart" @click.stop="toBuy(item)"
  84. v-if="activity && activity.activity_status == 1 && item.goods_stock > 0">
  85. <app-cart-image src="/static/image/icon/cats.png" imageWidth="80rpx" imageHeight="80rpx"
  86. :theme="getTheme"></app-cart-image>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 购物车 -->
  92. <view @click="openCart(item)" v-if="showCart && cart.length > 0" class="bg">
  93. <view class="dialog cart-dialog" @click.stop="" style="padding: 0;">
  94. <view v-if="activity.full_price.length > 0" class="cart-discount main-center">
  95. <view :class="getTheme + '-m-text ' + getTheme" v-for="(item,index) in activity.full_price"
  96. :key="index">
  97. <view class="discount-bg" :class="getTheme + '-m-back ' + getTheme"></view><text
  98. v-if="index > 0">,</text>满{{item.full_price}}减{{item.reduce_price}}
  99. </view>
  100. </view>
  101. <view class="title main-between">
  102. <view>已选商品</view>
  103. <view class="dir-right-nowrap cross-center" @click.stop="clearAll">
  104. <view style="color: #999999">清空购物车</view>
  105. <image src="/static/image/icon/delete.png"></image>
  106. </view>
  107. </view>
  108. <view class="goods-list">
  109. <view v-if="item.num > 0 || item.num == ''" class="goods dir-left-nowrap"
  110. v-for="(item,index) in cart" :key="item.id">
  111. <image class="cover" mode='aspectFill' :src="item.pic_url"></image>
  112. <view class="info">
  113. <view class="name t-omit-two"
  114. :style="{'color': item.is_exist == 1 ? '#353535': '#999999'}">{{item.name}}</view>
  115. <view class="attr">
  116. <text class="attr-group" v-for="(attr,idx) in item.attr_list" :key="idx">
  117. {{attr.attr_group_name}}:{{attr.attr_name}}
  118. </text>
  119. </view>
  120. <view style="height: 60rpx"></view>
  121. <view class="price" v-if="item.is_exist == 1" :class="getTheme + '-m-text ' + getTheme">
  122. ¥{{item.price}}</view>
  123. <view class="price" v-else style="color: #353535">商品已失效</view>
  124. <view class="app-add-subtract dir-left-nowrap cross-center">
  125. <image class="app-icon" @click.stop="_calcValue(index,'minus')"
  126. :src="item.is_exist == 0 ? '/static/image/cart/unreducible.png' : '/static/image/icon/subtract.png'">
  127. </image>
  128. <view class="app-value">
  129. <input v-model="item.num" v-if="item.is_exist == 1" @blur.stop="_onBlur(index)"
  130. type="number">
  131. <view v-else>{{item.num}}</view>
  132. </view>
  133. <image class="app-icon" v-show="is_loading" @load="imgLoad"
  134. @click.stop="_calcValue(index,'plus')"
  135. :src="item.num >= 99 || item.is_exist == 0 ? '/static/image/cart/can-add.png' : '/static/image/icon/add-but.png'"
  136. :class="[ getTheme+ '-m-back', getTheme]"></image>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <view v-if="is_exist" class="discount main-center"
  142. style="background-color: #f0f0f0;color: #999999;">
  143. <view>{{is_exist}}件商品已失效</view>
  144. </view>
  145. <view class="cart-placeholder cart-list-placeholder" :class="{'again-placeholder': is_exist}">
  146. </view>
  147. </view>
  148. </view>
  149. <!-- 买家信息 -->
  150. <view id="input" v-if="cart.length > 0 && activity.activity_status == 1" class="input-info">
  151. <view class="input-item">
  152. <view class="input-label">手机号</view>
  153. <view class="input">
  154. <input placeholder-style="color:#999999" type="number" placeholder="请输入手机号" v-model="mobile">
  155. </view>
  156. </view>
  157. <view class="input-item" @click="inputRemark = false">
  158. <view class="input-label">备注</view>
  159. <view class="input" v-if="inputRemark" :style="{'color': remark ? '#353535': '#999999'}">
  160. {{remark ? remark : '请输入备注'}}
  161. </view>
  162. <view class="input" v-else>
  163. <input placeholder-style="color:#999999" :focus="!inputRemark" @blur="inputRemark = true"
  164. maxlength="50" v-model="remark" placeholder="请输入备注">
  165. </view>
  166. </view>
  167. </view>
  168. <!-- 结算栏 -->
  169. <view v-if="cart.length > 0 && activity.activity_status == 1 && activity.full_price.length > 0"
  170. class="discount main-center">
  171. <view :class="getTheme + '-m-text ' + getTheme" v-for="(item,index) in activity.full_price"
  172. :key="index">
  173. <view class="discount-bg" :class="getTheme + '-m-back ' + getTheme"></view><text
  174. v-if="index > 0">,</text>满{{item.full_price}}减{{item.reduce_price}}
  175. </view>
  176. </view>
  177. <view v-if="cart.length > 0 && activity.activity_status == 1" class="cart-placeholder"
  178. :class="{'more-placeholder': is_middleman}"></view>
  179. <view v-if="cart.length > 0 && activity.activity_status == 1" class="cart-item main-between cross-center">
  180. <view @click="openCart(item)" class="cart-left dir-left-nowrap">
  181. <view class="cart-icon">
  182. <image src="/static/image/cart.png" class="cart"></image>
  183. <view :class="getTheme + '-m-back ' + getTheme">{{cartLength > 99 ? '99+':cartLength}}</view>
  184. </view>
  185. <view class="price-info main-center dir-top-nowrap">
  186. <view class="total-price t-omit">总计<text
  187. :class="getTheme + '-m-text ' + getTheme">¥{{total < 0 ? '0.00':total}}</text></view>
  188. <view class="minus-price t-omit">已减<text
  189. :class="getTheme + '-m-text ' + getTheme">¥{{minus}}</text></view>
  190. </view>
  191. </view>
  192. <view @click="toSubmit" class="cart-right" :class="getTheme + '-m-back ' + getTheme">确认下单</view>
  193. </view>
  194. <!-- 悬浮按钮 -->
  195. <view class="dialog-btn">
  196. <view v-if="is_middleman" @click="toIndex">
  197. <image src="./../image/user-index.png"></image>
  198. </view>
  199. <view @click="toOrder">
  200. <image src="./../image/user-order.png"></image>
  201. </view>
  202. <view @click="toUser">
  203. <image src="./../image/user-center.png"></image>
  204. </view>
  205. <view @click="showHiddenClick">
  206. <image src="./../image/user-share.png"></image>
  207. </view>
  208. </view>
  209. <u-attr v-model="attrShow" :theme-object="themeObject" :goods="goods" :checked="selectAttr" @check="attr"
  210. :is_show_left="false" :is_show_right="false">
  211. <template slot="right">
  212. <!-- 购物车信息 -->
  213. <view class="attr-bottom dir-left-nowrap">
  214. <view class="box-grow-1 dir-left-nowrap cross-center">
  215. <view class="total-price">总计<text
  216. :class="getTheme + '-m-text ' + getTheme">¥{{selectAttr ? attr_price : goods.price}}</text>
  217. </view>
  218. </view>
  219. <view class="box-grow-1 u-add-btn main-center cross-center"
  220. :class="getTheme + '-m-back ' + getTheme" @click="add">加入购物车
  221. </view>
  222. </view>
  223. </template>
  224. </u-attr>
  225. <!-- 推荐 -->
  226. <view v-if="recommendDialog" @click="recommendDialog=!recommendDialog" class="bg">
  227. <view class="dialog" @click.stop="" :animation="animationData">
  228. <view v-show="showOther" @click="recommendDialog=!recommendDialog"
  229. class="end-close main-center cross-center">
  230. <image src="/static/image/icon/icon-close.png"></image>
  231. </view>
  232. <view class="end-title">当前团购已结束</view>
  233. <view class="end-recommend main-center cross-center">
  234. <view class="end-line"></view>
  235. <view>为您推荐</view>
  236. <view class="end-line"></view>
  237. </view>
  238. <view class="end-sec-title">以下{{recommend.count}}个商品正在团购</view>
  239. <view class="main-center recommend-goods">
  240. <image v-if="index < 3" v-for="(item,index) in recommend.goods_list" :key="index"
  241. :src="item.cover_pic"></image>
  242. </view>
  243. <view v-show="showOther" class="to-activity" :class="getTheme + '-m-back ' + getTheme"
  244. @click="toActivity">去看看</view>
  245. </view>
  246. </view>
  247. <!-- 分享 -->
  248. <view>
  249. <app-share-qr-code
  250. :posterUrl="'/plugins/community/poster/poster?activity_id='+id + '&middleman_id='+middleman.user_id"
  251. hasPosterNav="true" v-model="showShare" :url="poster" title="生成活动海报"></app-share-qr-code>
  252. </view>
  253. </scroll-view>
  254. <app-close v-if="showClose" :toBack="true" @update="getMall"></app-close>
  255. </app-layout>
  256. </template>
  257. <script>
  258. import {
  259. mapGetters,
  260. mapState
  261. } from 'vuex';
  262. import appHead from '../components/app-head.vue';
  263. import appShareQrCode from '../../../components/page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  264. import uAttr from '../../../components/page-component/goods/u-attr.vue';
  265. import AppClose from '../../../components/basic-component/app-close/app-close.vue';
  266. export default {
  267. data() {
  268. return {
  269. id: null,
  270. showCart: false,
  271. is_loading: false,
  272. submitLock: false,
  273. recommendDialog: false,
  274. showShare: false,
  275. stopLoad: false,
  276. showOther: false,
  277. more: false,
  278. is_middleman: false,
  279. share: false,
  280. default: false,
  281. inputRemark: true,
  282. cartLength: 0,
  283. windowHeight: 0,
  284. is_exist: 0,
  285. page: 1,
  286. poster: '',
  287. mobile: '',
  288. remark: '',
  289. d: '',
  290. h: '',
  291. m: '',
  292. s: '',
  293. selectAttr: {},
  294. animationData: {},
  295. animation: {},
  296. attr_price: '0.00',
  297. number: 1,
  298. space: '0m',
  299. display: 'none',
  300. // attrShow: 0,
  301. attrShow: false,
  302. scrollTop: 0,
  303. scrollHeight: 0,
  304. goods: null,
  305. timeInterval: null,
  306. buyBool: true,
  307. longitude: '',
  308. latitude: '',
  309. activity: {
  310. rate: 0
  311. },
  312. middleman: {},
  313. setting: {},
  314. recommend: {},
  315. list: [],
  316. cart: [],
  317. user_list: [],
  318. template_message_list: [],
  319. end_time: '1小时前',
  320. title: '',
  321. total: '0.00',
  322. minus: '0.00',
  323. middleman_id: 0,
  324. first: true,
  325. showClose: false,
  326. is_open: false,
  327. isService_label: false
  328. }
  329. },
  330. components: {
  331. appShareQrCode,
  332. appHead,
  333. uAttr,
  334. AppClose
  335. },
  336. computed: {
  337. ...mapGetters('mallConfig', {
  338. getTheme: 'getTheme'
  339. }),
  340. ...mapState({
  341. community: state => state.mallConfig.__wxapp_img.community,
  342. bonusImg: state => state.mallConfig.__wxapp_img.bonus,
  343. appImg: state => state.mallConfig.__wxapp_img.mall,
  344. appSetting: state => state.mallConfig.mall.setting,
  345. userInfo: state => state.user.info
  346. }),
  347. themeObject: function() {
  348. return {
  349. back: this.getTheme + '-m-back ' + this.getTheme,
  350. theme: this.getTheme,
  351. color: this.getTheme + '-m-text ' + this.getTheme,
  352. sBack: this.getTheme + '-s-back ' + this.getTheme
  353. }
  354. }
  355. },
  356. onLoad: function(options) {
  357. let that = this;
  358. if (options.activity_id) {
  359. this.id = options.activity_id;
  360. }
  361. if (options.id) {
  362. this.id = options.id;
  363. }
  364. this.title = options.title;
  365. uni.setNavigationBarTitle({
  366. title: options.title,
  367. });
  368. uni.getSystemInfo({
  369. success: function(res) {
  370. that.windowHeight = res.windowHeight;
  371. }
  372. });
  373. uni.getLocation({
  374. success: (e) => {
  375. uni.hideLoading();
  376. that.longitude = e.longitude;
  377. that.latitude = e.latitude;
  378. uni.getStorage({
  379. key: 'middleman_info',
  380. success: function(res) {
  381. if (res.data && res.data.id > 0) {
  382. if (options.middleman_id) {
  383. that.middleman_id = options.middleman_id;
  384. that.share = true;
  385. } else {
  386. that.middleman_id = res.data.user_id
  387. }
  388. }
  389. },
  390. fail() {
  391. if (options.middleman_id) {
  392. that.middleman_id = options.middleman_id;
  393. that.share = true;
  394. }
  395. }
  396. })
  397. that.$showLoading({
  398. type: 'global',
  399. text: '加载中...'
  400. });
  401. that.getSetting();
  402. },
  403. fail: () => {
  404. uni.hideLoading();
  405. uni.showModal({
  406. title: '提示',
  407. content: '获取位置信息失败,需要授权获取您的位置信息',
  408. showCancel: false,
  409. confirmText: '打开授权',
  410. success(e) {
  411. if (e.confirm) {
  412. uni.openSetting({});
  413. }
  414. }
  415. });
  416. },
  417. });
  418. // #ifdef MP-WEIXIN
  419. wx.showShareMenu({
  420. menus: ['shareAppMessage', 'shareTimeline']
  421. });
  422. // #endif
  423. },
  424. onUnload() {
  425. this.stopLoad = true;
  426. clearInterval(this.timeInterval);
  427. },
  428. onShow() {
  429. let that = this;
  430. if (this.stopLoad) {
  431. this.stopLoad = false;
  432. uni.getStorage({
  433. key: 'bind',
  434. success: function(res) {
  435. if (res.data > 0) {
  436. that.$showLoading({
  437. type: 'global',
  438. text: '加载中...'
  439. });
  440. that.middleman = {};
  441. that.middleman_id = 0;
  442. uni.getStorage({
  443. key: 'middleman_info',
  444. success: function(res) {
  445. if (res.data && res.data.id > 0) {
  446. that.middleman_id = res.data.user_id;
  447. }
  448. that.getList();
  449. },
  450. fail() {
  451. that.getList();
  452. }
  453. })
  454. uni.removeStorage({
  455. key: 'bind'
  456. });
  457. } else {
  458. that.getList();
  459. }
  460. },
  461. fail() {
  462. that.getList();
  463. }
  464. });
  465. }
  466. },
  467. onHide() {
  468. this.stopLoad = true;
  469. clearInterval(this.timeInterval);
  470. },
  471. methods: {
  472. toSubmit() {
  473. this.showClose = false;
  474. setTimeout(() => {
  475. this.showClose = true;
  476. })
  477. },
  478. getMall(e) {
  479. this.is_open = e.is_open == 1 ? true : false;
  480. if (this.is_open) {
  481. this.allBuy();
  482. }
  483. },
  484. scroll(e) {
  485. this.scrollHeight = e.detail.scrollTop;
  486. },
  487. getMore() {
  488. if (this.more) {
  489. this.page++;
  490. this.getOther();
  491. this.more = false;
  492. }
  493. },
  494. getOther() {
  495. let that = this;
  496. let para = {
  497. id: that.id,
  498. page: that.page,
  499. longitude: that.longitude,
  500. latitude: that.latitude
  501. }
  502. if (that.middleman_id > 0) {
  503. para.middleman_id = that.middleman_id;
  504. }
  505. that.$request({
  506. url: that.$api.community.user_activity,
  507. data: para
  508. }).then(response => {
  509. that.$hideLoading();
  510. if (response.code === 0) {
  511. if (response.data.list.length === 20) {
  512. that.more = true;
  513. }
  514. that.list = that.list.concat(response.data.list);
  515. }
  516. })
  517. },
  518. openCart(item) {
  519. this.showCart = !this.showCart;
  520. this.stopLoad = true;
  521. if (this.showCart == false) {
  522. this.stopLoad = false;
  523. this.getList();
  524. }
  525. },
  526. toList() {
  527. if (this.middleman.is_allow_change === '0') {
  528. return false;
  529. }
  530. uni.navigateTo({
  531. url: '/plugins/community/captain/captain?longitude=' + this.longitude + '&latitude=' + this
  532. .latitude
  533. });
  534. },
  535. showHiddenClick() {
  536. this.showShare = !this.showShare;
  537. },
  538. toGoods(item) {
  539. this.stopLoad = true;
  540. uni.navigateTo({
  541. url: '/plugins/community/goods/goods?goods_id=' + item.id + '&middleman_id=' + this.middleman
  542. .user_id
  543. });
  544. },
  545. toIndex() {
  546. this.stopLoad = true;
  547. uni.navigateTo({
  548. url: '/plugins/community/index/index'
  549. });
  550. },
  551. toOrder() {
  552. this.stopLoad = true;
  553. uni.navigateTo({
  554. url: '/plugins/community/order/order?is_user=1'
  555. });
  556. },
  557. toUser() {
  558. this.stopLoad = true;
  559. uni.navigateTo({
  560. url: '/pages/user-center/user-center'
  561. });
  562. },
  563. toActivity() {
  564. this.stopLoad = true;
  565. uni.redirectTo({
  566. url: '/plugins/community/activity/activity?id=' + this.recommend.activity_id
  567. });
  568. },
  569. attr(e, num) {
  570. this.selectAttr = e;
  571. this.number = num;
  572. console.log(this.selectAttr)
  573. if (this.selectAttr.service_label) {
  574. this.attr_price = (this.selectAttr.price * this.number + (this.selectAttr.service_label.price - 0))
  575. .toFixed(2);
  576. } else {
  577. this.attr_price = (this.selectAttr.price * this.number).toFixed(2);
  578. }
  579. },
  580. imgLoad() {
  581. this.is_loading = true;
  582. },
  583. allBuy() {
  584. if (this.submitLock) {
  585. return false;
  586. }
  587. this.showCart = false;
  588. this.scrollTop = this.scrollHeight
  589. if (this.default) {
  590. this.$nextTick().then(() => {
  591. this.scrollTop = 9999999;
  592. this.default = false;
  593. })
  594. uni.showToast({
  595. title: '请确认手机号',
  596. icon: 'none',
  597. duration: 1000
  598. });
  599. return false;
  600. }
  601. if (this.mobile.length == 11 && (/0?(1)[0-9]{10}/.test(this.mobile))) {
  602. this.$subscribe(this.template_message_list).then(res => {
  603. this.cart.forEach(item => {
  604. if (item.service_label == undefined) {
  605. this.isService_label = true
  606. }
  607. })
  608. if (this.isService_label) {
  609. uni.showModal({
  610. title: "温馨提示",
  611. content: "您购买碎屏险了吗 ?",
  612. showCancel: true,
  613. confirmText: '去购买',
  614. success: (res) => {
  615. if (res.confirm) {
  616. } else if (res.cancel) {
  617. console.log('用户点击取消');
  618. this.submit();
  619. }
  620. }
  621. })
  622. }else{
  623. this.submit();
  624. }
  625. }).catch(() => {
  626. this.cart.forEach(item => {
  627. if (item.service_label == undefined) {
  628. this.isService_label = true
  629. }
  630. })
  631. if (this.isService_label) {
  632. uni.showModal({
  633. title: "温馨提示",
  634. content: "您购买碎屏险了吗 ?",
  635. showCancel: true,
  636. confirmText: '去购买',
  637. success: (res) => {
  638. if (res.confirm) {
  639. } else if (res.cancel) {
  640. console.log('用户点击取消');
  641. this.submit();
  642. }
  643. }
  644. })
  645. }else{
  646. this.submit();
  647. }
  648. });
  649. } else {
  650. this.$nextTick().then(() => {
  651. this.scrollTop = 9999999;
  652. })
  653. this.stopLoad = false;
  654. this.getList();
  655. uni.showToast({
  656. title: '请输入正确的手机号码',
  657. icon: 'none',
  658. duration: 1000
  659. });
  660. }
  661. },
  662. submit() {
  663. uni.showLoading({
  664. title: '提交订单...'
  665. });
  666. this.stopLoad = true;
  667. this.submitLock = true;
  668. let goods_list = [];
  669. for (let i in this.cart) {
  670. if (this.cart[i].is_exist == 1) {
  671. let para = {};
  672. para.id = this.cart[i].goods_id;
  673. para.goods_attr_id = this.cart[i].goods_attr_id;
  674. para.num = this.cart[i].num;
  675. para.cart_id = this.cart[i].id;
  676. para.attr = this.cart[i].attr_list;
  677. para.cat_id = 0;
  678. para.form_data = [];
  679. para.service_label = this.cart[i].service_label
  680. goods_list.push(para);
  681. }
  682. }
  683. if (goods_list.length === 0) {
  684. uni.showToast({
  685. title: '请添加有效商品',
  686. icon: 'none',
  687. duration: 1000
  688. });
  689. return false
  690. }
  691. let mch_list = [{
  692. mch_id: 0,
  693. activity_id: this.id,
  694. middleman_id: this.middleman.user_id,
  695. goods_list: goods_list,
  696. distance: 0,
  697. remark: this.remark,
  698. order_form: [],
  699. use_integral: 0,
  700. user_coupon_id: 0
  701. }];
  702. let form = {};
  703. form.list = mch_list;
  704. form.address_id = 0;
  705. form.address = {
  706. name: this.userInfo.nickname,
  707. mobile: this.mobile
  708. };
  709. this.$request({
  710. url: this.$api.community.order_submit,
  711. data: {
  712. form_data: JSON.stringify(form)
  713. },
  714. method: 'post'
  715. }).then(response => {
  716. if (response.code === 0) {
  717. this.getPayOrderId(response.data.queue_id, response.data.token);
  718. } else {
  719. this.submitLock = false;
  720. this.stopLoad = false;
  721. uni.hideLoading();
  722. uni.showModal({
  723. title: '提示',
  724. content: response.msg,
  725. showCancel: false,
  726. });
  727. }
  728. }).catch(e => {
  729. this.submitLock = false;
  730. this.stopLoad = false;
  731. uni.hideLoading();
  732. uni.showModal({
  733. title: '提示',
  734. content: e.errMsg,
  735. showCancel: false,
  736. });
  737. });
  738. },
  739. getPayOrderId(queue_id, token) {
  740. this.$request({
  741. url: this.$api.order.pay_data,
  742. method: 'post',
  743. data: {
  744. queue_id: queue_id,
  745. token: token,
  746. },
  747. }).then(response => {
  748. if (response.code === 0) {
  749. if (response.data.retry && response.data.retry === 1) {
  750. this.getPayDataTimer = setTimeout(() => {
  751. this.getPayOrderId(queue_id, token);
  752. }, 1000);
  753. } else {
  754. uni.hideLoading();
  755. this.cart = [];
  756. this.pay(response.data);
  757. }
  758. } else {
  759. this.submitLock = false;
  760. uni.hideLoading();
  761. uni.showModal({
  762. title: '提示',
  763. content: response.msg,
  764. showCancel: false,
  765. });
  766. }
  767. }).catch(e => {
  768. this.submitLock = false;
  769. uni.hideLoading();
  770. uni.showModal({
  771. title: '提示',
  772. content: e.errMsg,
  773. showCancel: false,
  774. });
  775. });
  776. },
  777. pay(data) {
  778. uni.removeStorage({
  779. key: 'middleman_info'
  780. });
  781. this.$payment.pay(data.id).then(() => {
  782. this.submitLock = false;
  783. let url = '/plugins/community/order/order';
  784. uni.navigateTo({
  785. url: `/pages/order-submit/pay-result?payment_order_union_id=${data.id}&order_page_url=${url}`
  786. });
  787. }).catch(() => {
  788. this.submitLock = false;
  789. this.toOrder();
  790. });
  791. },
  792. _calcValue(index, type) {
  793. if (type === 'minus') {
  794. this.cart[index].num--;
  795. } else if (type === 'plus') {
  796. this.cart[index].num++;
  797. }
  798. this._onBlur(index);
  799. },
  800. _onBlur(index) {
  801. this.total = 0;
  802. this.cartLength = 0;
  803. for (let i in this.cart) {
  804. this.total = (+this.total + (+this.cart[i].price * this.cart[i].num));
  805. this.cartLength += +this.cart[i].num;
  806. }
  807. let minus = 0;
  808. for (let i in this.activity.full_price) {
  809. if (+this.activity.full_price[i].full_price < +this.total || +this.activity.full_price[i].full_price ==
  810. +this.total) {
  811. if (this.activity.full_price[i].reduce_price > minus) {
  812. minus = +this.activity.full_price[i].reduce_price;
  813. }
  814. }
  815. }
  816. this.total = (+this.total - minus).toFixed(2);
  817. this.minus = minus.toFixed(2);
  818. if (this.cart[index].num == 0) {
  819. this.delCart(index)
  820. } else {
  821. this.$request({
  822. url: this.$api.community.cart_edit,
  823. data: {
  824. list: JSON.stringify(this.cart)
  825. },
  826. });
  827. }
  828. },
  829. clearAll() {
  830. let cart = [];
  831. for (let i in this.cart) {
  832. cart.push(this.cart[i].id)
  833. }
  834. this.cart = [];
  835. this.showCart = false;
  836. this.$request({
  837. url: this.$api.community.cart_delete,
  838. data: {
  839. cart_id_list: JSON.stringify(cart),
  840. },
  841. }).then(() => {
  842. this.stopLoad = false;
  843. this.getList();
  844. })
  845. },
  846. delCart(index) {
  847. let list = [];
  848. list.push(this.cart[index].id)
  849. this.cart.splice(index, 1);
  850. this.total = 0;
  851. this.cartLength = 0;
  852. for (let i in this.cart) {
  853. this.total = (+this.total + (+this.cart[i].price * this.cart[i].num));
  854. this.cartLength += +this.cart[i].num
  855. }
  856. let minus = 0;
  857. for (let i in this.activity.full_price) {
  858. if (+this.activity.full_price[i].full_price < +this.total || +this.activity.full_price[i].full_price ==
  859. +this.total) {
  860. if (this.activity.full_price[i].reduce_price > minus) {
  861. minus = +this.activity.full_price[i].reduce_price
  862. }
  863. }
  864. }
  865. this.total = (+this.total - minus).toFixed(2);
  866. this.minus = minus.toFixed(2);
  867. if (this.cart.length === 0) {
  868. this.showCart = false
  869. }
  870. this.$request({
  871. url: this.$api.community.cart_delete,
  872. data: {
  873. cart_id_list: list,
  874. },
  875. }).then(() => {
  876. this.stopLoad = false;
  877. this.getList();
  878. }).catch(() => {
  879. this.attrShow = false;
  880. uni.hideLoading();
  881. });
  882. },
  883. add() {
  884. uni.showLoading({
  885. title: '加入购物车'
  886. });
  887. let service
  888. if (this.selectAttr.service_label) {
  889. service = this.selectAttr.service_label.id
  890. } else {
  891. service = ''
  892. }
  893. let para = {
  894. activity_id: this.id,
  895. goods_id: this.selectAttr.goods_id,
  896. goods_attr_id: this.selectAttr.id,
  897. service_id: service,
  898. num: this.number
  899. }
  900. this.$request({
  901. url: this.$api.community.cart_add,
  902. data: para,
  903. method: 'post'
  904. }).then(response => {
  905. if (response.code === 0) {
  906. this.addResult(response.data.queue_id, response.data.token);
  907. } else {
  908. uni.hideLoading();
  909. this.attrShow = false;
  910. uni.showToast({
  911. title: response.msg,
  912. icon: 'none',
  913. duration: 1000
  914. });
  915. }
  916. }).catch(() => {
  917. this.attrShow = false;
  918. uni.hideLoading();
  919. });
  920. },
  921. addResult(queue_id, token) {
  922. this.$request({
  923. url: this.$api.community.cart_result,
  924. method: 'post',
  925. data: {
  926. queue_id: queue_id,
  927. token: token,
  928. },
  929. }).then(response => {
  930. if (response.code === 0) {
  931. if (response.data && response.data.retry === 1) {
  932. this.getResult = setTimeout(() => {
  933. this.addResult(queue_id, token);
  934. }, 1000);
  935. } else {
  936. this.attrShow = false;
  937. let index = -1;
  938. for (let i in this.cart) {
  939. if (this.cart[i].goods_id == this.selectAttr.goods_id && this.cart[i]
  940. .goods_attr_id == this.selectAttr.id) {
  941. index = i;
  942. }
  943. }
  944. if (index > -1) {
  945. this.cart[index].num += +this.number;
  946. } else {
  947. let service
  948. if (this.selectAttr.service_label) {
  949. service = this.selectAttr.service_label
  950. } else {
  951. service = null
  952. }
  953. let para = {
  954. activity_id: this.id,
  955. community_goods_id: this.goods.id,
  956. goods_id: this.selectAttr.goods_id,
  957. goods_attr_id: this.selectAttr.id,
  958. num: this.number,
  959. name: this.goods.name,
  960. attr_list: this.selectAttr.attr_list,
  961. pic_url: this.selectAttr.pic_url,
  962. service_label: service,
  963. id: 0,
  964. price: this.selectAttr.price,
  965. is_exist: 1
  966. }
  967. this.cart.push(para);
  968. }
  969. this.total = 0;
  970. this.cartLength = 0;
  971. console.log(this.cart, "===================")
  972. for (let item of this.cart) {
  973. this.total = (this.total + (item.price * item.num + (item.service_label.price -
  974. 0)));
  975. this.cartLength += +item.num;
  976. }
  977. let minus = 0;
  978. for (let i in this.activity.full_price) {
  979. if (+this.activity.full_price[i].full_price < +this.total || +this.activity
  980. .full_price[i].full_price == +this.total) {
  981. if (this.activity.full_price[i].reduce_price > minus) {
  982. minus = +this.activity.full_price[i].reduce_price;
  983. }
  984. }
  985. }
  986. this.total = (+this.total - minus).toFixed(2);
  987. this.minus = minus.toFixed(2);
  988. uni.hideLoading();
  989. }
  990. } else {
  991. uni.hideLoading();
  992. uni.showModal({
  993. title: '提示',
  994. content: response.msg,
  995. showCancel: false
  996. });
  997. }
  998. }).catch(e => {
  999. this.attrShow = false;
  1000. uni.hideLoading();
  1001. uni.showModal({
  1002. title: '提示',
  1003. content: e.errMsg,
  1004. showCancel: false
  1005. });
  1006. });
  1007. },
  1008. toBuy(item) {
  1009. if (this.$user.isLogin() && this.$store.state.user.info) {
  1010. let member_level = this.$store.state.user.info.identity.member_level;
  1011. if (member_level < item.member_level) {
  1012. uni.showModal({
  1013. title: "提示",
  1014. content: "需达到" + item.member_name + "会员才可购买",
  1015. showCancel: true,
  1016. buttonText: '升级',
  1017. success: (res) => {
  1018. if (res.confirm) {
  1019. uni.navigateTo({
  1020. // url:"/pages/member/index/index",
  1021. url: '/pages/member/upgrade/upgrade?level=' + member_level +
  1022. '&other=' + item.member_level
  1023. })
  1024. } else if (res.cancel) {
  1025. console.log('用户点击取消');
  1026. }
  1027. }
  1028. })
  1029. return;
  1030. }
  1031. }
  1032. this.selectAttr = null;
  1033. this.goods = item;
  1034. this.attrShow = true;
  1035. },
  1036. getCart() {
  1037. let that = this;
  1038. if (that.stopLoad) {
  1039. return false;
  1040. }
  1041. that.$request({
  1042. url: that.$api.community.cart,
  1043. data: {
  1044. middleman_id: that.middleman.user_id,
  1045. activity_id: that.activity.id,
  1046. }
  1047. }).then(response => {
  1048. if (that.stopLoad) {
  1049. return false;
  1050. }
  1051. if (response.code === 0) {
  1052. that.total = 0;
  1053. that.cartLength = 0;
  1054. that.cart = response.data.list;
  1055. that.is_exist = 0;
  1056. for (let i in that.cart) {
  1057. if (that.cart[i].is_exist == 0) {
  1058. that.is_exist++;
  1059. }
  1060. that.total = (+that.total + (+that.cart[i].price * that.cart[i].num));
  1061. that.cartLength += +that.cart[i].num;
  1062. }
  1063. let minus = 0;
  1064. for (let i in that.activity.full_price) {
  1065. if (+that.activity.full_price[i].full_price < +that.total || +that.activity.full_price[
  1066. i].full_price == +that.total) {
  1067. if (that.activity.full_price[i].reduce_price > minus) {
  1068. minus = +that.activity.full_price[i].reduce_price;
  1069. }
  1070. }
  1071. }
  1072. that.total = (+that.total - minus).toFixed(2);
  1073. that.minus = minus.toFixed(2);
  1074. } else {
  1075. that.stopLoad = true;
  1076. uni.showToast({
  1077. title: response.msg,
  1078. icon: 'none',
  1079. duration: 1000
  1080. });
  1081. if (response.msg === '所选活动已下架') {
  1082. setTimeout(() => {
  1083. uni.navigateBack({});
  1084. }, 1000);
  1085. }
  1086. }
  1087. }).catch(() => {
  1088. that.$hideLoading();
  1089. });
  1090. },
  1091. getTime(time) {
  1092. if (time > 86399) {
  1093. this.d = Math.floor(time / 86400);
  1094. time = time - (86400 * this.d);
  1095. } else {
  1096. this.d = 0;
  1097. }
  1098. if (time > 3599) {
  1099. this.h = Math.floor(time / 3600);
  1100. if (this.h < 10) {
  1101. this.h = '0' + this.h;
  1102. }
  1103. time = time - (3600 * this.h);
  1104. } else {
  1105. this.h = '00'
  1106. }
  1107. if (time > 59) {
  1108. this.m = Math.floor(time / 60);
  1109. if (this.m < 10) {
  1110. this.m = '0' + this.m;
  1111. }
  1112. time = time - (60 * this.m);
  1113. } else {
  1114. this.m = '00';
  1115. }
  1116. if (time < 60) {
  1117. this.s = time;
  1118. if (this.s < 10) {
  1119. this.s = '0' + this.s;
  1120. }
  1121. }
  1122. },
  1123. getSetting() {
  1124. let that = this;
  1125. that.$request({
  1126. url: that.$api.community.setting,
  1127. }).then(response => {
  1128. if (response.code === 0) {
  1129. that.head = that.community.a;
  1130. switch (that.getTheme) {
  1131. case 'b':
  1132. that.head = that.community.b;
  1133. break;
  1134. case 'c':
  1135. that.head = that.community.c;
  1136. break;
  1137. case 'd':
  1138. that.head = that.community.d;
  1139. break;
  1140. case 'e':
  1141. that.head = that.community.e;
  1142. break;
  1143. case 'g':
  1144. that.head = that.community.g;
  1145. break;
  1146. case 'h':
  1147. that.head = that.community.h;
  1148. break;
  1149. case 'i':
  1150. that.head = that.community.i;
  1151. break;
  1152. }
  1153. that.setting = response.data;
  1154. that.getList();
  1155. } else {
  1156. that.$hideLoading();
  1157. uni.showToast({
  1158. title: response.msg,
  1159. icon: 'none',
  1160. duration: 1000
  1161. });
  1162. }
  1163. }).catch(() => {
  1164. that.$hideLoading();
  1165. });
  1166. },
  1167. getList() {
  1168. let that = this;
  1169. let para = {
  1170. id: that.id,
  1171. longitude: that.longitude,
  1172. latitude: that.latitude
  1173. }
  1174. if (that.middleman_id > 0) {
  1175. para.middleman_id = that.middleman_id
  1176. }
  1177. that.$request({
  1178. url: that.$api.community.user_activity,
  1179. data: para
  1180. }).then(response => {
  1181. that.$hideLoading();
  1182. if (response.code === 0) {
  1183. if (response.data.list.length === 0) {
  1184. that.stopLoad = true;
  1185. uni.showToast({
  1186. title: '活动商品异常,正在返回活动主页',
  1187. icon: 'none',
  1188. duration: 1000
  1189. });
  1190. setTimeout(() => {
  1191. uni.redirectTo({
  1192. url: '/plugins/community/list/list'
  1193. });
  1194. }, 1000);
  1195. return false;
  1196. }
  1197. if (response.data.list.length < 20) {
  1198. that.list = response.data.list;
  1199. } else {
  1200. for (let i in response.data.list) {
  1201. that.list[i] = response.data.list[i];
  1202. }
  1203. }
  1204. if (that.first) {
  1205. that.first = false;
  1206. if (response.data.last_mobile) {
  1207. that.mobile = response.data.last_mobile;
  1208. that.default = true;
  1209. }
  1210. response.data.list.length < 20 ? that.more = false : that.more = true;
  1211. }
  1212. that.activity = response.data.activity;
  1213. that.is_middleman = response.data.is_middleman;
  1214. that.middleman = response.data.middleman_info;
  1215. if (that.middleman_id == 0) {
  1216. uni.getStorage({
  1217. key: 'middleman_info',
  1218. success: function(res) {
  1219. if (res.data && res.data.id > 0) {
  1220. that.middleman = res.data;
  1221. }
  1222. }
  1223. })
  1224. }
  1225. that.space = ~~that.middleman.distance + 'm';
  1226. if (that.middleman.distance > 1000) {
  1227. that.space = (that.middleman.distance / 1000).toFixed(1) + 'km';
  1228. }
  1229. if (that.share) {
  1230. uni.setStorage({
  1231. key: 'middleman_info',
  1232. data: that.middleman
  1233. });
  1234. }
  1235. that.user_list = response.data.user_list;
  1236. if (that.user_list.length > that.activity.user_num) {
  1237. that.user_list = that.user_list.slice(0, that.activity.user_num);
  1238. }
  1239. that.template_message_list = response.data.template_message_list;
  1240. if (that.activity.activity_status == 1) {
  1241. if (!that.stopLoad) {
  1242. setTimeout(function() {
  1243. that.getList();
  1244. }, 5000)
  1245. }
  1246. that.getCart();
  1247. let end_time = Math.floor(that.user_list[that.user_list.length - 1].time / 60);
  1248. if (end_time > 60) {
  1249. that.end_time = '1小时前';
  1250. } else if (end_time == 0) {
  1251. that.end_time = '刚刚';
  1252. } else {
  1253. that.end_time = end_time + '分钟前';
  1254. }
  1255. }
  1256. if (that.activity.activity_status == 2 && response.data.recommend_activity.activity_id >
  1257. 0) {
  1258. setTimeout(function() {
  1259. that.recommend = response.data.recommend_activity;
  1260. that.recommendDialog = true;
  1261. var animation = uni.createAnimation({
  1262. duration: 1000,
  1263. timingFunction: 'ease',
  1264. })
  1265. that.animation = animation;
  1266. setTimeout(function() {
  1267. animation.bottom(0).step();
  1268. that.animationData = animation.export();
  1269. setTimeout(function() {
  1270. that.showOther = true;
  1271. }, 1500);
  1272. }, 200);
  1273. }, 800);
  1274. }
  1275. if (that.activity.time > 0) {
  1276. let time = that.activity.time;
  1277. that.timeInterval = setInterval(() => {
  1278. that.getTime(time);
  1279. time--;
  1280. if (time == 0) {
  1281. clearInterval(that.timeInterval);
  1282. that.getList();
  1283. }
  1284. }, 1000);
  1285. }
  1286. } else {
  1287. that.stopLoad = true;
  1288. if (response.msg === '周边没有活动可参加') {
  1289. uni.showToast({
  1290. title: '周边没有活动可参加,正在返回活动主页',
  1291. icon: 'none',
  1292. duration: 1000
  1293. });
  1294. setTimeout(() => {
  1295. uni.redirectTo({
  1296. url: '/plugins/community/list/list'
  1297. });
  1298. }, 1000);
  1299. } else {
  1300. uni.showToast({
  1301. title: response.msg,
  1302. icon: 'none',
  1303. duration: 1000
  1304. });
  1305. }
  1306. }
  1307. }).catch(() => {
  1308. that.$hideLoading();
  1309. });
  1310. },
  1311. },
  1312. onShareAppMessage: function() {
  1313. return this.$shareAppMessage({
  1314. title: this.setting.app_share_title ? this.setting.app_share_title : this.title,
  1315. imageUrl: this.setting.app_share_pic ? this.setting.app_share_pic : this.list[0].cover_pic,
  1316. path: "/plugins/community/activity/activity",
  1317. params: {
  1318. id: this.id,
  1319. user_id: this.userInfo.options.user_id,
  1320. middleman_id: this.middleman.user_id
  1321. }
  1322. });
  1323. },
  1324. // #ifdef MP-WEIXIN
  1325. onShareTimeline: function() {
  1326. return this.$shareTimeline({
  1327. title: this.share_title ? this.share_title : this.title,
  1328. query: {
  1329. id: this.id,
  1330. user_id: this.userInfo.options.user_id,
  1331. middleman_id: this.middleman.user_id
  1332. }
  1333. });
  1334. }
  1335. // #endif
  1336. }
  1337. </script>
  1338. <style scoped lang="scss">
  1339. .middleman {
  1340. margin-top: -360rpx;
  1341. height: 190rpx;
  1342. color: #ffffff;
  1343. padding: 0 35rpx;
  1344. position: relative;
  1345. .space {
  1346. color: #fff;
  1347. font-size: 22rpx;
  1348. position: absolute;
  1349. top: 45rpx;
  1350. right: 30rpx;
  1351. }
  1352. .arrow-image {
  1353. margin-left: 36rpx;
  1354. width: #{12rpx};
  1355. height: #{24rpx};
  1356. position: absolute;
  1357. top: 50%;
  1358. right: 30rpx;
  1359. margin-top: -12rpx;
  1360. }
  1361. .location {
  1362. font-size: 40rpx;
  1363. width: 70%;
  1364. margin-bottom: 15rpx;
  1365. margin-top: -10rpx;
  1366. }
  1367. .middleman-info {
  1368. font-size: 26rpx;
  1369. .avatar {
  1370. width: 58rpx;
  1371. height: 58rpx;
  1372. border-radius: 50%;
  1373. margin-right: 20rpx;
  1374. flex-shrink: 0;
  1375. }
  1376. .user-info {
  1377. .icon {
  1378. height: 25rpx;
  1379. width: 25rpx;
  1380. margin-right: 6rpx;
  1381. color: #ff4544;
  1382. }
  1383. }
  1384. }
  1385. }
  1386. .time {
  1387. padding: 0 36rpx;
  1388. color: #ff4544;
  1389. height: 90rpx;
  1390. line-height: 90rpx;
  1391. margin: 0 24rpx;
  1392. width: 702rpx;
  1393. border-top-left-radius: 16rpx;
  1394. border-top-right-radius: 16rpx;
  1395. background-color: #F2F2F2;
  1396. position: relative;
  1397. z-index: 2;
  1398. font-size: 24rpx;
  1399. .icon {
  1400. color: #ff4544;
  1401. width: 24rpx;
  1402. height: 24rpx;
  1403. margin-right: 10rpx;
  1404. }
  1405. }
  1406. .status-area {
  1407. width: 702rpx;
  1408. margin: 0 24rpx;
  1409. padding-bottom: 24rpx;
  1410. border-radius: 16rpx;
  1411. background-color: #f7f7f7;
  1412. position: relative;
  1413. z-index: 2;
  1414. .status {
  1415. background-color: #fff;
  1416. border-radius: 16rpx;
  1417. padding: 24rpx;
  1418. .end-time {
  1419. color: #ff4544;
  1420. text-align: center;
  1421. font-size: 24rpx;
  1422. }
  1423. .condition {
  1424. color: #353535;
  1425. font-size: 24rpx;
  1426. width: 100%;
  1427. .end-time {
  1428. color: #ff4544;
  1429. }
  1430. }
  1431. .progress {
  1432. width: #{654rpx};
  1433. background-color: #f0f0f0;
  1434. border-radius: #{10rpx};
  1435. height: #{20rpx};
  1436. position: relative;
  1437. margin: 15rpx 0;
  1438. overflow: hidden;
  1439. view {
  1440. border-radius: #{10rpx};
  1441. height: #{20rpx};
  1442. position: absolute;
  1443. top: 0;
  1444. left: 0;
  1445. z-index: 2;
  1446. }
  1447. }
  1448. .buy-user {
  1449. height: 58rpx;
  1450. .user-list {
  1451. image {
  1452. width: 58rpx;
  1453. height: 58rpx;
  1454. margin-left: -14rpx;
  1455. border-radius: 50%;
  1456. border: 2rpx solid #ffffff;
  1457. }
  1458. }
  1459. .sales {
  1460. font-size: 24rpx;
  1461. line-height: 58rpx;
  1462. height: 58rpx;
  1463. margin-left: 14rpx;
  1464. text {
  1465. color: #ff4544;
  1466. }
  1467. }
  1468. }
  1469. .new-buy {
  1470. margin-top: 20rpx;
  1471. color: #999999;
  1472. font-size: 24rpx;
  1473. image {
  1474. width: 60rpx;
  1475. height: 60rpx;
  1476. border-radius: 50%;
  1477. display: block;
  1478. margin-right: 20rpx;
  1479. }
  1480. }
  1481. }
  1482. }
  1483. .list {
  1484. margin: 0 24rpx;
  1485. width: 702rpx;
  1486. .goods {
  1487. background-color: #fff;
  1488. border-radius: 16rpx;
  1489. width: 702rpx;
  1490. height: 220rpx;
  1491. margin-bottom: 20rpx;
  1492. position: relative;
  1493. z-index: 2;
  1494. .out-dialog {
  1495. width: #{220rpx};
  1496. height: #{220rpx};
  1497. border-radius: #{16rpx};
  1498. position: absolute;
  1499. top: 0;
  1500. left: 0;
  1501. z-index: 10;
  1502. background-color: rgba(0, 0, 0, .5);
  1503. image {
  1504. width: #{220rpx};
  1505. height: #{220rpx};
  1506. border-radius: #{16rpx};
  1507. }
  1508. }
  1509. .cover {
  1510. height: 220rpx;
  1511. width: 220rpx;
  1512. border-radius: 16rpx;
  1513. margin-right: 15rpx;
  1514. }
  1515. .info {
  1516. padding: 20rpx 0;
  1517. position: relative;
  1518. .name {
  1519. width: 445rpx;
  1520. // #ifndef MP-ALIPAY
  1521. height: 72rpx;
  1522. // #endif
  1523. // #ifdef MP-ALIPAY
  1524. height: 66rpx;
  1525. // #endif
  1526. font-size: 28rpx;
  1527. }
  1528. .sale {
  1529. height: 30rpx;
  1530. line-height: 28rpx;
  1531. font-size: 22rpx;
  1532. margin-top: 18rpx;
  1533. display: inline-block;
  1534. position: relative;
  1535. >view {
  1536. padding: 0 10rpx;
  1537. border: 2rpx solid;
  1538. display: inline-block;
  1539. }
  1540. .sale-bg {
  1541. padding: 0;
  1542. position: absolute;
  1543. top: 0;
  1544. left: 0;
  1545. opacity: 0.1;
  1546. border-top-left-radius: 15rpx;
  1547. border-bottom-left-radius: 15rpx;
  1548. border: 0;
  1549. height: 100%;
  1550. width: 100%;
  1551. }
  1552. view:first-of-type {
  1553. border-right: 0;
  1554. border-top-left-radius: 15rpx;
  1555. border-bottom-left-radius: 15rpx;
  1556. }
  1557. .stock {
  1558. border-top-right-radius: 15rpx;
  1559. border-bottom-right-radius: 15rpx;
  1560. border-left: 0;
  1561. background-color: #fff;
  1562. }
  1563. }
  1564. .price {
  1565. font-size: 32rpx;
  1566. position: absolute;
  1567. bottom: 20rpx;
  1568. left: 0;
  1569. }
  1570. .cart {
  1571. position: absolute;
  1572. bottom: 20rpx;
  1573. right: 0;
  1574. width: 80rpx;
  1575. height: 80rpx;
  1576. z-index: 2;
  1577. }
  1578. }
  1579. }
  1580. }
  1581. .cart-placeholder {
  1582. height: 450rpx;
  1583. &.cart-list-placeholder {
  1584. height: 150rpx;
  1585. &.again-placeholder {
  1586. height: 210rpx;
  1587. }
  1588. }
  1589. &.more-placeholder {
  1590. height: 540rpx;
  1591. }
  1592. }
  1593. .total-price {
  1594. width: 350rpx;
  1595. text {
  1596. font-size: 32rpx;
  1597. }
  1598. }
  1599. .minus-price {
  1600. width: 350rpx;
  1601. }
  1602. .discount {
  1603. position: fixed;
  1604. bottom: 145rpx;
  1605. left: 0;
  1606. height: 60rpx;
  1607. line-height: 60rpx;
  1608. width: 100%;
  1609. font-size: 24rpx;
  1610. z-index: 10;
  1611. background-color: #fff;
  1612. .discount-bg {
  1613. position: fixed;
  1614. bottom: 145rpx;
  1615. left: 0;
  1616. height: 60rpx;
  1617. line-height: 60rpx;
  1618. width: 100%;
  1619. opacity: 0.1;
  1620. z-index: 10;
  1621. }
  1622. text {
  1623. margin-right: 10rpx;
  1624. }
  1625. }
  1626. .cart-item {
  1627. position: fixed;
  1628. bottom: 0;
  1629. left: 0;
  1630. height: 145rpx;
  1631. width: 100%;
  1632. padding: 0 16rpx 24rpx;
  1633. background-color: #fff;
  1634. z-index: 20;
  1635. box-shadow: 0 0 #{10rpx} rgba(0, 0, 0, .3);
  1636. .cart-left {
  1637. font-size: 24rpx;
  1638. color: #353535;
  1639. height: 74rpx;
  1640. line-height: 74rpx;
  1641. .cart-icon {
  1642. position: relative;
  1643. margin-right: 45rpx;
  1644. image {
  1645. width: 74rpx;
  1646. height: 74rpx;
  1647. border-radius: 50%;
  1648. }
  1649. view {
  1650. position: absolute;
  1651. top: -5rpx;
  1652. left: 52rpx;
  1653. height: #{34rpx};
  1654. line-height: #{34rpx};
  1655. border-radius: #{17rpx};
  1656. color: #fff;
  1657. padding: 0 #{10rpx};
  1658. }
  1659. }
  1660. .price-info {
  1661. height: 74rpx;
  1662. >view {
  1663. height: 37rpx;
  1664. line-height: 37rpx;
  1665. }
  1666. }
  1667. }
  1668. .cart-right {
  1669. font-size: 28rpx;
  1670. color: #fff;
  1671. height: 78rpx;
  1672. line-height: 78rpx;
  1673. border-radius: 39rpx;
  1674. padding: 0 50rpx;
  1675. }
  1676. }
  1677. .dialog-btn {
  1678. position: fixed;
  1679. bottom: 175rpx;
  1680. left: 30rpx;
  1681. z-index: 10;
  1682. >view {
  1683. margin-top: 10rpx;
  1684. width: 80rpx;
  1685. height: 80rpx;
  1686. image {
  1687. width: 80rpx;
  1688. height: 80rpx;
  1689. }
  1690. }
  1691. }
  1692. .bg {
  1693. position: fixed;
  1694. top: 0;
  1695. left: 0;
  1696. width: 100%;
  1697. height: 100%;
  1698. background-color: rgba(0, 0, 0, .3);
  1699. z-index: 18;
  1700. .dialog {
  1701. background-color: #fff;
  1702. border-top-left-radius: 16rpx;
  1703. border-top-right-radius: 16rpx;
  1704. position: fixed;
  1705. bottom: -600rpx;
  1706. left: 0;
  1707. width: 100%;
  1708. z-index: 19;
  1709. padding: 0 24rpx;
  1710. &.cart-dialog {
  1711. bottom: 0
  1712. }
  1713. .cart-discount {
  1714. height: 60rpx;
  1715. line-height: 60rpx;
  1716. width: 100%;
  1717. font-size: 24rpx;
  1718. z-index: 10;
  1719. border-top-left-radius: 16rpx;
  1720. border-top-right-radius: 16rpx;
  1721. position: relative;
  1722. .discount-bg {
  1723. position: absolute;
  1724. top: 0;
  1725. left: 0;
  1726. width: 100%;
  1727. height: 100%;
  1728. opacity: 0.1;
  1729. }
  1730. text {
  1731. margin-right: 10rpx;
  1732. }
  1733. }
  1734. .title {
  1735. height: 84rpx;
  1736. line-height: 84rpx;
  1737. font-size: 26rpx;
  1738. padding: 0 24rpx;
  1739. color: #353535;
  1740. image {
  1741. display: block;
  1742. width: 40rpx;
  1743. height: 40rpx;
  1744. margin-right: 12rpx;
  1745. }
  1746. }
  1747. .goods-list {
  1748. padding: 0 24rpx;
  1749. max-height: 510rpx;
  1750. overflow: auto;
  1751. }
  1752. .goods {
  1753. background-color: #fff;
  1754. border-radius: 8rpx;
  1755. width: 702rpx;
  1756. margin-bottom: 20rpx;
  1757. padding-top: 20rpx;
  1758. border-top: 2rpx solid #e2e2e2;
  1759. position: relative;
  1760. z-index: 22;
  1761. &:first-of-type {
  1762. border-top: 0;
  1763. padding-top: 0;
  1764. }
  1765. .cover {
  1766. height: 180rpx;
  1767. width: 180rpx;
  1768. border-radius: 8rpx;
  1769. margin-right: 25rpx;
  1770. }
  1771. .info {
  1772. position: relative;
  1773. width: 492rpx;
  1774. .name {
  1775. width: 445rpx;
  1776. max-height: 72rpx;
  1777. font-size: 28rpx;
  1778. margin-bottom: 20rpx;
  1779. }
  1780. .attr {
  1781. font-size: 24rpx;
  1782. color: #999999;
  1783. .attr-group {
  1784. margin-left: 10rpx;
  1785. &:first-of-type {
  1786. margin-left: 0;
  1787. }
  1788. }
  1789. }
  1790. .price {
  1791. font-size: 30rpx;
  1792. position: absolute;
  1793. bottom: 0;
  1794. left: 0;
  1795. }
  1796. .app-add-subtract {
  1797. height: #{60rpx};
  1798. position: absolute;
  1799. bottom: 0;
  1800. right: 0;
  1801. .app-icon {
  1802. height: #{44rpx};
  1803. width: #{44rpx};
  1804. background-size: 100% 100%;
  1805. background-repeat: no-repeat;
  1806. }
  1807. .app-value {
  1808. height: #{60rpx};
  1809. width: #{88rpx};
  1810. input,
  1811. view {
  1812. height: #{60rpx};
  1813. width: #{88rpx};
  1814. font-size: #{26rpx};
  1815. color: #353535;
  1816. background-color: #ffffff;
  1817. text-align: center;
  1818. }
  1819. view {
  1820. line-height: #{60rpx};
  1821. color: #999999;
  1822. }
  1823. }
  1824. }
  1825. }
  1826. }
  1827. .end-close {
  1828. position: fixed;
  1829. bottom: 488rpx;
  1830. right: 0;
  1831. z-index: 20;
  1832. width: 80rpx;
  1833. height: 80rpx;
  1834. padding: 25rpx;
  1835. image {
  1836. width: 30rpx;
  1837. height: 30rpx;
  1838. }
  1839. }
  1840. .end-title {
  1841. margin-top: 40rpx;
  1842. font-size: 32rpx;
  1843. color: #353535;
  1844. text-align: center;
  1845. }
  1846. .end-recommend {
  1847. font-size: 24rpx;
  1848. color: #999999;
  1849. height: 70rpx;
  1850. .end-line {
  1851. width: 40rpx;
  1852. height: 2rpx;
  1853. background-color: #999999;
  1854. margin: 0 15rpx;
  1855. }
  1856. }
  1857. .end-sec-title {
  1858. font-size: 28rpx;
  1859. color: #353535;
  1860. text-align: center;
  1861. }
  1862. .recommend-goods {
  1863. margin-top: 25rpx;
  1864. margin-bottom: 135rpx;
  1865. image {
  1866. width: 220rpx;
  1867. height: 220rpx;
  1868. border-radius: 8rpx;
  1869. display: block;
  1870. margin: 0 33rpx;
  1871. }
  1872. }
  1873. .to-activity {
  1874. position: fixed;
  1875. bottom: 0;
  1876. left: 0;
  1877. height: 100rpx;
  1878. width: 100%;
  1879. text-align: center;
  1880. line-height: 100rpx;
  1881. color: #fff;
  1882. font-size: 30rpx;
  1883. }
  1884. }
  1885. }
  1886. .attr-bottom {
  1887. position: fixed;
  1888. z-index: 1666;
  1889. bottom: 0;
  1890. left: 0;
  1891. height: #{110rpx};
  1892. width: 100%;
  1893. font-size: $uni-font-size-general-one;
  1894. .total-price {
  1895. margin-left: 25rpx;
  1896. }
  1897. }
  1898. .input-info {
  1899. margin: 0 24rpx;
  1900. background-color: #fff;
  1901. border-radius: 16rpx;
  1902. width: 702rpx;
  1903. .input-item {
  1904. font-size: 26rpx;
  1905. padding: 30rpx;
  1906. padding-bottom: 15rpx;
  1907. border-top: 2rpx solid #e2e2e2;
  1908. view.input {
  1909. line-height: 52rpx;
  1910. word-break: break-all;
  1911. }
  1912. &:first-of-type {
  1913. border-top: 0;
  1914. }
  1915. .input-label {
  1916. color: #666;
  1917. margin-bottom: 10rpx;
  1918. }
  1919. }
  1920. }
  1921. .u-add-btn {
  1922. color: #ffffff;
  1923. }
  1924. </style>