123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909 |
- <template>
- <view class="deliver-goods">
- <header class="header">
- <view class="order-num">
- <view class="num line1">订单号:{{ order_id }}</view>
-
- {{ delivery.nickname }
- </view>
- <view class="address">
- <view class="name">
- <text class="iconfont icon-ic_location4"></text>
- {{ delivery.real_name }}
- <text class="phone">{{ delivery.user_phone }}</text>
- </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">
- <template v-for="(item, index) in types">
- <view v-if="item.show" class="goods" :class="(active === index || productType==3) ? 'on' : ''" :key="index" @click="changeType(item, index)">
- <text :class="['iconfont', active === index ? 'icon-ic_Selected' : 'icon-ic_unselect']"></text>
- {{ item.title }}
- </view>
- </template>
- </view>
- </view>
- <block v-if="logistics.length>0">
- <view class="list" v-show="active === 0">
- <view class="item acea-row row-middle" v-if="delivery.config_export_open == 1">
- <view>发货类型</view>
- <view class="mode acea-row row-middle row-right">
- <view class="goods" :class="curExpress === item.key ? 'on' : ''" v-for="(item, index) in expressType" :key="index" @click="changeExpTpe(item, index)">
- <text :class="['iconfont', curExpress === item.key ? 'icon-ic_Selected' : 'icon-ic_unselect']"></text>
- {{ item.title }}
- </view>
- </view>
- </view>
- <block v-if="curExpress == 1">
- <view class="item acea-row row-middle">
- <view>快递公司</view>
- <view class="select-box">
- <picker class="pickerBox" @change="bindPickerChange" :value="seIndex" :range="logistics" range-key="name">
- <view class="uni-input">{{logistics[seIndex].name}}</view>
- </picker>
- </view>
- <text class="iconfont icon-ic_rightarrow"></text>
- </view>
- <view class="item acea-row row-middle">
- <view>快递单号</view>
- <input type="text" placeholder="请输入" v-model="delivery_id" class="mode" />
-
- <text class="iconfont icon-xiangji" @click="scanCode"></text>
-
-
- <text v-if="isWeixin" class="iconfont icon-xiangji" @click="scanCode"></text>
-
- </view>
- <view class="item">
- <view class="trip" v-if="curExpress == 1">顺丰请输入单号 :收件人或寄件人手机号后四位</view>
- <view class="trip" v-if="curExpress == 1">例如:SF000000000000:3941</view>
- </view>
- </block>
- <block v-if="curExpress == 2">
- <view class="item acea-row row-between-wrapper">
- <view>寄件人姓名:</view>
- <input type="text" placeholder="填写寄件人姓名" v-model="to_name" class="mode" />
- </view>
- <view class="item acea-row row-between-wrapper">
- <view>寄件人电话:</view>
- <input type="text" placeholder="填写寄件人电话" v-model="to_tel" class="mode" />
- </view>
- <view class="item acea-row row-between-wrapper">
- <view>寄件人地址:</view>
- <input type="text" placeholder="填写寄件人地址" v-model="to_addr" class="mode" />
- </view>
- <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="name">
-
- <view class="uni-input">{{logistics[seIndex].name}}</view>
- </picker>
- </view>
- </view>
- <view class="item acea-row row-between-wrapper" v-if="expTemp.length>0">
- <view>电子面单</view>
- <view class="picker-add">
- <picker class="pickerBox" @change="bindTempChange" :value="expIndex" :range="expTemp" range-key="title">
- <view class="uni-input">{{expTemp[expIndex].title}}</view>
- </picker>
- <view class="look" @click="previewImage">预览</view>
- </view>
- </view>
- </block>
- </view>
- </block>
- <view class="list" v-show="active === 1">
- <view class="item acea-row row-between-wrapper">
- <view>送货人</view>
- <view class="select-box" v-if="postPeople.length>0">
- <picker class="pickerBox" @change="bindPostChange" :value="postIndex" :range="postPeople" range-key="wx_name">
- <view class="acea-row row-middle">
- <view class="uni-input">{{postPeople[postIndex].wx_name}}</view>
- <text class="iconfont icon-ic_rightarrow"></text>
- </view>
- </picker>
- </view>
- </view>
- <view class="item acea-row row-between-wrapper" v-if="postPeople[postIndex]">
- <view>手机号</view>
- <view class="select-box acea-row row-middle row-right">{{postPeople[postIndex].phone}}</view>
- </view>
- </view>
- <textarea v-show="active === 2" v-model="fictitious_content" class="textarea" @blur="bindTextAreaBlur" placeholder="备注" :maxlength="500" auto-height />
- </view>
- <view class="split-wrapper" v-if="totalNum>1">
- <view class="split-switch acea-row row-between-wrapper">
- <view>分单发货</view>
-
- {{ item.title }
- <view class="switch" :class="{ on: curGoods }" @click="changeGoods"></view>
- </view>
- <splitOrder :select_all="false" :splitGoods="splitGoods" @getList="getList" v-if="curGoods"></splitOrder>
- </view>
- <view class="height-add"></view>
- <view class="confirm-wrapper">
- <view class="confirm" @click="saveInfo">确认提交</view>
- </view>
- </view>
- </template>
- <script>
- import {
- getStoreOrderDelivery,
- getAdminOrderDelivery,
- setStoreOrderDelivery,
- setAdminOrderDelivery,
- getLogistics,
- storeOrderExportTemp,
- orderExportTemp,
- storeOrderDeliveryInfo,
- orderDeliveryInfo,
- storeOrderDelivery,
- orderOrderDelivery,
- storeOrderSplitInfo,
- orderSplitInfo,
- storeOrderSplitDelivery,
- orderSplitDelivery
- } from "@/api/admin";
- import splitOrder from '@/components/splitOrder';
- export default {
- name: "GoodsDeliver",
- components: {
- splitOrder
- },
- props: {},
- data: function() {
- return {
- types: [{
- type: "express",
- title: "发货",
- key: 1,
- show: true,
- },
- {
- type: "send",
- title: "送货",
- key: 2,
- show: true,
- },
- {
- type: "fictitious",
- title: "无需物流",
- key: 3,
- show: true,
- }
- ],
- expressType: [{
- title: '手动填写',
- key: 1
- },
- {
- title: '电子面单打印',
- key: 2
- },
- ],
- orderGoods: [{
- title: '开启',
- key: 1
- },
- {
- title: '关闭',
- key: 0
- }
- ],
- curExpress: 1,
- active: 0,
- order_id: "",
- delivery: [],
- logistics: [],
- delivery_type: "1",
- delivery_name: "",
- delivery_id: "",
- seIndex: 0,
- expIndex: 0,
- expTemp: [],
- to_name: '',
- to_tel: '',
- to_addr: "",
- postPeople: [],
- postIndex: 0,
- fictitious_content: '',
- listId: 0,
- curGoods: 0,
- splitGoods: [],
- cartIds: [],
- totalNum: 0,
- productType: 0,
- storeNum:1,
-
- isWeixin: this.$wechat.isWeixin()
-
- };
- },
- watch: {
- "$route.params.oid": function(newVal) {
- let that = this;
- if (newVal != undefined) {
- that.order_id = newVal;
- that.getIndex();
- }
- }
- },
- onLoad: function(option) {
- this.storeNum = parseInt(option.storeNum);
- this.order_id = option.id;
- this.listId = option.listId;
- this.totalNum = option.totalNum;
- this.comeType = option.comeType;
- this.productType = option.productType
- if (this.productType == 3) {
- // this.types.splice(0, 2);
- for (let i = 0; i < this.types.length; i++) {
- if (i == 2) {
- this.types[i].show = true;
- } else {
- this.types[i].show = false;
- }
- }
- this.delivery_type = 3;
- this.active = 2;
- }
- if (option.orderStatus == 8 || option.orderStatus == 4 || option.orderStatus == 9) {
- this.curGoods = 1;
- this.orderGoods.pop();
- this.splitList();
- }
- this.getIndex();
- this.getLogistics();
- this.orderDeliveryInfo()
- this.geTorderOrderDelivery()
- },
- methods: {
- getList(val) {
- let that = this;
- that.splitGoods = val;
- let cartIds = [];
- val.forEach((item) => {
- if (item.checked) {
- let i = {
- cart_id: item.cart_id,
- cart_num: item.surplus_num
- }
- cartIds.push(i)
- }
- })
- this.cartIds = cartIds;
- },
- splitList() {
- let funApi = '';
- if(this.storeNum){
- funApi = orderSplitInfo;
- }else{
- funApi = storeOrderSplitInfo;
- }
- funApi(this.listId).then(res => {
- let list = res.data;
- list.forEach((item) => {
- item.checked = false
- item.numShow = item.surplus_num
- })
- this.splitGoods = list;
- }).catch(err => {
- return this.$util.Tips({
- title: err
- });
- })
- },
-
- changeGoods() {
- this.curGoods = this.curGoods ? 0 : 1;
- if (this.curGoods) {
- this.splitList();
- }
- },
-
- scanCode() {
- // #ifdef MP
- let that = this;
- uni.scanCode({
- scanType: ['barCode'],
- success(res) {
- that.delivery_id = res.result;
- }
- })
-
-
- if (this.$wechat.isWeixin()) {
- this.$wechat.wechatEvevt('scanQRCode', {
- needResult: 1,
- scanType: ['barCode']
- }).then(res => {
- let result = res.resultStr.split(",");
- this.delivery_id = result[1];
- });
- }
-
- },
-
- previewImage() {
- uni.previewImage({
- urls: [this.expTemp[this.expIndex].pic],
- success: function() {
- },
- fail: function(error) {
- }
- });
- },
-
- geTorderOrderDelivery() {
- let funApi = '';
- // if(this.storeNum){
- // funApi = orderOrderDelivery;
- // }else{
- // funApi = storeOrderDelivery;
- // }
- funApi = orderOrderDelivery;
- funApi().then(res => {
- this.postPeople = res.data
- })
- },
-
- bindPostChange(e) {
- this.postIndex = e.detail.value
- },
-
- changeExpTpe(item, index) {
- this.curExpress = item.key
- this.getLogistics(index || '');
- },
- changeType: function(item, index) {
- this.active = index;
- this.delivery_type = item.key;
- },
- getIndex: function() {
- let that = this;
- let funApi = '';
- // if(this.storeNum){
- // funApi = getAdminOrderDelivery;
- // }else{
- // funApi = getStoreOrderDelivery;
- // }
- funApi = getAdminOrderDelivery;
- funApi(that.order_id).then(
- res => {
- that.delivery = res.data;
- },
- error => {
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- getLogistics(status) {
- let that = this;
- getLogistics({
- status
- }).then(
- res => {
- that.logistics = res.data;
- that.getExpTemp(res.data[0].code)
- },
- error => {
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- async saveInfo() {
- let that = this,
- delivery_type = that.delivery_type,
- delivery_name = that.logistics[that.seIndex].name,
- delivery_id = that.delivery_id,
- userName = that.delivery_name,
- save = {};
- save.delivery_type = delivery_type;
- save.delivery_code = that.logistics[that.seIndex].code
- save.delivery_name = that.logistics[that.seIndex].name
- save.type = that.active + 1
- if (delivery_type == 1 && this.curExpress == 1) {
- if (!delivery_id) {
- return this.$util.Tips({
- title: '请填写快递单号'
- })
- }
- save.express_record_type = that.curExpress
- save.delivery_id = delivery_id
- if (that.curGoods) {
- that.setSplitInfo(save)
- } else {
- that.setInfo(save);
- }
- }
- if (delivery_type == 1 && this.curExpress == 2) {
- if (!that.to_name) {
- return this.$util.Tips({
- title: '请填写寄件人姓名'
- })
- }
- if (!that.to_tel) {
- return this.$util.Tips({
- title: '请填写寄件人手机号码'
- })
- }
- if (!(/^1[3456789]\d{9}$/.test(that.to_tel))) {
- return this.$util.Tips({
- title: '请填写寄件人手机号码'
- })
- }
- if (!that.to_addr) {
- return this.$util.Tips({
- title: '请填写寄件人地址'
- })
- }
- if (that.expTemp.length == 0) {
- return this.$util.Tips({
- title: '请选择电子面单'
- })
- }
- save.express_record_type = that.curExpress
- save.to_name = that.to_name
- save.to_tel = that.to_tel
- save.to_addr = that.to_addr
- save.express_temp_id = that.expTemp[that.expIndex].temp_id
- if (that.curGoods) {
- that.setSplitInfo(save)
- } else {
- that.setInfo(save);
- }
- }
- if (delivery_type == 2) {
- if (!that.postPeople.length) {
- return this.$util.Tips({
- title: '请在平台后台添加送货人'
- })
- }
- let obj = this.postPeople[this.postIndex]
- let params = {}
- params.type = that.delivery_type
- params.sh_delivery_name = obj.wx_name
- params.sh_delivery_id = obj.phone
- params.sh_delivery_uid = obj.uid
- if (that.curGoods) {
- that.setSplitInfo(params)
- } else {
- that.setInfo(params);
- }
- }
- if (delivery_type == 3) {
- let params = {}
- params.type = that.delivery_type;
- params.fictitious_content = that.fictitious_content;
- if (that.curGoods) {
- that.setSplitInfo(params)
- } else {
- that.setInfo(params);
- }
- }
- {
- // case "2":
- // if (!userName) {
- // return that.$util.Tips({
- // title: '请填写送货人姓名'
- // })
-
- {
- // return that.$util.Tips({
- // title: '请填写正确的手机号码'
- // })
-
-
-
-
-
-
- {
- // return this.$util.Tips({
- // title: '请填写快递单号'
- // })
-
-
-
-
-
-
-
-
-
- },
- setInfo: function(item) {
- let that = this;
- let funApi = '';
- // if(this.storeNum){
- // funApi = setAdminOrderDelivery;
- // }else{
- // funApi = setStoreOrderDelivery;
- // }
- funApi = setAdminOrderDelivery;
- funApi(that.delivery.id, item).then(
- res => {
- that.$util.Tips({
- title: res.msg,
- icon: 'success',
- mask: true
- })
- setTimeout(res => {
- if (this.comeType == 2) {
- uni.navigateTo({
- url: '/pages/admin/orderDetail/index?id=' + this.order_id+'&storeNum='+this.storeNum
- })
- } else {
- uni.navigateTo({
- url: '/pages/admin/orderList/index?types=1'
- })
- }
- }, 2000)
- },
- error => {
- that.$util.Tips({
- title: error
- })
- }
- );
- },
- setSplitInfo(item) {
- if (!this.cartIds.length) {
- return this.$util.Tips({
- title: '请选择发货商品'
- })
- }
- item.cart_ids = this.cartIds
- let funApi = '';
- if(this.storeNum){
- funApi = orderSplitDelivery;
- }else{
- funApi = storeOrderSplitDelivery;
- }
- funApi(this.delivery.id, item).then(res => {
- this.$util.Tips({
- title: res.msg,
- icon: 'success',
- mask: true
- })
- setTimeout(res => {
- if (this.comeType == 2) {
- uni.navigateTo({
- url: '/pages/admin/orderDetail/index?id=' + this.order_id+'&storeNum='+this.storeNum
- })
- } else {
- uni.navigateTo({
- url: '/pages/admin/orderList/index?types=1'
- })
- }
- }, 2000)
- }).catch(err => {
- this.$util.Tips({
- title: err
- })
- })
- },
- bindPickerChange(e) {
- this.seIndex = e.detail.value
- this.getExpTemp(this.logistics[e.detail.value].code)
- },
- bindTempChange(e) {
- this.expIndex = e.detail.value
- },
- getExpTemp(code) {
- let funApi = '';
- if(this.storeNum){
- funApi = orderExportTemp;
- }else{
- funApi = storeOrderExportTemp;
- }
- funApi({
- com: code
- }).then(res => {
- this.expTemp = res.data.data
- })
- },
-
- orderDeliveryInfo() {
- let funApi = '';
- // if(this.storeNum){
- // funApi = orderDeliveryInfo;
- // }else{
- // funApi = storeOrderDeliveryInfo;
- // }
- funApi = orderDeliveryInfo;
- funApi().then(res => {
- this.to_name = res.data.to_name;
- this.to_tel = res.data.to_tel;
- this.to_addr = res.data.to_add;
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .picker-add {
- display: flex;
- align-items: center;
- }
- .height-add {
- height: 120upx;
- }
-
- .deliver-goods {
- padding: 22rpx 20rpx;
- }
- .deliver-goods .header {
- position: relative;
- padding: 0 32rpx;
- border-radius: 24rpx;
- background: #FFFFFF;
- overflow: hidden;
- }
- .deliver-goods .header .order-num {
- padding: 20rpx 0;
- border-bottom: 1px dotted #EEEEEE;
- }
- .deliver-goods .header .order-num .num {
- font-size: 28rpx;
- line-height: 40rpx;
- color: #333333;
- position: relative;
- }
- .deliver-goods header .order-num .num:after {}
- .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 {
- padding: 20rpx 0 40rpx;
- font-size: 24rpx;
- line-height: 34rpx;
- color: #999999;
- }
- .deliver-goods .header .address .name {
- font-weight: 500;
- font-size: 30rpx;
- line-height: 42rpx;
- color: #333333;
- margin-bottom: 12rpx;
- }
- .deliver-goods .header .address .name .iconfont {
- margin-right: 8rpx;
- font-size: 32rpx;
- }
- .deliver-goods .header .address .name .phone {
- margin-left: 40rpx;
- }
- .deliver-goods .header .line {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 4rpx;
- }
- .deliver-goods .header .line image {
- width: 100%;
- height: 100%;
- display: block;
- }
- .deliver-goods .wrapper {
- padding: 12rpx 0;
- border-radius: 24rpx;
- margin-top: 20rpx;
- background-color: #fff;
- }
- .deliver-goods .wrapper .item {
- padding: 0 24rpx;
- height: 80rpx;
- font-size: 28rpx;
- color: #333333;
- position: relative;
- }
- .deliver-goods .wrapper .item .mode {
- flex: 1;
- height: 100%;
- text-align: right;
- }
- .deliver-goods .wrapper .item .mode .iconfont {
- font-size: 32rpx;
- margin-right: 12rpx;
- color: #CCCCCC;
- }
- .deliver-goods .wrapper .item .mode .goods~.goods {
- margin-left: 50rpx;
- }
- .deliver-goods .wrapper .item .mode .goods {
- color: #999999;
- }
- .deliver-goods .wrapper .item .mode .goods.on {
- color: #333333;
- }
- .deliver-goods .wrapper .item .mode .goods.on .iconfont {
- color: #2A7EFB;
- }
- .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-wrapper {
- position: fixed;
- left: 0;
- bottom: 0;
- bottom: constant(safe-area-inset-bottom);
- bottom: env(safe-area-inset-bottom);
- width: 100%;
- padding: 20rpx;
- }
- .deliver-goods .confirm {
- font-weight: 500;
- font-size: 28rpx;
- color: #fff;
- height: 80rpx;
- border-radius: 40rpx;
- background: #2A7EFB;
- text-align: center;
- line-height: 80rpx;
- }
- .select-box {
- flex: 1;
- height: 100%;
- .pickerBox {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- width: 100%;
- height: 100%;
- .iconfont {
- margin-left: 8rpx;
- font-size: 24rpx;
- color: #999999;
- }
- }
- }
- .look {
- margin-left: 20rpx;
- color: #1890FF;
- }
- .textarea {
- display: block;
- min-height: 192rpx;
- padding: 30rpx;
- width: 100%;
- border-bottom: 1px solid #f0f0f0;
- box-sizing: border-box;
- }
- .icon-xiangji {
- font-size: 35rpx;
- color: #477ef3;
- }
- .trip {
- font-size: 22rpx;
- color: #ccc;
- padding: 6rpx 0;
- }
- .split-wrapper {
- border-radius: 24rpx;
- margin-top: 20rpx;
- background: #FFFFFF;
- .splitOrder {
- padding: 0 24rpx 46rpx;
- margin: 0;
- }
- }
- .split-switch {
- padding: 40rpx 24rpx;
- font-size: 28rpx;
- color: #333333;
- .switch {
- position: relative;
- width: 79rpx;
- height: 48rpx;
- padding: 4rpx;
- border-radius: 24rpx;
- background: #DDDDDD;
- transition: background 0.1s, border 0.1s;
- &::after {
- content: "";
- position: absolute;
- top: 4rpx;
- left: 4rpx;
- width: 40rpx;
- height: 40rpx;
- border-radius: 20rpx;
- background: #FFFFFF;
- box-shadow: 0 3rpx 6rpx 0 rgba(0, 0, 0, 0.08);
- transition: transform 0.35s cubic-bezier(0.4, 0.4, 0.25, 1.35);
- }
- &.on {
- background: #2A7EFB;
- &::after {
- transform: translateX(31rpx);
- }
- }
- }
- }
- </style>
|