replaceGoods.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view class="main">
  4. <view class="mainLine">
  5. <view class="goodsItem" v-for="(v,i) in list" v-if='v.showr' @click="goGoods(v)">
  6. <view>
  7. <image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
  8. <image src="../../static/img/noimg.png" mode="" class="goodsImg" v-else></image>
  9. </view>
  10. <view class="goodsItemRight">
  11. <view class="goodsItemName">{{v.showName}}</view>
  12. <view class="goodsItemBottom">
  13. <view class="goodssalePrice">
  14. <span>¥{{v.salePrice}}</span>
  15. <span class="goodsNum">x{{v.qty}}</span>
  16. </view>
  17. <view class="replaceBtn" @click.stop="replace(v)">更换</view>
  18. </view>
  19. </view>
  20. </view>
  21. <nodata v-if="list.length==0&&isload"></nodata>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import nodata from '@/components/nodata/nodata.vue'
  28. export default {
  29. components: {
  30. nodata
  31. },
  32. data() {
  33. return {
  34. title: 'Hello',
  35. packageGoodsID:'',
  36. shopId:'',
  37. list:'',
  38. isload:false,
  39. }
  40. },
  41. onLoad(opt) {
  42. /* this.packageGoodsID=opt.packageGoodsID; */
  43. this.shopId=uni.getStorageSync("shopData").shopId;
  44. this.list=uni.getStorageSync("replaceDataList")
  45. //this.getData()
  46. },
  47. methods: {
  48. getData(){
  49. uni.showLoading({
  50. title: '加载中'
  51. })
  52. this.$http('miniApp/packageMiniAppController/queryPackageReplaceGoods', {
  53. packageGoodsID:this.packageGoodsID,
  54. shopID:this.shopId
  55. },'GET').then(res => {
  56. uni.hideLoading();
  57. this.isload=true;
  58. this.list=res.data;
  59. })
  60. },
  61. replace(v){
  62. console.log(v)
  63. /* if(v.listImg.length>0){
  64. v.picUrl=v.listImg[0].url
  65. } */
  66. uni.setStorage({
  67. key: 'replaceData',
  68. data: v,
  69. success: function () {
  70. uni.navigateBack({
  71. delta:1
  72. })
  73. }
  74. });
  75. },
  76. goGoods(item){
  77. uni.setStorage({
  78. key: 'goodsreplaceData',
  79. data: item,
  80. success: function () {
  81. /* uni.navigateBack({
  82. delta:1
  83. }) */
  84. uni.navigateTo({
  85. url:'../module/goodsDetail?goodsId='+item.goodsID+'&type=1'+'&typeIndex=2&maintain=2'
  86. })
  87. }
  88. });
  89. },
  90. login(){
  91. uni.navigateTo({
  92. url:'../login/login'
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped>
  99. .main{
  100. padding: 24rpx;
  101. }
  102. .mainLine{
  103. }
  104. .goodsItem{
  105. display: flex;
  106. padding: 30rpx 0;
  107. border-bottom: 1px solid #EEEEEE;
  108. }
  109. .goodsItem:last-child{
  110. border: none;
  111. }
  112. .goodsItemRight{
  113. width: 520rpx;
  114. padding-left: 20rpx;
  115. display: flex;
  116. flex-direction:column;
  117. justify-content: space-between;
  118. }
  119. .goodsItemBottom{
  120. display: flex;
  121. justify-content: space-between;
  122. }
  123. .goodsItemName{
  124. font-size: 26rpx;
  125. color: #3C3C3C;
  126. }
  127. .goodssalePrice{
  128. font-size: 32rpx;font-weight: 500;color: #FF4F00;
  129. }
  130. .goodsNum{
  131. font-size: 24rpx;font-weight: 400;color: #999999;
  132. padding-left: 50rpx;
  133. }
  134. .goodsImg{
  135. width: 120rpx;height: 120rpx;
  136. }
  137. .replaceBtn{
  138. color: #FF4F00;
  139. font-size:24rpx;}
  140. </style>