supply_detail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="content">
  3. <view class="title">
  4. {{ title }}
  5. </view>
  6. <view class="details">
  7. <view class="view">
  8. <span class="label">详情:</span>
  9. <span>{{ details }}</span>
  10. </view>
  11. <view class="view">
  12. <span class="label">类型:</span>
  13. <span>{{ type }}</span>
  14. </view>
  15. <view class="view">
  16. <span class="label">图片:</span>
  17. <view class="flex">
  18. <view v-if="imageList.length == 0">-</view>
  19. <image :src="item.url" v-for="item in imageList" :key="item.id" mode="aspectFit"/>
  20. </view>
  21. </view>
  22. <view class="view">
  23. <span class="label">发布时间:</span>
  24. <span>{{ time }}</span>
  25. </view>
  26. </view>
  27. <view class="info">
  28. <view class="title">企业信息</view>
  29. <view class="view">
  30. <span class="label">企业名称:</span>
  31. <span>{{ info.name }}</span>
  32. </view>
  33. <view class="view">
  34. <span class="label">统一社会信用代码:</span>
  35. <span>{{ info.code }}</span>
  36. </view>
  37. <view class="view">
  38. <span class="label">联系电话:</span>
  39. <span>{{ info.tel }}</span>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import md5 from "@/common/md5.js";
  46. export default {
  47. data() {
  48. return {
  49. id: "",
  50. title: "",
  51. details: "",
  52. type: "",
  53. imageList: [],
  54. time: "",
  55. info: {
  56. name: "",
  57. code: "",
  58. tel: "",
  59. },
  60. };
  61. },
  62. onLoad(op) {
  63. this.id = op.id;
  64. console.log(this.id);
  65. this.getSupplyDeatil();
  66. },
  67. methods: {
  68. getSupplyDeatil() {
  69. let md5Sign = md5(
  70. "method=" +
  71. "need" +
  72. "&timestamp=" +
  73. getApp().globalData.globalTimestamp +
  74. "&secret=" +
  75. getApp().globalData.secret
  76. );
  77. let url =
  78. getApp().globalData.shareUrl +
  79. "api/api.php" +
  80. "?method=need&source=need&action=info_by_id&timestamp=" +
  81. getApp().globalData.globalTimestamp +
  82. "&sign=" +
  83. md5Sign;
  84. let postData = {
  85. id: this.id,
  86. openId: getApp().globalData.open_id,
  87. };
  88. //获取文章
  89. uni.request({
  90. url: url,
  91. method: "POST",
  92. header: {
  93. "content-type": "application/x-www-form-urlencoded",
  94. },
  95. data: postData,
  96. success: (res) => {
  97. if (res.data.code === 200) {
  98. console.log(res);
  99. // this.getRich();
  100. let data = res.data.data;
  101. this.details = data.content;
  102. this.title = data.title;
  103. this.type = data.type == 1 ? "需求" : "供需";
  104. let time = this.$options.filters["globalTime"](data.addtime);
  105. let timeSecond = this.$options.filters["globalTimeSecond"](
  106. data.addtime
  107. );
  108. this.time = time + " " + timeSecond;
  109. this.info.name = data.company_name;
  110. this.info.code = data.company_code;
  111. this.info.tel = data.phone;
  112. this.imageList = data.attach_list.map((item) => {
  113. item.url = getApp().globalData.shareUrl + item.url;
  114. return item;
  115. });
  116. }
  117. },
  118. fail: () => {
  119. console.log("连接失败");
  120. },
  121. });
  122. },
  123. },
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .flex,
  128. .view {
  129. display: flex;
  130. }
  131. .content {
  132. font-size: 30rpx;
  133. .title {
  134. margin: 4% 5%;
  135. }
  136. .details {
  137. font-size: 25rpx;
  138. width: 90%;
  139. margin: 0 2%;
  140. padding: 2% 3%;
  141. border-radius: 50rpx;
  142. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 14rpx;
  143. image {
  144. width: 180rpx;
  145. height: 150rpx;
  146. border-radius: 30rpx;
  147. margin: 0 2%;
  148. }
  149. .view {
  150. margin: 5% 0;
  151. }
  152. .label {
  153. display: inline-block;
  154. width: 150rpx;
  155. vertical-align: middle;
  156. font-weight: 100;
  157. }
  158. }
  159. .info {
  160. font-size: 25rpx;
  161. width: 90%;
  162. margin: 4% 2%;
  163. padding: 2% 3%;
  164. border-radius: 40rpx;
  165. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 14rpx;
  166. .title {
  167. margin: 4% 0;
  168. font-size: 30rpx;
  169. }
  170. .view {
  171. display: flex;
  172. align-items: center;
  173. margin: 5% 0;
  174. }
  175. .label {
  176. display: inline-block;
  177. width: 120rpx;
  178. vertical-align: middle;
  179. font-weight: 100;
  180. margin-right: 100rpx;
  181. }
  182. }
  183. }
  184. </style>