specs_1.vue 12 KB

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