| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <template>
- <view class="deliver-goods">
- <header>
- <view class="order-num acea-row row-between-wrapper">
- <view class="num line1">订单号:{{ delivery.order_sn }}</view>
- <view class="name line1">
- <span class="iconfont icon-yonghu2"></span>{{ delivery.user.nickname }}
- </view>
- </view>
- <view class="address">
- <view class="name">
- {{ delivery.real_name
- }}<span class="phone">{{ delivery.user_phone }}</span>
- </view>
- <view>{{ delivery.user_address }}</view>
- </view>
- <view class="line">
- <image src="@/static/images/line.jpg" />
- </view>
- </header>
- <view class="wrapper">
- <view class="item acea-row row-between-wrapper">
- <view>发货方式</view>
- <view class="mode acea-row row-middle row-right">
- <view class="goods" :class="active === index ? 'on' : ''" v-for="(item, index) in types" :key="index" @click="changeType(item, index)">
- {{ item.title }}<span class="iconfont icon-xuanzhong2"></span>
- </view>
- </view>
- </view>
- <block v-if="logistics.length>0">
- <view class="list" v-show="active === 0">
- <view class="item acea-row row-between-wrapper">
- <view>快递名称</view>
- <view class="select-box">
- <picker class="pickerBox" @change="bindPickerChange" :value="seIndex" :range="logistics" range-key="label">
- <!-- <view></view> -->
- <view class="uni-input">{{logistics[seIndex].label}}</view>
- </picker>
- </view>
- </view>
- <view class="item acea-row row-between-wrapper">
- <view>快递单号</view>
- <input type="text" placeholder="填写快递单号" v-model="delivery_id" class="mode" />
- </view>
- </view>
- </block>
- <view class="list" v-show="active === 1">
- <view class="item acea-row row-between-wrapper">
- <view>送货人</view>
- <input type="text" placeholder="填写送货人" v-model="delivery_name" class="mode" />
- </view>
- <view class="item acea-row row-between-wrapper">
- <view>送货电话</view>
- <input type="text" placeholder="填写送货电话" v-model="delivery_id" class="mode" />
- </view>
- </view>
- </view>
- <view style="height:1.2rem;"></view>
- <view class="confirm" @click="saveInfo">确认提交</view>
- </view>
- </template>
- <script>
- import {
- getAdminOrderDetail,
- setAdminOrderDelivery,
- } from "@/api/admin";
- import {
- expressList
- } from "@/api/order";
- import {
- checkPhone
- } from '@/utils/validate.js'
- export default {
- name: "GoodsDeliver",
- components: {},
- props: {},
- data: function() {
- return {
- types: [{
- type: 1,
- title: "发货"
- },
- {
- type: 2,
- title: "送货"
- },
- {
- type: 3,
- title: "无需物流"
- }
- ],
- active: 0,
- order_id: "",
- delivery: {
- user: {}
- },
- logistics: [],
- delivery_type: 1,
- delivery_name: "",
- delivery_id: "",
- seIndex: 0,
- };
- },
- watch: {
- "$route.params.oid": function(newVal) {
- let that = this;
- if (newVal != undefined) {
- that.order_id = newVal;
- that.getIndex();
- }
- }
- },
- onLoad: function(option) {
- this.order_id = option.id;
- this.getIndex();
- this.expressList();
- },
- methods: {
- changeType: function(item, index) {
- this.active = index;
- this.delivery_type = item.type;
- this.delivery_name = "";
- this.delivery_id = "";
- },
- getIndex: function() {
- let that = this;
- getAdminOrderDetail(that.order_id).then(
- res => {
- that.delivery = res.data;
- console.log(this.active);
- },
- error => {
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- expressList: function() {
- let that = this;
- expressList().then(
- res => {
- that.logistics = res.data;
- console.log(that.logistics)
- },
- error => {
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- async saveInfo() {
- let that = this,
- delivery_type = that.delivery_type,
- delivery_name = that.logistics[that.seIndex].value,
- delivery_id = that.delivery_id,
- userName = that.delivery_name,
- save = {};
- save.order_id = that.order_id;
- save.delivery_type = that.delivery_type;
- switch (delivery_type) {
- case 2:
- if (!userName) {
- return that.$util.Tips({
- title: '请填写送货人姓名'
- })
- }
- if (!delivery_id || !checkPhone(delivery_id)) {
- return that.$util.Tips({
- title: '请填写正确的手机号码'
- })
- }
- save.delivery_name = userName;
- save.delivery_id = delivery_id;
- that.setInfo(save);
- break;
- case 1:
- if (!delivery_id) {
- return this.$util.Tips({
- title: '请填写快递单号'
- })
- }
- save.delivery_name = delivery_name;
- save.delivery_id = delivery_id;
- that.setInfo(save);
- break;
- case 3:
- that.setInfo(save);
- break;
- }
- },
- setInfo: function(item) {
- let that = this;
- console.log(item);
- setAdminOrderDelivery(that.order_id,item).then(
- res => {
- that.$util.Tips({
- title: res.message,
- icon: 'success',
- mask: true
- })
- setTimeout(res => {
- uni.navigateTo({
- url:`/pages/admin/orderList/index?types=2`
- })
- }, 2000)
- },
- error => {
- console.log(error)
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- bindPickerChange(e) {
- console.log(e, 'tar')
- this.seIndex = e.detail.value
- }
- }
- };
- </script>
- <style lang="scss">
- /*发货*/
- .uni-input{
- display: block;
- width: 400rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- .deliver-goods header {
- width: 100%;
- background-color: #fff;
- margin-top: 10upx;
- }
- .deliver-goods header .order-num {
- padding: 0 30upx;
- border-bottom: 1px solid #f5f5f5;
- height: 67upx;
- }
- .deliver-goods header .order-num .num {
- width: 430upx;
- font-size: 26upx;
- color: #282828;
- position: relative;
- }
- .deliver-goods header .order-num .num:after {
- position: absolute;
- content: '';
- width: 1px;
- height: 30upx;
- background-color: #ddd;
- top: 50%;
- margin-top: -15upx;
- right: 0;
- }
- .deliver-goods header .order-num .name {
- width: 260upx;
- font-size: 26upx;
- color: #282828;
- text-align: center;
- }
- .deliver-goods header .order-num .name .iconfont {
- font-size: 35upx;
- color: #477ef3;
- vertical-align: middle;
- margin-right: 10upx;
- }
- .deliver-goods header .address {
- font-size: 26upx;
- color: #868686;
- background-color: #fff;
- padding: 30upx;
- }
- .deliver-goods header .address .name {
- font-size: 34upx;
- color: #282828;
- margin-bottom: 10upx;
- }
- .deliver-goods header .address .name .phone {
- margin-left: 40upx;
- }
- .deliver-goods header .line {
- width: 100%;
- height: 3upx;
- }
- .deliver-goods header .line image {
- width: 100%;
- height: 100%;
- display: block;
- }
- .deliver-goods .wrapper {
- width: 100%;
- background-color: #fff;
- }
- .deliver-goods .wrapper .item {
- border-bottom: 1px solid #f0f0f0;
- padding: 0 30upx;
- height: 96upx;
- font-size: 32upx;
- color: #282828;
- position: relative;
- }
- .deliver-goods .wrapper .item .mode {
- width: 460upx;
- height: 100%;
- text-align: right;
- }
- .deliver-goods .wrapper .item .mode .iconfont {
- font-size: 30upx;
- margin-left: 13upx;
- }
- .deliver-goods .wrapper .item .mode .goods~.goods {
- margin-left: 30upx;
- }
- .deliver-goods .wrapper .item .mode .goods {
- color: #bbb;
- }
- .deliver-goods .wrapper .item .mode .goods.on {
- color: #477ef3;
- }
- .deliver-goods .wrapper .item .icon-up {
- position: absolute;
- font-size: 35upx;
- color: #2c2c2c;
- right: 30upx;
- }
- .deliver-goods .wrapper .item select {
- direction: rtl;
- padding-right: 60upx;
- position: relative;
- z-index: 2;
- }
- .deliver-goods .wrapper .item input::placeholder {
- color: #bbb;
- }
- .deliver-goods .confirm {
- font-size: 32upx;
- color: #fff;
- width: 100%;
- height: 100upx;
- background-color: #477ef3;
- text-align: center;
- line-height: 100upx;
- position: fixed;
- bottom: 0;
- }
- .select-box {
- flex: 1;
- height: 100%;
- .pickerBox {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- width: 100%;
- height: 100%;
- text-align: right;
- }
- }
- </style>
|