record.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="main main-bg">
  3. <view class="list" v-if="list.length> 0">
  4. <view class="items" v-for="(item, index) in list">
  5. <view class="data">
  6. <view class="name font-color3 font-thirty-two">{{ item.goodsName ? item.goodsName : '' }}</view>
  7. <view class="name font-color4 font-twenty-four">{{ item.orderTime }}</view>
  8. </view>
  9. <view class="user font-color3 font-twenty">使用者: {{ item.veteransName ? item.veteransName : '优待证' }}</view>
  10. <view class="data">
  11. <view class="yuan font-color3 font-thirty-two">原价: ¥{{ change(item.orderPriceOld) }}</view>
  12. <view class="name font-color5 font-thirty">惠军价: ¥{{ change(item.orderPriceVip) }}</view>
  13. </view>
  14. <view style="height: 30rpx;" class="item-bom-data font-twenty-four font-color6" v-if="!item.show"
  15. @click="handleShow(item.orderId, index, item.remark)">
  16. 展开
  17. <u-icon style="transform:rotate(90deg);" name="arrow-right-double" color="#12C194" size="28">
  18. </u-icon>
  19. </view>
  20. <view class="item-bom-data font-twenty-four font-color6" v-if="item.show"
  21. @click="handleShow(item.orderId, index, item.remark)">
  22. 收起
  23. <u-icon style="transform:rotate(-90deg);" name="arrow-right-double" color="#12C194" size="28">
  24. </u-icon>
  25. </view>
  26. <view v-if="item.show" style="margin-top: 60rpx;">
  27. <view v-if="item.list[0]">
  28. <view class="line between" v-for="(items, indexs) in item.list">
  29. <view class="font-twenty-four font-color3"> {{ items.shopsName }} </view>
  30. <view class="font-twenty-four font-color3"> {{ items.shopsNum }}个 </view>
  31. <view class="font-twenty-four font-color3"> {{ change(items.priceOld) }}元 </view>
  32. <view class="font-twenty-four font-color3"> {{ change(items.priceVip) }}元 </view>
  33. </view>
  34. </view>
  35. <view v-else>
  36. 金额结算暂无明细
  37. </view>
  38. <view class="between">
  39. <view class="img-item" v-for="img in item.picUrlList">
  40. <image @tap="preAvatar(image(img))" class="img" :src="image(img)"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="list" v-else style="padding-top: 300rpx;">
  47. <u-empty mode="list"></u-empty>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import server from "@/api/index";
  53. import http from '@/common/http.js';
  54. export default {
  55. data() {
  56. return {
  57. list:[],
  58. userInfo:{}
  59. }
  60. },
  61. onLoad(e) {
  62. this.userInfo = uni.getStorageSync('userInfo');
  63. this.getIndexDetailsFn();
  64. },
  65. methods:{
  66. image(e) {
  67. return http.webUrl + e
  68. },
  69. handleShow(orderId, index, id) {
  70. this.list[index].show = !this.list[index].show
  71. if (this.list[index].show == true) {
  72. this.list[index].list = [];
  73. server.getDetailedList({orderId: orderId}).then(res => {
  74. this.list[index].list = res;
  75. })
  76. }
  77. },
  78. change(num){
  79. return parseFloat(num).toFixed(2)
  80. },
  81. // 预览图片
  82. preAvatar(url) {
  83. console.log(url)
  84. wx.previewImage({
  85. current: url, // 当前显示图片的 http 链接
  86. urls: [url] ,// 需要预览的图片 http 链接列表
  87. })
  88. },
  89. getIndexDetailsFn(){
  90. if(this.userInfo.type === '1'){
  91. server.getIndexDetails({shopsId: this.userInfo.nickName}).then(res =>{
  92. this.list = []
  93. let that = this;
  94. if(res){
  95. res.forEach(item => {
  96. that.list.push({
  97. ...item,
  98. show: false,
  99. list: [
  100. {
  101. name: '商品',
  102. num: 5,
  103. hui: 399.00,
  104. yuan: 800.00
  105. },
  106. {
  107. name: '商品',
  108. num: 5,
  109. hui: 399.00,
  110. yuan: 800.00
  111. }
  112. ]
  113. })
  114. })
  115. }
  116. })
  117. }else if(this.userInfo.type === '2' || this.userInfo.type === '3' ){
  118. server.getMyself({veteransId: this.userInfo.userId, remark: this.userInfo.type}).then(res =>{
  119. this.list = []
  120. if(res){
  121. this.list = res
  122. }
  123. })
  124. }
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .main{
  131. width: 100%;
  132. height: auto;
  133. min-height: 100vh;
  134. padding: 30rpx;
  135. .list{
  136. width: 100%;
  137. height: auto;
  138. .items{
  139. width: 100%;
  140. height: auto;
  141. background: #FFFFFF;
  142. min-height: 277rpx;
  143. padding: 30rpx;
  144. margin-bottom: 30rpx;
  145. position: relative;
  146. .data{
  147. display: flex;
  148. justify-content: space-between;
  149. }
  150. .user{
  151. height: 97rpx;
  152. line-height: 97rpx;
  153. }
  154. .name{
  155. font-weight: 600;
  156. }
  157. .item-bom-data{
  158. position: absolute;
  159. top: 217rpx;
  160. right: 30rpx;
  161. height: 40rpx;
  162. line-height: 40rpx;
  163. }
  164. .line {
  165. // margin-left: 30rpx;
  166. // margin-right: 30rpx;
  167. border-top: 2rpx solid #C8CCDB;
  168. height: 93rpx;
  169. line-height: 93rpx;
  170. text-align: center;
  171. }
  172. }
  173. }
  174. .img-item{
  175. width: calc(33% - 15rpx);
  176. height: 170rpx;
  177. .img{
  178. width: 100%;
  179. height: 170rpx;
  180. }
  181. }
  182. }
  183. </style>