specs_1.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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&&specfileList.length>0?specfileList[0].url:goodsfileList&&goodsfileList.length>0?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.file && val.goods.file.length > 0) {
  226. this.$set(this, `goodsfileList`, val.goods.file)
  227. }
  228. if (val && val.act && val.act.length > 0) this.$set(this, `actList`, val?.act)
  229. if (val && val.sets && val.sets.length > 0) this.$set(this, `setList`, val?.sets)
  230. if (val && val.specs && val.specs.length > 0) this.$set(this, `specsList`, val?.specs)
  231. }
  232. }
  233. },
  234. }
  235. </script>
  236. <style lang="scss">
  237. .specs {
  238. position: relative;
  239. display: flex;
  240. flex-direction: column;
  241. height: 54vh;
  242. .specs_1 {
  243. position: relative;
  244. display: flex;
  245. flex-direction: column;
  246. height: 54vh;
  247. .info_1 {
  248. position: relative;
  249. flex-grow: 1;
  250. .one {
  251. padding: 2vw;
  252. .one_1 {
  253. display: flex;
  254. margin: 0 0 2vw 0;
  255. padding: 0 0 2vw 0;
  256. border-bottom: 0.5vw solid var(--f9Color);
  257. .l {
  258. width: 25vw;
  259. height: 25vw;
  260. .image {
  261. width: 100%;
  262. height: 100%;
  263. border-radius: 5px;
  264. }
  265. }
  266. .r {
  267. width: 70vw;
  268. padding: 0 0 0 2vw;
  269. .money {
  270. margin: 0 0 2vw 0;
  271. .money_2 {
  272. color: #23B67A;
  273. font-size: 20px;
  274. padding: 0 1vw 0 0;
  275. font-weight: bold;
  276. text {
  277. font-size: 14px;
  278. }
  279. }
  280. .money_1 {
  281. font-size: 20px;
  282. color: var(--fFB1Color);
  283. padding: 0 2vw 0 0;
  284. text {
  285. font-size: 14px;
  286. }
  287. }
  288. .money_1:last-child {
  289. font-size: 16px;
  290. color: #858585;
  291. text-decoration: line-through;
  292. }
  293. }
  294. .other_1 {
  295. font-size: 15px;
  296. color: #858585;
  297. text:last-child {
  298. color: #000000;
  299. }
  300. }
  301. }
  302. }
  303. .one_2 {
  304. margin: 0 0 2vw 0;
  305. border-bottom: 0.5vw solid var(--f9Color);
  306. .one_2_1 {
  307. font-size: 14px;
  308. margin: 0 0 2vw 0;
  309. }
  310. .one_2_2 {
  311. display: flex;
  312. flex-wrap: wrap;
  313. .list {
  314. background-color: #F5F5F5;
  315. margin: 0 2vw 2vw 0;
  316. padding: 0.5vw 1vw;
  317. border-radius: 5px;
  318. text {
  319. font-size: 14px;
  320. color: #000;
  321. }
  322. }
  323. .huilist {
  324. background-color: #DCDCDC;
  325. text {
  326. color: #858585;
  327. }
  328. }
  329. .redlist {
  330. background-color: var(--fFB1Color);
  331. text {
  332. color: #ffffff;
  333. }
  334. }
  335. .huiilist {
  336. background-color: #808080;
  337. text {
  338. color: #cccccc;
  339. }
  340. }
  341. }
  342. }
  343. .one_3 {
  344. display: flex;
  345. .one_3_1 {
  346. margin: 0 2vw 0 0;
  347. text {
  348. font-size: 14px;
  349. color: #858585;
  350. }
  351. .limit {
  352. color: var(--fFB1Color);
  353. padding: 0 0 0 2vw;
  354. }
  355. }
  356. }
  357. }
  358. }
  359. .info_2 {
  360. display: flex;
  361. text-align: center;
  362. justify-content: space-between;
  363. .btns {
  364. width: 50vw;
  365. }
  366. .btn {
  367. width: 100vw;
  368. }
  369. button {
  370. width: 100%;
  371. border-radius: 0;
  372. background-color: var(--fFB1Color);
  373. color: #fff;
  374. border: 1px solid #f1f1f1;
  375. }
  376. .btncolor {
  377. background: #f1f1f1;
  378. color: #858585;
  379. }
  380. }
  381. }
  382. .specs_2 {
  383. position: relative;
  384. flex-grow: 1;
  385. .list {
  386. margin: 0 2vw 2vw 2vw;
  387. border-radius: 10px;
  388. background-color: #FFF8DC;
  389. .list_1 {
  390. padding: 2vw;
  391. font-size: 14px;
  392. .title_1 {
  393. display: flex;
  394. justify-content: space-between;
  395. margin: 1vw 0;
  396. .l {
  397. text {
  398. margin: 0 1vw 0 0;
  399. font-size: 12px;
  400. border-radius: 5px;
  401. border: 0.5px solid var(--fFB1Color);
  402. color: var(--fFB1Color);
  403. }
  404. }
  405. }
  406. .title_2 {
  407. .specList {
  408. .name {
  409. margin: 0 0 1vw 0;
  410. }
  411. .giftList {
  412. display: flex;
  413. justify-content: space-between;
  414. align-items: center;
  415. margin: 0 0 1vw 0;
  416. border: 0.5px solid var(--f9Color);
  417. border-radius: 10px;
  418. .left {
  419. width: 85vw;
  420. }
  421. }
  422. }
  423. .text {
  424. color: var(--fFB1Color);
  425. }
  426. }
  427. }
  428. }
  429. }
  430. .specs_3 {
  431. position: relative;
  432. flex-grow: 1;
  433. .list {
  434. margin: 0 2vw 2vw 2vw;
  435. border-radius: 10px;
  436. background-color: var(--f9Color);
  437. .name {
  438. display: flex;
  439. padding: 2vw;
  440. font-size: 14px;
  441. .set {
  442. margin: 0 1vw 0 0;
  443. font-size: 12px;
  444. border-radius: 5px;
  445. padding: 0 1vw;
  446. color: #ffffff;
  447. background-color: #FF6347;
  448. border: 1px solid #FFA500;
  449. }
  450. }
  451. .set {
  452. display: flex;
  453. justify-content: space-around;
  454. flex-wrap: wrap;
  455. margin: 0 2vw;
  456. padding: 2vw;
  457. background-color: #fff;
  458. border-radius: 5px;
  459. .set_1 {
  460. width: 25vw;
  461. text-align: center;
  462. font-size: 14px;
  463. .spec {
  464. font-size: 12px;
  465. color: #858585;
  466. }
  467. .image {
  468. width: 20vw;
  469. height: 20vw;
  470. border-radius: 5px;
  471. background-color: #fff;
  472. }
  473. }
  474. }
  475. .bottom {
  476. display: flex;
  477. justify-content: space-between;
  478. align-items: center;
  479. padding: 2vw;
  480. .money {
  481. font-size: 12px;
  482. text {
  483. color: var(--fFB1Color);
  484. }
  485. }
  486. .add {
  487. button {
  488. background-color: var(--fFB1Color);
  489. color: #ffffff;
  490. border-radius: 5vw;
  491. }
  492. }
  493. }
  494. }
  495. }
  496. }
  497. </style>