Bargain_cart.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view v-if="cacheData" :class="[AppTheme]">
  3. <swiper class="carousel" indicator-active-color=" #007aff">
  4. <swiper-item v-for="(item, index) in appalbum" :key="index" class="carousel-item" @click="">
  5. <image class="s-img" :src="item" />
  6. </swiper-item>
  7. </swiper>
  8. <view class="carousel_tag bg-linear-gradient">
  9. <view>
  10. <view>
  11. 底价:
  12. <span class="text-neutral">¥{{cacheData.price}}</span>
  13. </view>
  14. <view>
  15. 原价:
  16. <span>¥{{cacheData.oprice}}</span>
  17. </view>
  18. </view>
  19. <span>{{data.kjcount}}人参与</span>
  20. </view>
  21. <view class="title-text">
  22. <p>{{cacheData.name}}</p>
  23. </view>
  24. <view class="title-text-cnent">
  25. <span>
  26. 库存:
  27. <span style="margin-left: 10rpx;">{{cacheData.num}}件</span>
  28. </span>
  29. <span>
  30. 单位:
  31. <span style="margin-left: 10rpx;">{{cacheData.unit}}</span>
  32. </span>
  33. <span>
  34. 砍刀数:
  35. <span style="margin-left: 10rpx;">{{cacheData.blimit== 0 ?'无限制':cacheData.blimit}}</span>
  36. </span>
  37. </view>
  38. <view class="title-text-cnent" style="color: #999999;" v-if="cacheData.score<=0">本次活动不赠送积分</view>
  39. <view class="title-text-cnent" style="color: #999999;" v-else>本次活动赠送 {{cacheData.score}} 积分</view>
  40. <view class="circuit">
  41. <view class="title">
  42. <i class="bg-primary"></i>
  43. 砍价流程
  44. </view>
  45. <view class="title-list">
  46. <view class="title-list-inner " v-for="(item, index) in titleList" :key="index">
  47. <view class="num" :class="{ 'bg-primary': index + 1 == num }">{{ index + 1 }}</view>
  48. <p class="title-list-inner-boder" :class="{ 'border-primary': index + 1 == num }">{{ item }}</p>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="bottom">
  53. <view class="bottom_img">
  54. <p class="subtitle">商品详情</p>
  55. <view class="content-box">
  56. <u-parse :content="content" :lazy-load="true" :autoscroll="false" :show-with-animation="true">
  57. </u-parse>
  58. </view>
  59. </view>
  60. <view class="bottom_but">
  61. <view @click="go">
  62. <u-icon :color="primary" labelSize="12" color="#909399" label="首页" labelPos="bottom"
  63. labelColor="#909399" size="25" name="home-fill"></u-icon>
  64. </view>
  65. <view @click="Bargain" v-if="data.over==0" class="start bg-linear-gradient">
  66. <span class="haggle">立即砍价</span>
  67. </view>
  68. <view v-if="data.over==1" class="end">
  69. <span class="haggle">已经结束</span>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- #ifdef MP-WEIXIN -->
  74. <nologin ref="nologin" v-on:loginback="loginback"></nologin>
  75. <!-- #endif -->
  76. <!-- 站位 -->
  77. <view style="height: 150rpx;"></view>
  78. </view>
  79. </template>
  80. <script>
  81. import api from '@/api/mall/index.js'
  82. import nologin from '@/components/nologin/nologin.vue';
  83. export default {
  84. components: {
  85. nologin
  86. },
  87. data() {
  88. return {
  89. primary: this.$theme.primary,
  90. num: 1,
  91. titleList: ['选择心仪商品', '邀请好友砍价', '砍刀最低支付'],
  92. carouselList: [{
  93. src: 'http://www.zzfcd.com/images/Upload/201507101533569.jpg'
  94. }, {
  95. src: 'http://www.zzfcd.com/images/Upload/201507101533569.jpg'
  96. }],
  97. cacheData: '',
  98. appalbum: '',
  99. apppic: '',
  100. data: '',
  101. settingFile: getApp().globalData.siteinfo,
  102. vipid: '',
  103. content: ''
  104. };
  105. },
  106. onLoad(options) {
  107. let data = {
  108. id: options.id,
  109. }
  110. this.$bindid.getbindid(options, this.$store);
  111. api.bargoods(data).then(ret => {
  112. console.log(ret)
  113. this.cacheData = ret.data.cache
  114. this.appalbum = ret.data.appalbum
  115. this.apppic = ret.data.apppic
  116. this.data = ret.data
  117. /* 处理富文本*/
  118. this.content = this.cacheData.content.replace(/\<img src="/gi,
  119. `<img style='width:100%;display:block' src="${this.settingFile.root_rich_img}`);
  120. })
  121. },
  122. methods: {
  123. loginback() {
  124. //登录回调
  125. },
  126. Bargain2() {
  127. // //订阅模板消息
  128. let that = this
  129. let tmplIdsone = that.$config.temlist;
  130. if (tmplIdsone) {
  131. that.$until.requestSubscribeMessage([tmplIdsone['priceCutting']], tmplIdsone, function() {
  132. setTimeout(() => {
  133. uni.navigateTo({
  134. url: './Bargain_order?id=' + that
  135. .cacheData.id
  136. })
  137. }, 0)
  138. });
  139. }else{
  140. setTimeout(() => {
  141. uni.navigateTo({
  142. url: './Bargain_order?id=' + that
  143. .cacheData.id
  144. })
  145. }, 0)
  146. }
  147. },
  148. Bargain() {
  149. let that = this;
  150. // #ifdef MP-WEIXIN
  151. if (that.$store.state.islogin()) {
  152. that.Bargain2()
  153. } else {
  154. that.$refs.nologin.open();
  155. }
  156. // #endif
  157. // #ifdef H5 || APP-PLUS
  158. that.Bargain2()
  159. // #endif
  160. },
  161. go() {
  162. uni.switchTab({
  163. url: '/pages/mall/mall'
  164. })
  165. }
  166. }
  167. };
  168. </script>
  169. <style lang="scss">
  170. // * { background-color: rgba(255,0,0,.2); }
  171. // * * { background-color: rgba(0,255,0,.2); }
  172. // * * * { background-color: rgba(0,0,255,.2); }
  173. // * * * * { background-color: rgba(255,0,255,.2); }
  174. // * * * * * { background-color: rgba(0,255,255,.2); }
  175. // * * * * * * { background-color: rgba(255,25,0,.2); }
  176. page {
  177. background: #f5f5f5;
  178. }
  179. .carousel {
  180. height: 500rpx;
  181. }
  182. .carousel_tag {
  183. height: 88rpx;
  184. width: 100%;
  185. padding: 20rpx;
  186. color: #ffffff;
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. >view {
  191. display: flex;
  192. align-items: center;
  193. view:nth-child(1) {
  194. span {
  195. font-size: 36rpx;
  196. }
  197. }
  198. view:nth-child(2) {
  199. margin-left: 50rpx;
  200. span {
  201. margin-left: 10rpx;
  202. text-decoration: line-through;
  203. }
  204. }
  205. }
  206. >span {
  207. width: 120rpx;
  208. height: 48rpx;
  209. border-radius: 50rpx;
  210. line-height: 48rpx;
  211. text-align: center;
  212. font-size: 24rpx;
  213. margin-right: 30rpx;
  214. }
  215. }
  216. .carousel-item {
  217. width: 100%;
  218. .s-img {
  219. width: 100%;
  220. height: 100%;
  221. }
  222. .swiper-dots {
  223. left: 45rpx;
  224. bottom: 40rpx;
  225. }
  226. }
  227. .title-text {
  228. padding: 20rpx 30rpx;
  229. box-sizing: border-box;
  230. min-height: 90rpx;
  231. line-height: 45rpx;
  232. width: 100%;
  233. background-color: #fff;
  234. p:nth-child(1) {
  235. font-size: 30rpx;
  236. }
  237. p:nth-child(2) {
  238. font-size: 32rpx;
  239. color: red;
  240. span {
  241. text-decoration: line-through;
  242. margin: 0 20rpx;
  243. font-size: 24rpx;
  244. color: #999999;
  245. }
  246. }
  247. }
  248. .title-text-cnent {
  249. padding: 30rpx;
  250. box-sizing: border-box;
  251. margin: 10rpx;
  252. height: 90rpx;
  253. // width: 100%;
  254. background-color: #fff;
  255. display: flex;
  256. justify-content: space-between;
  257. font-size: 24rpx;
  258. .people {
  259. margin-left: 15rpx;
  260. color: #ff9800;
  261. }
  262. }
  263. .circuit {
  264. padding: 30rpx;
  265. box-sizing: border-box;
  266. margin: 10rpx;
  267. height: 246rpx;
  268. // width: 100%;
  269. background-color: #fff;
  270. font-size: 24rpx;
  271. .title {
  272. height: 62rpx;
  273. width: 100%;
  274. border-bottom: 0.5rpx solid #dedede;
  275. i {
  276. height: 20rpx;
  277. width: 8rpx;
  278. margin: 0 10rpx;
  279. border-radius: 5rpx;
  280. display: inline-block;
  281. }
  282. }
  283. .title-list {
  284. display: inline-block;
  285. height: 62rpx * 2;
  286. width: 100%;
  287. padding: 7.5rpx * 2;
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. .title-list-inner {
  292. width: 105rpx * 2;
  293. height: 90rpx;
  294. position: relative;
  295. .num {
  296. width: 30rpx;
  297. height: 30rpx;
  298. // background-color: #999999;
  299. // color: #ffffff;
  300. border-radius: 50%;
  301. text-align: center;
  302. line-height: 30rpx;
  303. position: absolute;
  304. left: 50%;
  305. transform: translateX(-50%);
  306. z-index: 1;
  307. }
  308. .title-list-inner-boder {
  309. height: 64rpx;
  310. // border: 1px dashed #999999;
  311. border-width: 1px;
  312. border-style: dashed;
  313. color: #999999;
  314. position: absolute;
  315. top: 15rpx;
  316. left: 0;
  317. right: 0;
  318. margin: 0 1px;
  319. line-height: 64rpx;
  320. text-align: center;
  321. }
  322. }
  323. .active {}
  324. }
  325. }
  326. .detriment {
  327. position: fixed;
  328. bottom: 0;
  329. left: 0;
  330. width: 100%;
  331. }
  332. .bottom_img {
  333. background-color: #fff;
  334. padding-bottom: 20rpx;
  335. .content-box {
  336. width: 100%;
  337. line-height: 40rpx;
  338. padding: 0 20rpx 50rpx 20rpx;
  339. line-height: 41rpx;
  340. image {
  341. width: 100%;
  342. }
  343. }
  344. }
  345. .subtitle {
  346. position: relative;
  347. font-size: 0.24rem;
  348. color: #999999;
  349. height: 45px;
  350. line-height: 45px;
  351. text-align: center;
  352. font-size: 14px;
  353. &:before {
  354. content: '';
  355. position: absolute;
  356. width: 10%;
  357. height: 1px;
  358. top: 50%;
  359. background-color: #999999;
  360. left: 25%;
  361. }
  362. &:after {
  363. content: '';
  364. position: absolute;
  365. width: 10%;
  366. height: 1px;
  367. top: 50%;
  368. background-color: #999999;
  369. right: 25%;
  370. }
  371. }
  372. .bottom_but {
  373. position: fixed;
  374. bottom: 0;
  375. left: 0;
  376. width: 100%;
  377. height: 100rpx;
  378. display: flex;
  379. z-index: 999;
  380. .home {
  381. margin-top: -20rpx;
  382. }
  383. .icon {
  384. margin-top: -18rpx;
  385. }
  386. .haggle {
  387. font-size: 32rpx;
  388. }
  389. view {
  390. font-size: 24rpx;
  391. background-color: #fff;
  392. display: flex;
  393. justify-content: space-around;
  394. align-items: center;
  395. flex-direction: column;
  396. // padding: 10rpx 0;
  397. }
  398. view:nth-child(1) {
  399. width: 200rpx;
  400. }
  401. .start {
  402. flex: 1;
  403. color: #ffffff;
  404. }
  405. .end {
  406. flex: 1;
  407. color: #ffffff;
  408. background-color: #ccc !important;
  409. }
  410. }
  411. </style>