specs_1.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <template>
  2. <view class="specs">
  3. <!-- 规格 -->
  4. <view class="specs_1" v-if="popupShow=='1'">
  5. <view class="info_1">
  6. <scroll-view scroll-y="true" class="scroll-view">
  7. <view class="list-scroll-view">
  8. <view class="one">
  9. <view class="one_1">
  10. <view class="l">
  11. <image class="image"
  12. :src="specfileList.length>0?specfileList[0].url:goodsfileList[0].url"
  13. mode="aspectFill" @tap="diaView"></image>
  14. </view>
  15. <view class="r">
  16. <view class="money">
  17. <text v-if="specsInfo.leader_price"
  18. class="money_2"><text>团长价¥</text>{{specsInfo.leader_price}}</text>
  19. <text v-if="specsInfo.price"
  20. class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
  21. <text v-if="!specsInfo.price&&!specsInfo.leader_price"
  22. class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
  23. <text class="money_1"><text>¥</text>{{specsInfo.flow_money}}</text>
  24. </view>
  25. <view class="other_1">
  26. <text>已选:</text>
  27. <text>{{specsInfo.name}}</text>
  28. </view>
  29. <view class="other_1">
  30. <text>运费:</text>
  31. <text>{{specsInfo.freight===0?'包邮':specsInfo.freight+'元'}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="one_2">
  36. <view class="one_2_1">
  37. 规格
  38. </view>
  39. <view class="one_2_2">
  40. <view
  41. :class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
  42. v-for="(item,index) in specsList" :key="index" @tap="toSpecs(item)">
  43. <text>{{item.name}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="one_3">
  48. <view class="one_3_1">
  49. <text>数量</text>
  50. </view>
  51. <view class="one_3_1">
  52. <uni-number-box v-model="buy_num" @change="toCount" :min="1" :max="specsInfo.num">
  53. </uni-number-box>
  54. </view>
  55. <view class="one_3_1">
  56. <text>库存{{specsInfo.num||0}}</text><text class="limit"
  57. v-if="specsInfo.limit_num">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </scroll-view>
  63. </view>
  64. <view class="info_2">
  65. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='0'">
  66. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toMarket">加入购物车</button>
  67. </view>
  68. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='1'">
  69. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toBuy">立即购买</button>
  70. </view>
  71. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="specsInfo.can_group=='0'">
  72. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toGroup">我要开团</button>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="specs_2" v-else-if="popupShow=='2'">
  77. <scroll-view scroll-y="true" class="scroll-view">
  78. <view class="list" v-for="(item,index) in actList" :key="index">
  79. <view class="list_1" @tap="toAct(item)">
  80. <view class="title_1">
  81. <view class="l">
  82. <text>{{item.tag||'暂无'}}</text>{{item.act_time.title}}
  83. </view>
  84. <view class="r">
  85. <text class="iconfont icon-jiantouyou"></text>
  86. </view>
  87. </view>
  88. <view class="title_2">
  89. <view class="text" v-if="item.type=='5'||item.type=='6'">{{item.text}}</view>
  90. <view class="time">{{item.config.time_start}}-{{item.config.time_end}}</view>
  91. </view>
  92. <view class="title_2" v-if="item.type=='2'">
  93. <view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
  94. <view class="name">规格:{{tag.spec_name}}</view>
  95. <view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
  96. @tap.stop="tags.type=='0' && getDetail(tags)">
  97. <view class="left">
  98. <view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
  99. <view class="goods">{{tags.desc}}</view>
  100. <view class="num">×{{tags.num}}</view>
  101. </view>
  102. <view class="right"><text class="iconfont icon-jiantouyou"></text>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </scroll-view>
  110. </view>
  111. <view class="specs_3" v-else>
  112. <scroll-view scroll-y="true" class="scroll-view">
  113. <view class="list-scroll-view">
  114. <view class="list" v-for="(item,index) in setList" :key="index">
  115. <view class="name"><text class="set">套装</text>{{item.name}}</view>
  116. <view class="set">
  117. <view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx" @tap="toDeatil(tag)">
  118. <image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
  119. mode="aspectFit">
  120. </image>
  121. <view class="goods textOver">{{tag.goods_name}}</view>
  122. <view class="spec textOver">{{tag.spec_name}}</view>
  123. </view>
  124. </view>
  125. <view class="bottom">
  126. <view class="money">
  127. 共{{item.goods_total||0}}件,套装价:<text>¥{{item.sell_money||0}}</text>
  128. </view>
  129. <view class="add">
  130. <button size="mini" @tap="toSetMarket(item)">加入购物车</button>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </scroll-view>
  136. </view>
  137. <view class="dialog" v-if="dialog.show==true" @tap="dialogClose">
  138. <view class="dialog_1" v-if="dialog.type=='1'">
  139. <swiper class="swiper" circular @change="diaSpecs" :current="is_specs">
  140. <swiper-item class="list" v-for="(item,index) in specsList" :key="index">
  141. <view class="list_1">
  142. <image class="image"
  143. :src="item.file&&item.file.length>0?item.file[0].url:info.goods.file[0].url"
  144. mode="aspectFit"></image>
  145. </view>
  146. <view class="name">
  147. <text>{{item.name}}</text>
  148. </view>
  149. </swiper-item>
  150. </swiper>
  151. </view>
  152. </view>
  153. </view>
  154. </template>
  155. <script>
  156. export default {
  157. props: {
  158. goodsInfo: {
  159. type: Object,
  160. },
  161. info: {
  162. type: Object,
  163. },
  164. specsInfo: {
  165. type: Object,
  166. },
  167. btn_type: {
  168. type: String
  169. },
  170. popupShow: {
  171. type: String
  172. },
  173. is_specs: {
  174. type: Number
  175. },
  176. buy_num: {
  177. type: Number
  178. },
  179. is_zero: {
  180. type: Boolean
  181. },
  182. dialog: {
  183. type: Object,
  184. },
  185. },
  186. data() {
  187. return {
  188. // 商品图片
  189. goodsfileList: [],
  190. // 规格图片
  191. specfileList: [],
  192. actList: [],
  193. setList: [],
  194. specsList: [],
  195. };
  196. },
  197. methods: {
  198. diaView() {
  199. const that = this;
  200. that.$emit('diaView')
  201. },
  202. toSpecs(item) {
  203. const that = this;
  204. that.$emit('toSpecs', item)
  205. },
  206. toCount() {
  207. const that = this;
  208. that.$emit('toCount')
  209. },
  210. toMarket() {
  211. const that = this;
  212. that.$emit('toMarket')
  213. },
  214. toBuy() {
  215. const that = this;
  216. that.$emit('toBuy')
  217. },
  218. toGroup() {
  219. const that = this;
  220. that.$emit('toGroup')
  221. },
  222. toAct(item) {
  223. const that = this;
  224. that.$emit('toAct', item)
  225. },
  226. getDetail(item) {
  227. const that = this;
  228. that.$emit('getDetail', item)
  229. },
  230. toSetMarket(item) {
  231. const that = this;
  232. that.$emit('toSetMarket', item)
  233. },
  234. dialogClose() {
  235. const that = this;
  236. that.$emit('dialogClose')
  237. },
  238. diaSpecs() {
  239. const that = this;
  240. that.$emit('diaSpecs')
  241. },
  242. },
  243. watch: {
  244. specsInfo: {
  245. deep: true,
  246. immediate: true,
  247. handler(val) {
  248. if (val && val?.file.length > 0) this.$set(this, `specfileList`, val?.file)
  249. }
  250. },
  251. goodsInfo: {
  252. deep: true,
  253. immediate: true,
  254. handler(val) {
  255. if (val && val?.file.length > 0) this.$set(this, `goodsfileList`, val?.file)
  256. }
  257. },
  258. info: {
  259. deep: true,
  260. immediate: true,
  261. handler(val) {
  262. if (val && val?.act.length > 0) this.$set(this, `actList`, val?.act)
  263. if (val && val?.sets.length > 0) this.$set(this, `setList`, val?.sets)
  264. if (val && val?.specs.length > 0) this.$set(this, `specsList`, val?.specs)
  265. }
  266. }
  267. },
  268. }
  269. </script>
  270. <style lang="scss">
  271. .specs {
  272. .specs_1 {
  273. position: relative;
  274. display: flex;
  275. flex-direction: column;
  276. height: 54vh;
  277. .info_1 {
  278. position: relative;
  279. flex-grow: 1;
  280. .one {
  281. padding: 2vw;
  282. .one_1 {
  283. display: flex;
  284. margin: 0 0 2vw 0;
  285. padding: 0 0 2vw 0;
  286. border-bottom: 0.5vw solid var(--f9Color);
  287. .l {
  288. width: 25vw;
  289. height: 25vw;
  290. .image {
  291. width: 100%;
  292. height: 100%;
  293. border-radius: 5px;
  294. }
  295. }
  296. .r {
  297. width: 70vw;
  298. padding: 0 0 0 2vw;
  299. .money {
  300. margin: 0 0 2vw 0;
  301. .money_2 {
  302. color: #23B67A;
  303. font-size: 20px;
  304. padding: 0 1vw 0 0;
  305. font-weight: bold;
  306. text {
  307. font-size: 14px;
  308. }
  309. }
  310. .money_1 {
  311. font-size: 20px;
  312. color: #ff0000;
  313. padding: 0 2vw 0 0;
  314. text {
  315. font-size: 14px;
  316. }
  317. }
  318. .money_1:last-child {
  319. font-size: 16px;
  320. color: #858585;
  321. text-decoration: line-through;
  322. }
  323. }
  324. .other_1 {
  325. font-size: 15px;
  326. color: #858585;
  327. text:last-child {
  328. color: #000000;
  329. }
  330. }
  331. }
  332. }
  333. .one_2 {
  334. margin: 0 0 2vw 0;
  335. border-bottom: 0.5vw solid var(--f9Color);
  336. .one_2_1 {
  337. font-size: 14px;
  338. margin: 0 0 2vw 0;
  339. }
  340. .one_2_2 {
  341. display: flex;
  342. flex-wrap: wrap;
  343. .list {
  344. background-color: #F5F5F5;
  345. margin: 0 2vw 2vw 0;
  346. padding: 0.5vw 1vw;
  347. border-radius: 5px;
  348. text {
  349. font-size: 14px;
  350. color: #000;
  351. }
  352. }
  353. .huilist {
  354. background-color: #DCDCDC;
  355. text {
  356. color: #858585;
  357. }
  358. }
  359. .redlist {
  360. background-color: #ff0000;
  361. text {
  362. color: #ffffff;
  363. }
  364. }
  365. .huiilist {
  366. background-color: #808080;
  367. text {
  368. color: #cccccc;
  369. }
  370. }
  371. }
  372. }
  373. .one_3 {
  374. display: flex;
  375. .one_3_1 {
  376. margin: 0 2vw 0 0;
  377. text {
  378. font-size: 14px;
  379. color: #858585;
  380. }
  381. .limit {
  382. color: #ff0000;
  383. padding: 0 0 0 2vw;
  384. }
  385. }
  386. }
  387. }
  388. }
  389. .info_2 {
  390. display: flex;
  391. text-align: center;
  392. justify-content: space-between;
  393. .btns {
  394. width: 50vw;
  395. }
  396. .btn {
  397. width: 100vw;
  398. }
  399. button {
  400. width: 100%;
  401. border-radius: 0;
  402. background-color: var(--fFB1Color);
  403. color: #fff;
  404. border: 1px solid #f1f1f1;
  405. }
  406. .btncolor {
  407. background: #f1f1f1;
  408. color: #858585;
  409. }
  410. }
  411. }
  412. .specs_2 {
  413. position: relative;
  414. flex-grow: 1;
  415. .list {
  416. margin: 0 2vw 2vw 2vw;
  417. border-radius: 10px;
  418. background-color: #FFF8DC;
  419. .list_1 {
  420. padding: 2vw;
  421. font-size: 14px;
  422. .title_1 {
  423. display: flex;
  424. justify-content: space-between;
  425. margin: 1vw 0;
  426. .l {
  427. text {
  428. margin: 0 1vw 0 0;
  429. font-size: 12px;
  430. border-radius: 5px;
  431. border: 0.5px solid var(--fFB1Color);
  432. color: var(--fFB1Color);
  433. }
  434. }
  435. }
  436. .title_2 {
  437. .specList {
  438. .name {
  439. margin: 0 0 1vw 0;
  440. }
  441. .giftList {
  442. display: flex;
  443. justify-content: space-between;
  444. align-items: center;
  445. margin: 0 0 1vw 0;
  446. border: 0.5px solid var(--f9Color);
  447. border-radius: 10px;
  448. .left {
  449. width: 85vw;
  450. }
  451. }
  452. }
  453. .text {
  454. color: var(--fFB1Color);
  455. }
  456. }
  457. }
  458. }
  459. }
  460. .specs_3 {
  461. position: relative;
  462. flex-grow: 1;
  463. .list {
  464. margin: 0 2vw 2vw 2vw;
  465. border-radius: 10px;
  466. background-color: var(--f9Color);
  467. .name {
  468. display: flex;
  469. padding: 2vw;
  470. font-size: 14px;
  471. .set {
  472. margin: 0 1vw 0 0;
  473. font-size: 12px;
  474. border-radius: 5px;
  475. padding: 0 1vw;
  476. color: #ffffff;
  477. background-color: #FF6347;
  478. border: 1px solid #FFA500;
  479. }
  480. }
  481. .set {
  482. display: flex;
  483. justify-content: space-around;
  484. flex-wrap: wrap;
  485. margin: 0 2vw;
  486. padding: 2vw;
  487. background-color: #fff;
  488. border-radius: 5px;
  489. .set_1 {
  490. width: 25vw;
  491. text-align: center;
  492. font-size: 14px;
  493. .spec {
  494. font-size: 12px;
  495. color: #858585;
  496. }
  497. .image {
  498. width: 20vw;
  499. height: 20vw;
  500. border-radius: 5px;
  501. background-color: #fff;
  502. }
  503. }
  504. }
  505. .bottom {
  506. display: flex;
  507. justify-content: space-between;
  508. align-items: center;
  509. padding: 2vw;
  510. .money {
  511. font-size: 12px;
  512. text {
  513. color: #ff0000;
  514. }
  515. }
  516. .add {
  517. button {
  518. background-color: #ff0000;
  519. color: #ffffff;
  520. border-radius: 5vw;
  521. }
  522. }
  523. }
  524. }
  525. }
  526. .dialog {
  527. position: fixed;
  528. width: 100vw;
  529. height: 100vh;
  530. background-color: #000000;
  531. z-index: 99999;
  532. display: flex;
  533. flex-direction: column;
  534. justify-content: center;
  535. swiper {
  536. height: 60vh;
  537. }
  538. .list {
  539. .list_1 {
  540. padding: 2vw;
  541. margin: 0 0 5vw 0;
  542. .image {
  543. width: 100%;
  544. height: 40vh;
  545. }
  546. }
  547. .name {
  548. text-align: center;
  549. margin: 0 10vw;
  550. background-color: #6666669f;
  551. border-radius: 25px;
  552. padding: 2vw;
  553. text {
  554. color: #fff;
  555. font-size: 15px;
  556. overflow: hidden;
  557. text-overflow: ellipsis;
  558. -webkit-line-clamp: 2;
  559. word-break: break-all;
  560. display: -webkit-box;
  561. -webkit-box-orient: vertical;
  562. }
  563. }
  564. }
  565. }
  566. }
  567. </style>