specs_1.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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>
  138. </template>
  139. <script>
  140. export default {
  141. props: {
  142. info: {
  143. type: Object,
  144. },
  145. specsInfo: {
  146. type: Object,
  147. },
  148. btn_type: {
  149. type: String
  150. },
  151. popupShow: {
  152. type: String
  153. },
  154. is_specs: {
  155. type: Number
  156. },
  157. is_zero: {
  158. type: Boolean
  159. },
  160. dialog: {
  161. type: Object,
  162. },
  163. },
  164. data() {
  165. return {
  166. // 商品图片
  167. goodsfileList: [],
  168. // 规格图片
  169. specfileList: [],
  170. actList: [],
  171. setList: [],
  172. specsList: [],
  173. buy_num: 1,
  174. };
  175. },
  176. methods: {
  177. diaView() {
  178. const that = this;
  179. that.$emit('diaView')
  180. },
  181. toSpecs(item) {
  182. const that = this;
  183. that.$emit('toSpecs', item)
  184. },
  185. toCount(e) {
  186. const that = this;
  187. that.$emit('toCount', e)
  188. },
  189. toMarket() {
  190. const that = this;
  191. that.$emit('toMarket')
  192. },
  193. toBuy() {
  194. const that = this;
  195. that.$emit('toBuy')
  196. },
  197. toGroup() {
  198. const that = this;
  199. that.$emit('toGroup')
  200. },
  201. toAct(item) {
  202. const that = this;
  203. that.$emit('toAct', item)
  204. },
  205. getDetail(item) {
  206. const that = this;
  207. that.$emit('getDetail', item)
  208. },
  209. toSetMarket(item) {
  210. const that = this;
  211. that.$emit('toSetMarket', item)
  212. },
  213. diaSpecs() {
  214. const that = this;
  215. that.$emit('diaSpecs')
  216. },
  217. toDeatil(item) {
  218. const that = this;
  219. that.$emit('toDeatil', item)
  220. },
  221. },
  222. watch: {
  223. specsInfo: {
  224. deep: true,
  225. immediate: true,
  226. handler(val) {
  227. if (val && val.file && val.file.length > 0) this.$set(this, `specfileList`, val?.file)
  228. }
  229. },
  230. info: {
  231. deep: true,
  232. immediate: true,
  233. handler(val) {
  234. if (val && val.goods && val?.goods.length > 0) {
  235. this.$set(this, `goodsInfo`, val?.goods)
  236. if (val.goods && val.goods.file && val.goods.file.length > 0) {
  237. this.$set(this, `goodsfileList`, val.goods.file)
  238. }
  239. }
  240. if (val && val.act && val.act.length > 0) this.$set(this, `actList`, val?.act)
  241. if (val && val.sets && val.sets.length > 0) this.$set(this, `setList`, val?.sets)
  242. if (val && val.specs && val.specs.length > 0) this.$set(this, `specsList`, val?.specs)
  243. }
  244. }
  245. },
  246. }
  247. </script>
  248. <style lang="scss">
  249. .specs {
  250. position: relative;
  251. display: flex;
  252. flex-direction: column;
  253. height: 54vh;
  254. .specs_1 {
  255. position: relative;
  256. display: flex;
  257. flex-direction: column;
  258. height: 54vh;
  259. .info_1 {
  260. position: relative;
  261. flex-grow: 1;
  262. .one {
  263. padding: 2vw;
  264. .one_1 {
  265. display: flex;
  266. margin: 0 0 2vw 0;
  267. padding: 0 0 2vw 0;
  268. border-bottom: 0.5vw solid var(--f9Color);
  269. .l {
  270. width: 25vw;
  271. height: 25vw;
  272. .image {
  273. width: 100%;
  274. height: 100%;
  275. border-radius: 5px;
  276. }
  277. }
  278. .r {
  279. width: 70vw;
  280. padding: 0 0 0 2vw;
  281. .money {
  282. margin: 0 0 2vw 0;
  283. .money_2 {
  284. color: #23B67A;
  285. font-size: 20px;
  286. padding: 0 1vw 0 0;
  287. font-weight: bold;
  288. text {
  289. font-size: 14px;
  290. }
  291. }
  292. .money_1 {
  293. font-size: 20px;
  294. color: #ff0000;
  295. padding: 0 2vw 0 0;
  296. text {
  297. font-size: 14px;
  298. }
  299. }
  300. .money_1:last-child {
  301. font-size: 16px;
  302. color: #858585;
  303. text-decoration: line-through;
  304. }
  305. }
  306. .other_1 {
  307. font-size: 15px;
  308. color: #858585;
  309. text:last-child {
  310. color: #000000;
  311. }
  312. }
  313. }
  314. }
  315. .one_2 {
  316. margin: 0 0 2vw 0;
  317. border-bottom: 0.5vw solid var(--f9Color);
  318. .one_2_1 {
  319. font-size: 14px;
  320. margin: 0 0 2vw 0;
  321. }
  322. .one_2_2 {
  323. display: flex;
  324. flex-wrap: wrap;
  325. .list {
  326. background-color: #F5F5F5;
  327. margin: 0 2vw 2vw 0;
  328. padding: 0.5vw 1vw;
  329. border-radius: 5px;
  330. text {
  331. font-size: 14px;
  332. color: #000;
  333. }
  334. }
  335. .huilist {
  336. background-color: #DCDCDC;
  337. text {
  338. color: #858585;
  339. }
  340. }
  341. .redlist {
  342. background-color: #ff0000;
  343. text {
  344. color: #ffffff;
  345. }
  346. }
  347. .huiilist {
  348. background-color: #808080;
  349. text {
  350. color: #cccccc;
  351. }
  352. }
  353. }
  354. }
  355. .one_3 {
  356. display: flex;
  357. .one_3_1 {
  358. margin: 0 2vw 0 0;
  359. text {
  360. font-size: 14px;
  361. color: #858585;
  362. }
  363. .limit {
  364. color: #ff0000;
  365. padding: 0 0 0 2vw;
  366. }
  367. }
  368. }
  369. }
  370. }
  371. .info_2 {
  372. display: flex;
  373. text-align: center;
  374. justify-content: space-between;
  375. .btns {
  376. width: 50vw;
  377. }
  378. .btn {
  379. width: 100vw;
  380. }
  381. button {
  382. width: 100%;
  383. border-radius: 0;
  384. background-color: var(--fFB1Color);
  385. color: #fff;
  386. border: 1px solid #f1f1f1;
  387. }
  388. .btncolor {
  389. background: #f1f1f1;
  390. color: #858585;
  391. }
  392. }
  393. }
  394. .specs_2 {
  395. position: relative;
  396. flex-grow: 1;
  397. .list {
  398. margin: 0 2vw 2vw 2vw;
  399. border-radius: 10px;
  400. background-color: #FFF8DC;
  401. .list_1 {
  402. padding: 2vw;
  403. font-size: 14px;
  404. .title_1 {
  405. display: flex;
  406. justify-content: space-between;
  407. margin: 1vw 0;
  408. .l {
  409. text {
  410. margin: 0 1vw 0 0;
  411. font-size: 12px;
  412. border-radius: 5px;
  413. border: 0.5px solid var(--fFB1Color);
  414. color: var(--fFB1Color);
  415. }
  416. }
  417. }
  418. .title_2 {
  419. .specList {
  420. .name {
  421. margin: 0 0 1vw 0;
  422. }
  423. .giftList {
  424. display: flex;
  425. justify-content: space-between;
  426. align-items: center;
  427. margin: 0 0 1vw 0;
  428. border: 0.5px solid var(--f9Color);
  429. border-radius: 10px;
  430. .left {
  431. width: 85vw;
  432. }
  433. }
  434. }
  435. .text {
  436. color: var(--fFB1Color);
  437. }
  438. }
  439. }
  440. }
  441. }
  442. .specs_3 {
  443. position: relative;
  444. flex-grow: 1;
  445. .list {
  446. margin: 0 2vw 2vw 2vw;
  447. border-radius: 10px;
  448. background-color: var(--f9Color);
  449. .name {
  450. display: flex;
  451. padding: 2vw;
  452. font-size: 14px;
  453. .set {
  454. margin: 0 1vw 0 0;
  455. font-size: 12px;
  456. border-radius: 5px;
  457. padding: 0 1vw;
  458. color: #ffffff;
  459. background-color: #FF6347;
  460. border: 1px solid #FFA500;
  461. }
  462. }
  463. .set {
  464. display: flex;
  465. justify-content: space-around;
  466. flex-wrap: wrap;
  467. margin: 0 2vw;
  468. padding: 2vw;
  469. background-color: #fff;
  470. border-radius: 5px;
  471. .set_1 {
  472. width: 25vw;
  473. text-align: center;
  474. font-size: 14px;
  475. .spec {
  476. font-size: 12px;
  477. color: #858585;
  478. }
  479. .image {
  480. width: 20vw;
  481. height: 20vw;
  482. border-radius: 5px;
  483. background-color: #fff;
  484. }
  485. }
  486. }
  487. .bottom {
  488. display: flex;
  489. justify-content: space-between;
  490. align-items: center;
  491. padding: 2vw;
  492. .money {
  493. font-size: 12px;
  494. text {
  495. color: #ff0000;
  496. }
  497. }
  498. .add {
  499. button {
  500. background-color: #ff0000;
  501. color: #ffffff;
  502. border-radius: 5vw;
  503. }
  504. }
  505. }
  506. }
  507. }
  508. }
  509. </style>