app-shop-product.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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></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. <text class="app-mch-name">{{mch.name}}</text>
  12. </view>
  13. <view class="app-product dir-left-nowrap cross-top" v-for="(good, index) in mch.goods_list" :key="index">
  14. <view class="app-single-radio dir-left-nowrap main-center cross-center">
  15. <view v-if="good.new_status !== 0 && !editStatus" class="app-invalid">失效</view>
  16. <view class="app-radio dir-top-nowrap main-center cross-center" v-else
  17. @click="changeSingleRadio(mch, good)">
  18. <view class="radio-single" v-if="!good.is_active"></view>
  19. <view class="radio-single-active" v-else></view>
  20. </view>
  21. </view>
  22. <view class="app-image" @click="jump(good)">
  23. <image :src="good.attrs.pic_url ? good.attrs.pic_url : good.goods.cover_pic"></image>
  24. </view>
  25. <view class="app-content">
  26. <text class="app-title" :class="{'app-failed-title': good.new_status !== 0}">
  27. {{good.goods.name}}
  28. </text>
  29. <view class="app-specification-style">
  30. <text v-for="(item, index) in good.attrs.attr" v-bind:key="index">
  31. {{item.attr_group_name}}: {{item.attr_name}}
  32. </text>
  33. </view>
  34. <view class="app-miaosha dir-left-nowrap main-left cross-center" v-if="good.sign === 'miaosha'">
  35. <icon class="app-miaosha-icon"
  36. v-if="good.miaosha_status === 2 || good.miaosha_status === 1"></icon>
  37. <icon class="app-spike-icon" v-if="good.miaosha_status === 0"></icon>
  38. <!-- <text class="app-not-start" v-if="good.miaosha_status === 2">秒杀未开始</text>-->
  39. <view class="app-beginning" v-if="good.miaosha_status === 1">
  40. 秒杀中 还剩
  41. {{good.miaosha_string}}
  42. 结束
  43. </view>
  44. <text class="app-over" v-if="good.miaosha_status === 0">秒杀已结束</text>
  45. </view>
  46. <view class="app-failed-goods" v-if="good.new_status !== 0">
  47. <view v-if="good.new_status === 2" class="app-text dir-left-nowrap main-left cross-center">
  48. 商品已售罄,请联系卖家
  49. </view>
  50. <view v-else-if="good.new_status === 3"
  51. class="app-text dir-left-nowrap main-left cross-center">
  52. 商品已失效
  53. </view>
  54. <view v-else-if="good.new_status === 4"
  55. class="app-text dir-left-nowrap main-left cross-center">
  56. 商户已关闭
  57. </view>
  58. <view v-else-if="good.new_status === 5"
  59. class="app-text dir-left-nowrap main-left cross-center">
  60. 商品已下架
  61. </view>
  62. </view>
  63. <view class="dir-top-nowrap" v-else>
  64. <view class="reduce-price" v-if="good.reduce_price > 0 && good.new_status === 0">
  65. 比加入时降¥{{good.reduce_price}}
  66. </view>
  67. <view class="app-price-button dir-left-nowrap main-between cross-center">
  68. <text class="app-price">
  69. {{good.attrs.price}}
  70. </text>
  71. <app-add-subtract
  72. v-model="mch.goods_list[index].num"
  73. :good_id="mch.goods_list[index].id"
  74. :stock="good.attrs.stock"
  75. @change="change"
  76. ></app-add-subtract>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import appRadio from '../../../../components/basic-component/app-radio/app-radio.vue';
  85. import appAddSubtract from '../app-add-subtract/app-add-subtract.vue';
  86. export default {
  87. name: "app-shop-product",
  88. components: {
  89. 'app-radio': appRadio,
  90. 'app-add-subtract': appAddSubtract,
  91. },
  92. props: {
  93. mch: {
  94. type: Object
  95. },
  96. editStatus: {
  97. type: Boolean,
  98. default() {
  99. return false;
  100. }
  101. }
  102. },
  103. data() {
  104. return {
  105. timer: null,
  106. time: '0'
  107. }
  108. },
  109. methods: {
  110. changeSingleRadio(mch, item) {
  111. this.$emit('changeSingleRadio', mch, item);
  112. },
  113. changeAllRadio(data) {
  114. this.$emit('changeRadioAll', data);
  115. },
  116. jump(good) {
  117. if (good.new_status === 0) {
  118. if (good.mch_id > 0) {
  119. this.$jump({
  120. open_type: 'navigate',
  121. url: `/plugins/mch/goods/goods?id=${good.goods.id}&mch_id=${good.mch_id}`
  122. })
  123. } else if (good.sign === 'miaosha') {
  124. this.$jump({
  125. open_type: 'navigate',
  126. url: `/plugins/miaosha/goods/goods?id=${good.goods.id}`
  127. })
  128. } else {
  129. this.$jump({
  130. open_type: 'navigate',
  131. url: `/pages/goods/goods?id=${good.goods.id}`
  132. })
  133. }
  134. }
  135. },
  136. change(number, id) {
  137. this.$emit('change', number, id, this.mch.mch_id);
  138. }
  139. },
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .app-shop-product {
  144. width: #{750rpx};
  145. background-color: #ffffff;
  146. margin-top: #{32rpx};
  147. }
  148. .app-mch {
  149. border-bottom: #{1rpx} solid #e2e2e2;
  150. height: #{80rpx};
  151. width: 100%;
  152. .app-all-radio {
  153. width: #{94rpx};
  154. height: #{80rpx};
  155. .app-all {
  156. width: #{40rpx};
  157. height: #{40rpx};
  158. border-radius: 50%;
  159. margin-left: #{24rpx};
  160. background-color: white;
  161. border: #{1rpx} solid #e2e2e2;
  162. }
  163. .app-all-n {
  164. background-color: #cdcdcd !important;
  165. }
  166. .app-all-active {
  167. width: #{40rpx};
  168. height: #{40rpx};
  169. border-radius: 50%;
  170. margin-left: #{24rpx};
  171. background-repeat: repeat;
  172. background-size: 100% 100%;
  173. background-image: url("../../../../static/image/icon/icon-checkbox-checked-a.png");
  174. }
  175. }
  176. .app-mch-name {
  177. font-size: #{26rpx};
  178. color: #666666;
  179. }
  180. }
  181. .app-product {
  182. width: 100%;
  183. margin-top: #{30rpx};
  184. padding-bottom: #{30rpx};
  185. border-bottom: #{1rpx} solid #e2e2e2;
  186. .app-single-radio {
  187. width: #{84rpx};
  188. height: #{156rpx};
  189. .app-radio {
  190. width: #{84rpx};
  191. height: #{156rpx};
  192. .radio-single {
  193. width: #{40rpx};
  194. height: #{40rpx};
  195. border-radius: 50%;
  196. background-color: white;
  197. border: #{1rpx} solid #e2e2e2;
  198. }
  199. .radio-single-active {
  200. width: #{40rpx};
  201. height: #{40rpx};
  202. border-radius: 50%;
  203. background-repeat: repeat;
  204. background-size: 100% 100%;
  205. background-image: url("../../../../static/image/icon/icon-checkbox-checked-a.png");
  206. }
  207. }
  208. .app-invalid {
  209. width: #{64rpx};
  210. height: #{32rpx};
  211. line-height: #{32rpx};
  212. border-radius: #{16rpx};
  213. text-align: center;
  214. font-size: #{24rpx};
  215. color: #FFFFFF;
  216. background-color: #cdcdcd;
  217. }
  218. }
  219. .app-image {
  220. width: #{156rpx};
  221. height: #{156rpx};
  222. image {
  223. width: 100%;
  224. height: 100%;
  225. }
  226. }
  227. .app-content {
  228. width: #{466rpx};
  229. background-color: white;
  230. margin: 0 #{24rpx} #{30rpx} #{20rpx};
  231. .app-title {
  232. width: 100%;
  233. font-size: #{28rpx};
  234. color: #353535;
  235. word-break: break-all;
  236. text-overflow: ellipsis;
  237. display: -webkit-box;
  238. -webkit-box-orient: vertical;
  239. -webkit-line-clamp: 1;
  240. overflow: hidden;
  241. margin-bottom: #{10rpx};
  242. }
  243. .app-failed-title {
  244. color: #999999;
  245. }
  246. .app-specification-style {
  247. margin-bottom: #{16rpx};
  248. text {
  249. font-size: #{24rpx};
  250. color: #999999;
  251. margin-right: #{36rpx};
  252. }
  253. }
  254. .app-miaosha {
  255. width: 100%;
  256. margin-bottom: #{24rpx};
  257. .app-miaosha-icon {
  258. width: #{29rpx};
  259. height: #{29rpx};
  260. background-repeat: no-repeat;
  261. background-size: 100% 100%;
  262. background-image: url("../../../../static/image/cart/miaosha.png");
  263. margin-right: #{12rpx};
  264. }
  265. .app-spike-icon {
  266. width: #{29rpx};
  267. height: #{29rpx};
  268. background-repeat: no-repeat;
  269. background-size: 100% 100%;
  270. background-image: url("../../../../static/image/cart/spike-invalid.png");
  271. margin-right: #{12rpx};
  272. }
  273. .app-beginning {
  274. font-size: #{22rpx};
  275. color: #ff4544;
  276. }
  277. .app-over {
  278. font-size: #{22rpx};
  279. color: #999999;
  280. }
  281. }
  282. .app-failed-goods {
  283. width: 100%;
  284. .app-text {
  285. color: #353535;
  286. font-size: #{25rpx};
  287. }
  288. .app-spike {
  289. margin-bottom: #{24rpx};
  290. }
  291. .app-spike-icon {
  292. width: #{29rpx};
  293. height: #{29rpx};
  294. background-repeat: no-repeat;
  295. background-size: 100% 100%;
  296. background-image: url("../../../../static/image/cart/spike-invalid.png");
  297. margin-right: #{12rpx};
  298. }
  299. .app-spike-text {
  300. font-size: #{24rpx};
  301. color: #999999;
  302. }
  303. }
  304. .app-price-button {
  305. width: 100%;
  306. height: #{60rpx};
  307. .app-price {
  308. color: #ff5857;
  309. font-size: #{32rpx};
  310. }
  311. .app-price:before {
  312. content: '¥';
  313. font-size: #{24rpx};
  314. }
  315. }
  316. .reduce-price {
  317. color: #ff4544;
  318. font-size: #{24rpx};
  319. }
  320. }
  321. }
  322. </style>