123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <template>
- <zj-page-layout :hasFooter="true">
- <view class="all-container">
- <view class="common-title">订单信息</view>
- <view class="product-container card">
- <view class="it" v-for="(item, index) in goodsList" :key="index">
- <view class="name"
- >{{ item.goodsName }}<text>×{{ item.num }}{{ item.goodsSalesUnit }}</text></view
- >
- <view class="price">¥{{ (item.price * item.num) | priceFilter }}</view>
- </view>
- <view class="total">
- <view class="text">合计:</view>
- <view class="price">¥{{ totalPrice | priceFilter }}</view>
- </view>
- </view>
- <block v-if="websitData">
- <view class="common-title">提货信息</view>
- <view class="info-container card" v-if="websitData">
- <view class="top">
- <view class="left">{{ websitData.name }}</view>
- <view class="right">距离{{ (websitData.distance / 1000).toFixed(2) }}KM</view>
- </view>
- <view class="row">
- <view class="label">联系电话</view>
- <view class="value">{{ websitData.websitPhone }}</view>
- </view>
- <view class="row">
- <view class="label">提货地址</view>
- <view class="value">{{ websitData.address }}</view>
- </view>
- </view>
- </block>
- <view class="common-title">备注</view>
- <view class="remark-container card">
- <u--textarea v-model="remark" placeholder="请输入内容" border="none" autoHeight></u--textarea>
- </view>
- </view>
- <template slot="footer">
- <view class="bottom-container">
- <view class="left">
- <view class="text">共{{ totalNum }}件,合计:</view>
- <view class="price">¥{{ totalPrice | priceFilter }}</view>
- </view>
- <view class="btn">
- <u-button type="primary" text="确认订单" @click="submitData"></u-button>
- </view>
- </view>
- </template>
- </zj-page-layout>
- </template>
- <script>
- import wx from 'weixin-js-sdk'
- export default {
- data() {
- return {
- type: 'M',
- applyName: '',
- websitId: null,
- websitName: null,
- goodsList: [],
- lat: '',
- lng: '',
- websitData: null,
- userInfo: {},
- remark: ''
- }
- },
- computed: {
- totalNum() {
- // let val = 0;
- // this.goodsList.forEach(item => {
- // val = val + item.num;
- // })
- return this.goodsList.length
- },
- totalPrice() {
- let val = 0
- this.goodsList.forEach(item => {
- val = val + (item.num * (item.price * 100)) / 100
- })
- return val
- }
- },
- async onLoad() {
- let data = this.$getStorage('materialApplyData')
- if (data) {
- this.type = data.type
- this.applyName = data.applyName
- this.websitId = data.websitId
- this.websitName = data.websitName
- this.goodsList = data.goodsList
- }
- // this.$removeStorage('materialApplyData')
- this.userInfo = await this.$getUserInfo()
- var { latitude, longitude } = await this.$getLocation()
- this.lat = latitude
- this.lng = longitude
- this.getWebsitList()
- },
- methods: {
- getWebsitList() {
- this.$api
- .get('/user/apply/websit', {
- lat: this.lat,
- lng: this.lng
- })
- .then(res => {
- this.websitData = res.data.find(o => o.websitId == this.websitId)
- })
- },
- submitData() {
- this.$api
- .postJson('/material/salses/add', {
- goodsType: this.type,
- remark: this.remark,
- workerId: this.userInfo.userId,
- workerName: this.userInfo.nickName,
- companyWechatId: this.userInfo.companyWechatId,
- websitId: this.websitId,
- websitName: this.websitName,
- websitBuyGoods: this.goodsList
- })
- .then(res => {
- this.$navToPage(
- {
- url: `/packageMaterial/pages/stock/buyRecord`
- },
- 'reLaunch'
- )
- // this.$navToPage({
- // url: `/packageMaterial/pages/apply/pay?orderId=${res.data}&websitId=${this.websitId}&goodsType=${this.type}`
- // })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .all-container {
- padding: 0 20rpx;
- }
- .common-title {
- font-size: 32rpx;
- font-weight: 600;
- margin-top: 30rpx;
- }
- .card {
- @include zj-card;
- margin-top: 20rpx;
- padding: 30rpx;
- }
- .product-container {
- .it {
- display: flex;
- align-items: flex-end;
- margin-bottom: 20rpx;
- .name {
- flex: 1;
- font-size: 28rpx;
- font-weight: 500;
- text {
- color: $sec-font;
- margin-left: 12rpx;
- font-weight: normal;
- }
- }
- .price {
- margin-left: 30rpx;
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- .total {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- margin-top: 30rpx;
- .text {
- font-size: 28rpx;
- color: $sec-font;
- }
- .price {
- font-size: 28rpx;
- color: $minor-color;
- font-weight: 500;
- }
- }
- }
- .info-container {
- .top {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .left {
- font-weight: 500;
- }
- .right {
- font-size: 28rpx;
- }
- }
- .row {
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- .label {
- font-size: 28rpx;
- color: $sec-font;
- margin-right: 20rpx;
- }
- .value {
- flex: 1;
- font-size: 28rpx;
- text {
- color: $minor-color;
- }
- &.price {
- color: $theme-color;
- }
- }
- .tag {
- font-size: 28rpx;
- color: $theme-color;
- }
- }
- }
- .remark-container {
- padding: 0;
- ::v-deep .u-textarea {
- padding: 20rpx 30rpx;
- min-height: 200rpx;
- }
- }
- .bottom-container {
- padding: 20rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .left {
- display: flex;
- align-items: center;
- .text {
- font-size: 28rpx;
- color: $sec-font;
- }
- .price {
- font-size: 32rpx;
- color: $minor-color;
- font-weight: 500;
- }
- }
- .btn {
- width: 180rpx;
- }
- }
- </style>
|