app-shop-product.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <template>
  2. <view class="app-shop-product">
  3. <view class="app-mch dir-left-nowrap main-left cross-center">
  4. <view class="app-all-radio cross-center" @click="changeAllRadio(mch)" v-if="mch.new_status === 0 || editStatus">
  5. <view class="app-all" v-if="!mch.is_active"></view>
  6. <view class="app-all-active" v-else :class="theme+ '-m-back ' + theme"></view>
  7. </view>
  8. <view v-else class="app-all-radio cross-center">
  9. <view class="app-all app-all-n"></view>
  10. </view>
  11. <view class="dir-left-nowrap cross-center">
  12. <view class="t-omit app-mch-name" @click="navigateMch(mch)">{{mch.name}}</view>
  13. <view v-if="mch.new_status === 2" class="close-tip">已打烊</view>
  14. </view>
  15. </view>
  16. <view v-for="(good, index) in mch.goods_list" :key="index">
  17. <view class="app-product dir-left-nowrap cross-top" :class="{'no-border': index == mch.goods_list.length - 1}">
  18. <view class="app-single-radio dir-left-nowrap main-center cross-center">
  19. <view v-if="(good.new_status === 2 || good.new_status === 3 || good.new_status === 4 || good.new_status === 5) && !editStatus"
  20. class="app-invalid">失效</view>
  21. <view v-else-if="(good.new_status === 6 || mch.new_status === 2) && !editStatus" class="app-radio dir-top-nowrap main-center cross-center">
  22. <view class="disabled-radio"></view>
  23. </view>
  24. <view class="app-radio dir-top-nowrap main-center cross-center" v-else
  25. @click="changeSingleRadio(mch, good)">
  26. <view class="radio-single" v-if="!good.is_active"></view>
  27. <view class="radio-single-active" v-else :class="theme+ '-m-back ' + theme"></view>
  28. </view>
  29. </view>
  30. <view class="app-image" @click="jump(good)">
  31. <image :src="good.attrs.pic_url ? good.attrs.pic_url : good.goods.cover_pic"></image>
  32. </view>
  33. <view class="app-content" :style="{'margin-bottom': good.sign === 'wholesale' ? good.new_status == 0 || good.new_status == 6 ?'0' : '50rpx' : '30rpx'}">
  34. <view class="app-wholesale-title" v-if="good.sign === 'wholesale'" :class="{'app-failed-title': good.new_status !== 0}">
  35. <view v-if="good.new_status === 3 || good.new_status === 5" class="t-omit">{{good.goods.name}}</view>
  36. <view v-else class="t-omit-two">{{good.goods.name}}</view>
  37. <view class="rise-num dir-left-nowrap cross-center" :style="{'color': `${good.new_status !== 0 && good.new_status !== 6 ? '#999999' : good.new_status === 0 ? '#63be72': '#ff4544'}`}">
  38. <image v-if="good.new_status !== 0 && good.new_status !== 6" class="num-icon" src="/static/image/icon/grey.png"></image>
  39. <image v-else-if="good.new_status === 0" class="num-icon" src="/static/image/icon/friend-v.png"></image>
  40. <view>起批量 {{good.plugin_data.up_num}}{{good.goods.goodsWarehouse.unit}}</view>
  41. </view>
  42. </view>
  43. <text class="app-title" v-else :class="{'app-failed-title': good.new_status !== 0}">
  44. {{good.goods.name}}
  45. </text>
  46. <view class="app-specification-style" v-if="good.sign !== 'wholesale'">
  47. <text v-for="(item, index) in good.attrs.attr" v-bind:key="index">
  48. {{item.attr_group_name}}: {{item.attr_name}}
  49. </text>
  50. </view>
  51. <view class="app-miaosha dir-left-nowrap main-left cross-center" v-if="good.sign === 'miaosha'">
  52. <icon class="app-miaosha-icon"
  53. v-if="good.miaosha_status === 2 || good.miaosha_status === 1"></icon>
  54. <icon class="app-spike-icon" v-if="good.miaosha_status === 0"></icon>
  55. <view class="app-beginning" v-if="good.miaosha_status === 1">
  56. 秒杀中 还剩
  57. {{good.miaosha_string}}
  58. 结束
  59. </view>
  60. <text class="app-over" v-if="good.miaosha_status === 0">秒杀已结束</text>
  61. </view>
  62. <view class="app-miaosha dir-left-nowrap main-left cross-center" v-if="good.sign === 'flash_sale'">
  63. <icon class="app-flash-sale-icon"
  64. :class="theme + '-m-back ' + theme"
  65. v-if="good.flash_sale_status === 1"></icon>
  66. <icon class="app-flash-sale-spike-icon" v-if="good.flash_sale_status === 2 || good.flash_sale_status === 0"></icon>
  67. <view class="app-beginning" v-if="good.flash_sale_status === 1">
  68. 抢购中 还剩
  69. {{good.flash_sale_string}}
  70. 结束
  71. </view>
  72. <view class="app-beginning" v-if="good.flash_sale_status === 2">
  73. 抢购未开始 还剩
  74. {{good.flash_sale_string}}
  75. 开始
  76. </view>
  77. <text class="app-over" v-if="good.flash_sale_status === 0">抢购已结束</text>
  78. </view>
  79. <view class="dir-top-nowrap" v-if="good.new_status === 0 && good.sign !== 'wholesale'">
  80. <view class="reduce-price" v-if="good.reduce_price > 0 && good.new_status === 0">
  81. 比加入时降¥{{good.reduce_price}}
  82. </view>
  83. <view class="app-price-button dir-left-nowrap main-between cross-center">
  84. <text class="app-price" :class="theme+ '-m-text ' + theme">
  85. {{good.attrs.price}}
  86. </text>
  87. <view v-if="good.sign != 'wholesale'">
  88. <app-add-subtract
  89. v-model="mch.goods_list[index].num"
  90. :good_id="mch.goods_list[index].id"
  91. :stock="good.attrs.stock"
  92. @change="change"
  93. :theme="theme"
  94. ></app-add-subtract>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="app-failed-goods" v-else>
  99. <view v-if="good.new_status === 2"
  100. class="app-text dir-left-nowrap main-left cross-center">
  101. 商品已售罄,请联系卖家
  102. </view>
  103. <view v-else-if="good.new_status === 3"
  104. class="app-text dir-left-nowrap main-left cross-center">
  105. 商品已失效
  106. </view>
  107. <view v-else-if="good.new_status === 4"
  108. class="app-text dir-left-nowrap main-left cross-center">
  109. 商户已关闭
  110. </view>
  111. <view v-else-if="good.new_status === 5"
  112. class="app-text dir-left-nowrap main-left cross-center">
  113. 商品已下架
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="app-wholesale-style" :class="{'border': good.sign != 'wholesale'}" v-if="mch.mch_id == 0 && ((good.sign != 'wholesale' && mch.goods_list[index+1].sign === 'wholesale') || (good.sign === 'wholesale' && (good.new_status === 0 || good.new_status === 6)))">
  119. <view class="app-wholesale-attr dir-left-nowrap cross-center" v-for="(attr, idx) in good.attr_arr" :key="idx">
  120. <view class="app-single-radio dir-left-nowrap main-center cross-center">
  121. <view v-if="(good.new_status === 6 || mch.new_status === 2) && !editStatus" class="app-radio dir-top-nowrap main-center cross-center">
  122. <view class="disabled-radio"></view>
  123. </view>
  124. <view class="app-radio dir-top-nowrap main-center cross-center" v-else
  125. @click="changeSingleRadio(mch, attr)">
  126. <view class="radio-single" v-if="!attr.is_active"></view>
  127. <view class="radio-single-active" v-else :class="theme+ '-m-back ' + theme"></view>
  128. </view>
  129. </view>
  130. <view class="attr-wholesale-item main-between cross-center">
  131. <view class="attr-item-name">
  132. <text v-for="(item, index) in attr.attrs.attr" v-bind:key="index">
  133. <text v-if="index > 0">/</text>
  134. {{item.attr_name}}
  135. </text>
  136. <view :class="theme+ '-m-text ' + theme">¥{{attr.price ? attr.price : attr.attrs.price}}</view>
  137. </view>
  138. <app-add-subtract
  139. v-model="attr.num"
  140. :good_id="attr.id"
  141. background="#f5f5f5"
  142. :stock="attr.attr_info.stock"
  143. @change="change"
  144. :theme="theme"
  145. ></app-add-subtract>
  146. </view>
  147. </view>
  148. <view class="wholesale-total dir-right-nowrap cross-center" v-if="good.sign === 'wholesale' && (good.new_status === 0 || good.new_status === 6)">
  149. <view class="wholesale-total-price" :class="theme+ '-m-text ' + theme">¥{{good.price}}</view>
  150. <view>共{{good.attrs.num}}{{good.goods.goodsWarehouse.unit}}</view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. import appRadio from '../../../../components/basic-component/app-radio/app-radio.vue';
  158. import appAddSubtract from '../app-add-subtract/app-add-subtract.vue';
  159. export default {
  160. name: "app-shop-product",
  161. components: {
  162. 'app-radio': appRadio,
  163. 'app-add-subtract': appAddSubtract,
  164. },
  165. props: {
  166. mch: {
  167. type: Object
  168. },
  169. editStatus: {
  170. type: Boolean,
  171. default() {
  172. return false;
  173. }
  174. },
  175. theme: String
  176. },
  177. data() {
  178. return {
  179. timer: null,
  180. time: '0'
  181. }
  182. },
  183. methods: {
  184. navigateMch(mch) {
  185. if (mch.mch_id) {
  186. uni.navigateTo({
  187. url: `/plugins/mch/shop/shop?mch_id=${mch.mch_id}`
  188. });
  189. }
  190. },
  191. changeSingleRadio(mch, item) {
  192. this.$emit('changeSingleRadio', mch, item);
  193. },
  194. changeAllRadio(data) {
  195. this.$emit('changeRadioAll', data);
  196. },
  197. jump(good) {
  198. if (good.new_status !== 0) return;
  199. let url = ``;
  200. if (good.mch_id > 0) {
  201. url = `/plugins/mch/goods/goods?id=${good.goods.id}&mch_id=${good.mch_id}`;
  202. } else if (good.sign === 'miaosha') {
  203. url = `/plugins/miaosha/goods/goods?id=${good.goods.id}`;
  204. } else if (good.sign === 'flash-sale') {
  205. url = `/plugins/flash_sale/goods/goods?id=${good.goods.id}`;
  206. } else if (good.sign === 'wholesale') {
  207. url = `/plugins/wholesale/goods/goods?id=${good.goods.id}`;
  208. } else {
  209. url = `/pages/goods/goods?id=${good.goods.id}`;
  210. }
  211. uni.navigateTo({
  212. url
  213. });
  214. },
  215. change(number, id) {
  216. this.$emit('change', number, id, this.mch.mch_id);
  217. }
  218. },
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .app-shop-product {
  223. width: #{750rpx};
  224. background-color: #ffffff;
  225. margin-top: #{20rpx};
  226. >view:last-of-type {
  227. .app-wholesale-style {
  228. padding-bottom: 0;
  229. }
  230. }
  231. }
  232. .app-mch {
  233. border-bottom: #{1rpx} solid #e2e2e2;
  234. height: #{80rpx};
  235. width: 100%;
  236. .app-all-radio {
  237. width: #{94rpx};
  238. height: #{80rpx};
  239. .app-all {
  240. width: #{40rpx};
  241. height: #{40rpx};
  242. border-radius: 50%;
  243. margin-left: #{24rpx};
  244. background-color: white;
  245. border: #{2rpx} solid #cccccc;
  246. }
  247. .app-all-n {
  248. background-color: #cdcdcd !important;
  249. }
  250. .app-all-active {
  251. width: #{40rpx};
  252. height: #{40rpx};
  253. border-radius: 50%;
  254. margin-left: #{24rpx};
  255. background-repeat: repeat;
  256. background-size: 100% 100%;
  257. background-image: url("../../../../static/image/icon/yes-radio.png");
  258. }
  259. }
  260. .app-mch-name {
  261. max-width: #{522rpx};
  262. font-size: #{26rpx};
  263. color: #666666;
  264. }
  265. .close-tip {
  266. font-size: #{22rpx};
  267. height: #{32rpx};
  268. line-height: #{32rpx};
  269. border-radius: #{16rpx};
  270. padding: 0 #{8rpx};
  271. color: #fff;
  272. background-color: #c0c0c0;
  273. margin-left: #{20rpx};
  274. }
  275. }
  276. .app-product {
  277. width: 100%;
  278. margin-top: #{30rpx};
  279. &:last-of-type {
  280. border-bottom: #{1rpx} solid #e2e2e2;
  281. }
  282. &.no-border {
  283. border-bottom: 0;
  284. }
  285. .app-single-radio {
  286. width: #{84rpx};
  287. height: #{156rpx};
  288. .disabled-radio {
  289. width: #{40rpx};
  290. height: #{40rpx};
  291. border-radius: 50%;
  292. border: #{2rpx} solid #cccccc;
  293. background-color: #cdcdcd;
  294. }
  295. .app-radio {
  296. width: #{84rpx};
  297. height: #{156rpx};
  298. .radio-single {
  299. width: #{40rpx};
  300. height: #{40rpx};
  301. border-radius: 50%;
  302. background-color: white;
  303. border: #{2rpx} solid #cccccc;
  304. }
  305. .radio-single-active {
  306. width: #{40rpx};
  307. height: #{40rpx};
  308. border-radius: 50%;
  309. background-repeat: repeat;
  310. background-size: 100% 100%;
  311. background-image: url("../../../../static/image/icon/yes-radio.png");
  312. }
  313. }
  314. .app-invalid {
  315. width: #{64rpx};
  316. height: #{32rpx};
  317. line-height: #{32rpx};
  318. border-radius: #{16rpx};
  319. text-align: center;
  320. font-size: #{24rpx};
  321. color: #FFFFFF;
  322. background-color: #cdcdcd;
  323. }
  324. }
  325. .app-image {
  326. width: #{156rpx};
  327. height: #{156rpx};
  328. image {
  329. width: 100%;
  330. height: 100%;
  331. }
  332. }
  333. .app-content {
  334. width: #{466rpx};
  335. background-color: white;
  336. margin: 0 #{24rpx} #{30rpx} #{20rpx};
  337. .app-title {
  338. width: 100%;
  339. font-size: #{28rpx};
  340. color: #353535;
  341. word-break: break-all;
  342. text-overflow: ellipsis;
  343. display: -webkit-box;
  344. -webkit-box-orient: vertical;
  345. -webkit-line-clamp: 1;
  346. overflow: hidden;
  347. margin-bottom: #{10rpx};
  348. }
  349. .app-wholesale-title {
  350. width: 100%;
  351. font-size: #{28rpx};
  352. color: #353535;
  353. .rise-num {
  354. margin-top: #{10rpx};
  355. font-size: 24rpx;
  356. margin-bottom: 20rpx;
  357. .num-icon {
  358. width: 28rpx;
  359. max-height: 28rpx;
  360. margin-right: 12rpx;
  361. }
  362. }
  363. }
  364. .app-failed-title {
  365. color: #999999;
  366. }
  367. .app-specification-style {
  368. margin-bottom: #{16rpx};
  369. text {
  370. font-size: #{24rpx};
  371. color: #999999;
  372. margin-right: #{36rpx};
  373. }
  374. .wholesale-attr {
  375. font-size: 16rpx;
  376. background-color: #f5f5f5;
  377. border-radius: 16rpx;
  378. padding: 12rpx 16rpx;
  379. position: relative;
  380. .wholesale-attr-item {
  381. width: 90%;
  382. .attr-num {
  383. margin-left: 5rpx;
  384. }
  385. text {
  386. margin-right: 5rpx;
  387. }
  388. }
  389. .more-icon {
  390. position: absolute;
  391. height: 25rpx;
  392. width: 5rpx;
  393. bottom: 16rpx;
  394. right: 16rpx;
  395. }
  396. }
  397. }
  398. .app-miaosha {
  399. width: 100%;
  400. margin-bottom: #{24rpx};
  401. .app-miaosha-icon {
  402. width: #{29rpx};
  403. height: #{29rpx};
  404. background-repeat: no-repeat;
  405. background-size: 100% 100%;
  406. background-image: url("../../../../static/image/cart/miaosha.png");
  407. margin-right: #{12rpx};
  408. }
  409. .app-flash-sale-icon {
  410. width: #{29rpx};
  411. height: #{29rpx};
  412. background-repeat: no-repeat;
  413. background-size: 100% 100%;
  414. background-image: url("../../../../static/image/plugins/flash-sale-icon.png");
  415. margin-right: #{12rpx};
  416. }
  417. .app-flash-sale-spike-icon {
  418. width: #{29rpx};
  419. height: #{29rpx};
  420. background-repeat: no-repeat;
  421. background-size: 100% 100%;
  422. background-image: url("../../../../static/image/plugins/flash-sale-icon.png");
  423. margin-right: #{12rpx};
  424. background-color: #cdcdcd;
  425. }
  426. .app-spike-icon {
  427. width: #{29rpx};
  428. height: #{29rpx};
  429. background-repeat: no-repeat;
  430. background-size: 100% 100%;
  431. background-image: url("../../../../static/image/cart/spike-invalid.png");
  432. margin-right: #{12rpx};
  433. }
  434. .app-beginning {
  435. font-size: #{22rpx};
  436. color: #ff4544;
  437. }
  438. .app-over {
  439. font-size: #{22rpx};
  440. color: #999999;
  441. }
  442. }
  443. .app-failed-goods {
  444. width: 100%;
  445. .app-text {
  446. color: #353535;
  447. font-size: #{25rpx};
  448. }
  449. .app-spike {
  450. margin-bottom: #{24rpx};
  451. }
  452. .app-spike-icon {
  453. width: #{29rpx};
  454. height: #{29rpx};
  455. background-repeat: no-repeat;
  456. background-size: 100% 100%;
  457. background-image: url("../../../../static/image/cart/spike-invalid.png");
  458. margin-right: #{12rpx};
  459. }
  460. .app-spike-text {
  461. font-size: #{24rpx};
  462. color: #999999;
  463. }
  464. }
  465. .app-price-button {
  466. width: 100%;
  467. height: #{60rpx};
  468. .app-price {
  469. font-size: #{32rpx};
  470. }
  471. .app-price:before {
  472. content: '¥';
  473. font-size: #{24rpx};
  474. }
  475. }
  476. .reduce-price {
  477. color: #ff4544;
  478. font-size: #{24rpx};
  479. }
  480. }
  481. }
  482. .app-wholesale-style {
  483. background-color: #f7f7f7;
  484. padding-bottom: 20rpx;
  485. &.border {
  486. border-top: 1rpx solid #e2e2e2;
  487. }
  488. .wholesale-total {
  489. padding-right: 44rpx;
  490. height: 70rpx;
  491. background-color: #fff;
  492. border-top: 1rpx solid #e2e2e2;
  493. border-bottom: 1rpx solid #e2e2e2;
  494. font-size: 22rpx;
  495. color: #353535;
  496. .wholesale-total-price {
  497. font-size: 30rpx;
  498. height: 40rpx;
  499. margin-left: 20rpx;
  500. padding-left: 20rpx;
  501. border-left: 2rpx solid #e2e2e2;
  502. }
  503. }
  504. .app-wholesale-attr {
  505. padding-right: 24rpx;
  506. padding-bottom: 20rpx;
  507. background-color: #fff;
  508. &:first-of-type {
  509. padding-top: 20rpx;
  510. }
  511. .app-single-radio {
  512. width: #{84rpx};
  513. .disabled-radio {
  514. width: #{40rpx};
  515. height: #{40rpx};
  516. border-radius: 50%;
  517. border: #{2rpx} solid #cccccc;
  518. background-color: #cdcdcd;
  519. }
  520. .app-radio {
  521. width: #{84rpx};
  522. .radio-single {
  523. width: #{40rpx};
  524. height: #{40rpx};
  525. border-radius: 50%;
  526. background-color: white;
  527. border: #{2rpx} solid #cccccc;
  528. }
  529. .radio-single-active {
  530. width: #{40rpx};
  531. height: #{40rpx};
  532. border-radius: 50%;
  533. background-repeat: repeat;
  534. background-size: 100% 100%;
  535. background-image: url("../../../../static/image/icon/yes-radio.png");
  536. }
  537. }
  538. }
  539. .attr-wholesale-item {
  540. width: 640rpx;
  541. background-color: #f5f5f5;
  542. min-height: 100rpx;
  543. padding: 20rpx;
  544. .attr-item-name {
  545. font-size: 22rpx;
  546. width: 400rpx;
  547. text {
  548. color: #666666;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. </style>