reported.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="reported">
  3. <view class="top">
  4. <view class="list">
  5. <view class="left">
  6. 产品:
  7. </view>
  8. <view class="right">
  9. {{appear.fullName || ''}}
  10. </view>
  11. </view>
  12. <view class="list">
  13. <view class="left">
  14. 瓶码:
  15. </view>
  16. <view class="right">
  17. {{bottleId || ''}}
  18. </view>
  19. </view>
  20. <view class="list">
  21. <view class="left">
  22. 箱码:
  23. </view>
  24. <view class="right">
  25. {{appear.boxId || ''}}
  26. </view>
  27. </view>
  28. <view class="list">
  29. <view class="left">
  30. 配送单:
  31. </view>
  32. <view class="right">
  33. {{appear.sendId || ''}}
  34. </view>
  35. </view>
  36. <view class="list">
  37. <view class="left">
  38. 配送日期:
  39. </view>
  40. <view class="right">
  41. {{appear.sendTime || ''}}
  42. </view>
  43. </view>
  44. <view class="list">
  45. <view class="left">
  46. 经销商:
  47. </view>
  48. <view class="right">
  49. {{appear.name || ''}}
  50. </view>
  51. </view>
  52. <view class="list">
  53. <view class="left">
  54. 经销商所在地:
  55. </view>
  56. <view class="right">
  57. {{appear.region || ''}}
  58. </view>
  59. </view>
  60. <view class="list">
  61. <view class="left">
  62. 当前地点:
  63. </view>
  64. <view class="right">
  65. {{cityName}}
  66. </view>
  67. </view>
  68. <view class="textarea">
  69. <textarea class="text" v-module="remark" placeholder="请输入窜货说明" />
  70. </view>
  71. </view>
  72. <view class="btn">
  73. <button type="default" @click="setAdd()">提交</button>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. add
  80. } from '../../../api/bazaar.js'
  81. import {
  82. mapState
  83. } from 'vuex'
  84. import qqmapsdk from '../../../utils/qqmap-wx-jssdk.js'
  85. const QQMapWX = new qqmapsdk({
  86. key: 'SREBZ-KVJ3J-GFRFV-XKRU4-LGLQE-C4B2T'
  87. })
  88. export default {
  89. data() {
  90. return {
  91. bottleId: '',
  92. remark: '',
  93. x: '',
  94. y: '',
  95. cityName: ''
  96. };
  97. },
  98. onLoad(opints) {
  99. this.bottleId = opints.bottleId
  100. },
  101. created() {
  102. uni.showLoading({
  103. title: '加载中'
  104. });
  105. // this.getLocation()
  106. },
  107. computed: {
  108. ...mapState({
  109. appear: store => store.appear,
  110. submit: store => store.user.name
  111. })
  112. },
  113. mounted() {
  114. uni.hideLoading()
  115. },
  116. onShow() {
  117. uni.getLocation({
  118. success: (res) => {
  119. let latitude = res.latitude;
  120. let longitude = res.longitude;
  121. QQMapWX.reverseGeocoder({
  122. location: {
  123. latitude: latitude,
  124. longitude: longitude
  125. },
  126. success: (res) => {
  127. let cityName = res.result.address_component.province + res.result
  128. .address_component.city + res.result.address_component.district;
  129. this.cityName = cityName;
  130. }
  131. })
  132. },
  133. fail: (res) => {
  134. uni.showToast({
  135. title: '获取位置信息失败',
  136. icon: 'none'
  137. })
  138. }
  139. })
  140. },
  141. methods: {
  142. // 上报
  143. async setAdd() {
  144. const res = await add({
  145. name: this.appear.fullName,
  146. typeName: this.appear.typeName,
  147. brand: this.appear.brand,
  148. gene: this.appear.gene,
  149. level: this.appear.level,
  150. capacity: this.appear.capacity,
  151. bottleId: this.bottleId,
  152. boxId: this.appear.boxId,
  153. sendId: this.appear.sendId,
  154. sendTime: this.appear.sendTime,
  155. agencyName: this.appear.name,
  156. agencyRegion: this.appear.region,
  157. region: '宁波',
  158. remark: this.remark,
  159. submit: this.submit,
  160. accessToken: uni.getStorageSync('tokenInfo'),
  161. account: uni.getStorageSync('account')
  162. })
  163. console.log(res);
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. .reported {
  170. padding: 80rpx 20rpx 0;
  171. .top {
  172. .list {
  173. display: flex;
  174. margin: 20rpx 0;
  175. .left {
  176. width: 200rpx;
  177. margin-right: 15rpx;
  178. text-align: right;
  179. }
  180. }
  181. .textarea {
  182. width: 100%;
  183. height: 200rpx;
  184. margin: 30rpx 0;
  185. .text {
  186. width: 100%;
  187. height: 100%;
  188. padding: 20rpx;
  189. box-sizing: border-box;
  190. border-radius: 10rpx;
  191. background-color: #f6f6f6;
  192. }
  193. }
  194. }
  195. .btn {}
  196. }
  197. </style>