order.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="all-container">
  4. <view class="common-title">订单信息</view>
  5. <view class="product-container card">
  6. <view class="it" v-for="(item, index) in goodsList" :key="index">
  7. <view class="name"
  8. >{{ item.goodsName }}<text>×{{ item.num }}{{ item.goodsSalesUnit }}</text></view
  9. >
  10. <view class="price">¥{{ (item.price * item.num) | priceFilter }}</view>
  11. </view>
  12. <view class="total">
  13. <view class="text">合计:</view>
  14. <view class="price">¥{{ totalPrice | priceFilter }}</view>
  15. </view>
  16. </view>
  17. <block v-if="websitData">
  18. <view class="common-title">提货信息</view>
  19. <view class="info-container card" v-if="websitData">
  20. <view class="top">
  21. <view class="left">{{ websitData.name }}</view>
  22. <view class="right">距离{{ (websitData.distance / 1000).toFixed(2) }}KM</view>
  23. </view>
  24. <view class="row">
  25. <view class="label">联系电话</view>
  26. <view class="value">{{ websitData.websitPhone }}</view>
  27. </view>
  28. <view class="row">
  29. <view class="label">提货地址</view>
  30. <view class="value">{{ websitData.address }}</view>
  31. </view>
  32. </view>
  33. </block>
  34. <view class="common-title">备注</view>
  35. <view class="remark-container card">
  36. <u--textarea v-model="remark" placeholder="请输入内容" border="none" autoHeight></u--textarea>
  37. </view>
  38. </view>
  39. <template slot="footer">
  40. <view class="bottom-container">
  41. <view class="left">
  42. <view class="text">共{{ totalNum }}件,合计:</view>
  43. <view class="price">¥{{ totalPrice | priceFilter }}</view>
  44. </view>
  45. <view class="btn">
  46. <u-button type="primary" text="确认订单" @click="submitData"></u-button>
  47. </view>
  48. </view>
  49. </template>
  50. </zj-page-layout>
  51. </template>
  52. <script>
  53. import wx from 'weixin-js-sdk'
  54. export default {
  55. data() {
  56. return {
  57. type: 'M',
  58. applyName: '',
  59. websitId: null,
  60. websitName: null,
  61. goodsList: [],
  62. lat: '',
  63. lng: '',
  64. websitData: null,
  65. userInfo: {},
  66. remark: ''
  67. }
  68. },
  69. computed: {
  70. totalNum() {
  71. // let val = 0;
  72. // this.goodsList.forEach(item => {
  73. // val = val + item.num;
  74. // })
  75. return this.goodsList.length
  76. },
  77. totalPrice() {
  78. let val = 0
  79. this.goodsList.forEach(item => {
  80. val = val + (item.num * (item.price * 100)) / 100
  81. })
  82. return val
  83. }
  84. },
  85. async onLoad() {
  86. let data = this.$getStorage('materialApplyData')
  87. if (data) {
  88. this.type = data.type
  89. this.applyName = data.applyName
  90. this.websitId = data.websitId
  91. this.websitName = data.websitName
  92. this.goodsList = data.goodsList
  93. }
  94. // this.$removeStorage('materialApplyData')
  95. this.userInfo = await this.$getUserInfo()
  96. var { latitude, longitude } = await this.$getLocation()
  97. this.lat = latitude
  98. this.lng = longitude
  99. this.getWebsitList()
  100. },
  101. methods: {
  102. getWebsitList() {
  103. this.$api
  104. .get('/user/apply/websit', {
  105. lat: this.lat,
  106. lng: this.lng
  107. })
  108. .then(res => {
  109. this.websitData = res.data.find(o => o.websitId == this.websitId)
  110. })
  111. },
  112. submitData() {
  113. this.$api
  114. .postJson('/material/salses/add', {
  115. goodsType: this.type,
  116. remark: this.remark,
  117. workerId: this.userInfo.userId,
  118. workerName: this.userInfo.nickName,
  119. companyWechatId: this.userInfo.companyWechatId,
  120. websitId: this.websitId,
  121. websitName: this.websitName,
  122. websitBuyGoods: this.goodsList
  123. })
  124. .then(res => {
  125. this.$navToPage(
  126. {
  127. url: `/packageMaterial/pages/stock/buyRecord`
  128. },
  129. 'reLaunch'
  130. )
  131. // this.$navToPage({
  132. // url: `/packageMaterial/pages/apply/pay?orderId=${res.data}&websitId=${this.websitId}&goodsType=${this.type}`
  133. // })
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .all-container {
  141. padding: 0 20rpx;
  142. }
  143. .common-title {
  144. font-size: 32rpx;
  145. font-weight: 600;
  146. margin-top: 30rpx;
  147. }
  148. .card {
  149. @include zj-card;
  150. margin-top: 20rpx;
  151. padding: 30rpx;
  152. }
  153. .product-container {
  154. .it {
  155. display: flex;
  156. align-items: flex-end;
  157. margin-bottom: 20rpx;
  158. .name {
  159. flex: 1;
  160. font-size: 28rpx;
  161. font-weight: 500;
  162. text {
  163. color: $sec-font;
  164. margin-left: 12rpx;
  165. font-weight: normal;
  166. }
  167. }
  168. .price {
  169. margin-left: 30rpx;
  170. font-size: 28rpx;
  171. font-weight: 500;
  172. }
  173. }
  174. .total {
  175. display: flex;
  176. align-items: center;
  177. justify-content: flex-end;
  178. margin-top: 30rpx;
  179. .text {
  180. font-size: 28rpx;
  181. color: $sec-font;
  182. }
  183. .price {
  184. font-size: 28rpx;
  185. color: $minor-color;
  186. font-weight: 500;
  187. }
  188. }
  189. }
  190. .info-container {
  191. .top {
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. .left {
  196. font-weight: 500;
  197. }
  198. .right {
  199. font-size: 28rpx;
  200. }
  201. }
  202. .row {
  203. display: flex;
  204. align-items: center;
  205. margin-top: 20rpx;
  206. .label {
  207. font-size: 28rpx;
  208. color: $sec-font;
  209. margin-right: 20rpx;
  210. }
  211. .value {
  212. flex: 1;
  213. font-size: 28rpx;
  214. text {
  215. color: $minor-color;
  216. }
  217. &.price {
  218. color: $theme-color;
  219. }
  220. }
  221. .tag {
  222. font-size: 28rpx;
  223. color: $theme-color;
  224. }
  225. }
  226. }
  227. .remark-container {
  228. padding: 0;
  229. ::v-deep .u-textarea {
  230. padding: 20rpx 30rpx;
  231. min-height: 200rpx;
  232. }
  233. }
  234. .bottom-container {
  235. padding: 20rpx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. .left {
  240. display: flex;
  241. align-items: center;
  242. .text {
  243. font-size: 28rpx;
  244. color: $sec-font;
  245. }
  246. .price {
  247. font-size: 32rpx;
  248. color: $minor-color;
  249. font-weight: 500;
  250. }
  251. }
  252. .btn {
  253. width: 180rpx;
  254. }
  255. }
  256. </style>