瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
5.2 KiB

1 year ago
1 year ago
1 year ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="product-list-container">
  3. <view class="list">
  4. <view class="item"
  5. v-for="(item, index) in productList"
  6. @click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id + '&pay=' + pay)"
  7. :key="index">
  8. <image
  9. class="image"
  10. :src="item.image ? item.image.split(',')[0] : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg'" mode="aspectFill"></image>
  11. <view class="info">
  12. <view class="title text-ellipsis">
  13. {{ item.name }}
  14. </view>
  15. <!-- <view class="price">
  16. <text>{{ item.originalPrice }}</text>/
  17. </view>
  18. <view class="favorable" v-if="item.goodsSku">
  19. <view class="t">
  20. 限时优惠
  21. </view>
  22. <view class="p">
  23. {{ item.goodsSku.price }}
  24. </view>
  25. </view> -->
  26. <view class="price"
  27. v-if="isProductPrice(item)">
  28. 现价<text>{{ item.price }}</text>
  29. </view>
  30. <view class="del"
  31. v-if="isProductPrice(item)">
  32. 原价{{ item.oldPrice }}
  33. </view>
  34. <!-- <view class="favorable" v-if="item.oldPrice">
  35. <view class="t">
  36. 原价
  37. </view>
  38. <view class="p">
  39. {{ item.oldPrice }}
  40. </view>
  41. </view> -->
  42. <view class="favorable"
  43. v-if="item.points
  44. && isProductPoint(item)">
  45. <view class="t">
  46. 积分兑换
  47. </view>
  48. <view class="p">
  49. {{ item.points }}
  50. </view>
  51. </view>
  52. <view class="num">
  53. {{ item.shopId }}
  54. </view>
  55. <!-- 编辑和删除按钮 -->
  56. <view class="edit-actions" v-if="edit">
  57. <uv-icon
  58. name="edit-pen-fill"
  59. size="40rpx"
  60. @click.stop="toEdit(item)"
  61. color="#5baaff"
  62. />
  63. <uv-icon
  64. name="trash-fill"
  65. size="40rpx"
  66. @click.stop="del(item)"
  67. color="#5baaff"
  68. />
  69. </view>
  70. <!-- <view class="num">
  71. 已售卖{{ item.soldNum || 0 }}+
  72. </view> -->
  73. </view>
  74. <view class="btn">
  75. <uv-icon name="shopping-cart"
  76. color="#fff"></uv-icon>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 添加商品按钮 -->
  81. <view class="createDetail"
  82. v-if="edit">
  83. <view
  84. @click="$utils.navigateTo('/pages_order/product/addProduct?shopId=' + shopId)">
  85. <uv-icon
  86. size="40rpx"
  87. color="#fff"
  88. name="plus"></uv-icon>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import productMixins from '@/mixins/product.js'
  95. export default {
  96. mixins : [productMixins],
  97. name:"productList",
  98. props : {
  99. productList: {
  100. type: Array,
  101. default: function() {
  102. return []
  103. }
  104. },
  105. pay: {
  106. type: String,
  107. default: ''
  108. },
  109. edit: {
  110. type: Boolean,
  111. default: false
  112. },
  113. shopId: {
  114. type: [String, Number],
  115. default: ''
  116. }
  117. },
  118. data() {
  119. return {
  120. };
  121. },
  122. methods : {
  123. // 修改商品
  124. toEdit: function(item){
  125. this.$utils.navigateTo('/pages_order/product/addProduct?id=' + item.id)
  126. },
  127. // 下架商品
  128. del: function(item){
  129. var self = this;
  130. uni.showModal({
  131. title: '您确认要下架吗?',
  132. content: '您正在下架 ' + item.name,
  133. success : function(res) {
  134. if(res.confirm){
  135. self.$api('orderUpdate', {
  136. id : item.id,
  137. isOpen : 'N',
  138. }, function(res) {
  139. if(res.code == 200){
  140. self.$emit('getData')
  141. }
  142. })
  143. }
  144. }
  145. })
  146. },
  147. },
  148. }
  149. </script>
  150. <style scoped lang="scss">
  151. .product-list-container {
  152. position: relative;
  153. }
  154. .list{
  155. display: flex;
  156. flex-wrap: wrap;
  157. .item{
  158. position: relative;
  159. width: 300rpx;
  160. padding: 20rpx;
  161. background-color: #fff;
  162. border-radius: 20rpx;
  163. margin-top: 20rpx;
  164. &:nth-child(odd){
  165. margin-right: 20rpx;
  166. }
  167. .image{
  168. width: 300rpx;
  169. height: 250rpx;
  170. border-radius: 20rpx;
  171. }
  172. .info{
  173. font-size: 26rpx;
  174. .title{
  175. font-size: 28rpx;
  176. }
  177. .price{
  178. color: $uni-price-color;
  179. margin-top: 6rpx;
  180. text{
  181. font-size: 30rpx;
  182. font-weight: 900;
  183. }
  184. }
  185. .del{
  186. font-size: 22rpx;
  187. color: #888;
  188. font-weight: 500;
  189. text-decoration : line-through;
  190. }
  191. .favorable{
  192. display: flex;
  193. // background-image: url(/static/image/product/favorable.png);
  194. background-size: 100% 100%;
  195. width: fit-content;
  196. font-size: 20rpx;
  197. margin-top: 6rpx;
  198. border-radius: 10rpx;
  199. overflow: hidden;
  200. background-color: #ff000011;
  201. .t{
  202. padding: 5rpx 10rpx;
  203. }
  204. .p{
  205. padding: 5rpx 10rpx;
  206. color: #fff;
  207. background-color: #F03F25;
  208. height: 100%;
  209. }
  210. }
  211. .num{
  212. margin-top: 6rpx;
  213. font-size: 22rpx;
  214. color: #888;
  215. }
  216. .edit-actions{
  217. display: flex;
  218. margin-top: 10rpx;
  219. justify-content: flex-start;
  220. /deep/ .uv-icon {
  221. margin-right: 20rpx;
  222. }
  223. }
  224. }
  225. .btn{
  226. position: absolute;
  227. right: 20rpx;
  228. bottom: 20rpx;
  229. padding: 10rpx;
  230. border-radius: 50%;
  231. background-color: $uni-color;
  232. }
  233. }
  234. }
  235. .createDetail {
  236. position: fixed;
  237. top: 60vh;
  238. right: 50rpx;
  239. z-index: 999;
  240. button{
  241. all : unset;
  242. }
  243. button::after{
  244. all : unset;
  245. }
  246. & > view{
  247. width: 100rpx;
  248. height: 100rpx;
  249. background-color: $uni-color;
  250. border-radius: 50rpx;
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, 0.1);
  255. margin-bottom: 30rpx;
  256. }
  257. }
  258. </style>