goodsHandle.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view>
  3. <uni-nav-bar color="#fff" height="60" left-icon="back" @clickLeft="back()" @clickRight="rightClick()"
  4. right-text="新增商品" :border="false" backgroundColor="#0081ff" title="商品管理" />
  5. </u-navbar>
  6. <u-list class="list" width="100%" @scrolltolower="scrolltolower">
  7. <u-list-item v-for="(item, index) in goods" :key="index">
  8. <view class="item-box">
  9. <view class="goods-item">
  10. <u-row>
  11. <u-col span="5" @click="toDetails(item.id)">
  12. <u--image :showLoading="true" src="" width="270rpx" height="220rpx"></u--image>
  13. </u-col>
  14. <u-col span="7">
  15. <view class="t1 txt" @click="toDetails(item.id)">
  16. <text>{{item.goodsName}}</text>
  17. </view>
  18. <view class="txt">
  19. <text v-if="item.grossWeight">{{item.grossWeight}}吨</text>
  20. </view>
  21. <view class="txt" v-if="item.tradeAreaName">
  22. <u-tag style="width: 250rpx" :text="item.tradeAreaName" plain size="mini"></u-tag>
  23. </view>
  24. <view class="t4">
  25. <view class="price">¥{{item.price}}</view>
  26. <view class="edit" @click="editGoods(item.id)">
  27. <u-icon color="#fff" name="edit-pen-fill" size="30"></u-icon>
  28. </view>
  29. <view class="delete" @click="deleteGoods(item.id)">
  30. <u-icon color="#fff" name="warning-fill" size="30"></u-icon>
  31. </view>
  32. </view>
  33. </u-col>
  34. </u-row>
  35. </view>
  36. </view>
  37. </u-list-item>
  38. </u-list>
  39. <view class="tab">
  40. <!-- <view class="tabBtn" @click="BtnClick(1)">
  41. <u-icon label="商品列表" size="30" color="#ef732a" labelColor="#ef732a" name="shopping"></u-icon>
  42. </view> -->
  43. <view class="tabBtn" @click="BtnClick()">
  44. <u-icon label="订单列表" size="30" color="#1E90FF" labelColor="#1E90FF" name="order"></u-icon>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. loadmoreStatus: 'loadmore',
  54. form: {},
  55. goods: [],
  56. orders: [],
  57. item: {},
  58. }
  59. },
  60. onLoad() {
  61. this.getTransitList()
  62. },
  63. methods: {
  64. // 商品列表
  65. getTransitList() {
  66. this.form = {
  67. isOrders: 0,//是否已被下单[0=未被下单,1=已被下单]
  68. //enterpriseConfirm: ,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
  69. goodsStatus: 1,//商品状态(0=下架,1=在售)
  70. }
  71. this.http.request({
  72. url: '/level-one-server/app/TbGoodsTransit/getTransitList',
  73. data: this.form,
  74. //method: 'POST',
  75. success: resp => {
  76. console.log('resp',resp)
  77. this.goods = resp.data.data;
  78. this.goods.forEach((item, index) => {
  79. if (index === this.goods.length - 1) {
  80. this.loadmoreStatus = 'nomore'
  81. } else {
  82. this.loadmoreStatus = 'loadmore'
  83. }
  84. })
  85. }
  86. });
  87. },
  88. // 删除商品
  89. deleteGoods(id) {
  90. console.log('id',id)
  91. this.http.request({
  92. url: '/level-one-server/app/TbGoodsTransit/deleteById',
  93. data: {id : id},
  94. method: 'POST',
  95. success: resp => {
  96. console.log('删除商品',resp)
  97. }
  98. });
  99. },
  100. // 编辑商品
  101. editGoods(id) {
  102. this.$common.to('/pages/goodsManage/oneMarket/editGoods?id='+id)
  103. },
  104. scrolltolower() {
  105. this.getTransitList()
  106. },
  107. BtnClick(type) {
  108. uni.navigateTo({
  109. url: '/pages/goodsManage/oneMarket/goodsOrders'
  110. })
  111. },
  112. back() {
  113. uni.switchTab({
  114. url: '/pages/index/index'
  115. });
  116. },
  117. rightClick() {
  118. this.$common.to('/pages/goodsManage/oneMarket/addGoods')
  119. },
  120. }/* ,
  121. onNavigationBarButtonTap(e) { //导航栏新增商品按钮
  122. this.$common.to('/pages/goodsManage/oneMarket/addGoods')
  123. } */
  124. }
  125. </script>
  126. <style lang="scss">
  127. .list {
  128. height: auto;
  129. border-radius: 10rpx;
  130. margin: 15rpx;
  131. }
  132. .goods-item {
  133. margin-bottom: 8rpx;
  134. }
  135. .item-box {
  136. height: 230rpx;
  137. width: 90%;
  138. padding: 20rpx;
  139. background-color: #fff;
  140. border: 1rpx #FFF solid;
  141. margin: 10rpx 0rpx;
  142. border-radius: 10rpx;
  143. }
  144. .txt {
  145. /* height: 50rpx; */
  146. margin-bottom: 20rpx;
  147. }
  148. .t1 {
  149. font-size: 32rpx;
  150. font-weight: bold;
  151. word-wrap: break-word;
  152. position: relative;
  153. top: 1rpx;
  154. right: 5rpx;
  155. }
  156. .t4 {
  157. display: flex;
  158. position: relative;
  159. bottom: 1rpx;
  160. right: 5rpx;
  161. }
  162. .price {
  163. color: #ef732a;
  164. width: 400rpx;
  165. font-weight: bold;
  166. }
  167. .edit {
  168. background-color: #0081ff;
  169. width: 60rpx;
  170. height: 60rpx;
  171. border-radius: 30rpx;
  172. text-align: center;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. }
  177. .delete {
  178. background-color: indianred;
  179. width: 60rpx;
  180. height: 60rpx;
  181. border-radius: 30rpx;
  182. text-align: center;
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. }
  187. .tab {
  188. position: fixed;
  189. bottom: 1rpx;
  190. width: 100%;
  191. height: 100rpx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. border-top: #ffffff 1rpx solid;
  196. background-color: #ffffff;
  197. }
  198. .tabBtn {
  199. width: 35%;
  200. height: 100%;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. margin: 0 30rpx;
  205. }
  206. </style>