123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <view class="send_box">
- <view class="guide_box" v-if="showGuide" @click="showGuide = false">
- <image src="../../static/imgs/shop/express.png" mode="" class="express_img"></image>
- </view>
- <view class="send_goods">
- <view>
- <view class="label">
- <text>发货单号</text>
- <text>*</text>
- </view>
- <view class="flexB scan_box">
- <input type="text" placeholder="在此输入快递单号" placeholder-class="place" v-model="express_no" />
- <view class="scan_btn flexCC" @click="scanCode()">快速录入单号</view>
- </view>
- </view>
- <view>
- <view class="label">
- <text>快递公司</text>
- <text>*</text>
- </view>
- <picker @change="bindPickerChange" :value="index" :range="logs" :range-key="'name'">
- <view class="picker flexB">
- <view class="inp_box" :style="{ color: express_company ? '#333' : '#999' }">
- {{ express_company ? express_company : '请选择快递公司' }}</view>
- <text class="iconfont iconzhcc_xiangxiajiantou"></text>
- </view>
- </picker>
- </view>
- <view v-if="express_company == '顺丰速运'">
- <view class="label">
- <text>收货人手机号</text>
- <text>*</text>
- </view>
- <input type="text" placeholder="在此输入收货人手机号" placeholder-class="place" v-model="express_phone" />
- </view>
- <view>
- <view class="label">
- <text>发货日期</text>
- <text>*</text>
- </view>
- <picker @change="bindDateChange" mode="date" :value="date" :start="startDay">
- <view class="picker flexB">
- <view class="inp_box">{{ date }}</view>
- <text class="iconfont iconzhcc_xiangxiajiantou"></text>
- </view>
- </picker>
- </view>
- <view class="sub_btn" @click="submit">提交</view>
- </view>
- </view>
- </template>
- <script>
- import {
- getLogsCode,
- addLogs,
- editLog,
- getExpress,
- location
- } from '../../apis/shop.js';
- export default {
- data() {
- return {
- num: '', //物流单号
- logs: [], //物流名称选项
- order_no: '', //订单编号
- index: 0, //选择物流名称
- startDay: '2020-01-01',
- date: '',
- express_phone: '', //发货时候如果是顺丰速运填写用户手机号
- express_company: '', //物流公司
- express_code: '', // 物流单号code值
- express_no: '', //物流单号
- img: '',
- showGuide: true
- };
- },
- onLoad(ops) {
- let data = JSON.parse(decodeURIComponent(ops.data));
- this.order_no = data.order_no;
- this.img = data.img;
- this.express_company = data.express_company;
- this.express_code = data.express_code;
- this.express_no = data.express_no;
- this.express_phone = data.express_phone;
- this.date = data.express_time;
- this.getCode();
- },
- methods: {
- //根据单号获取物流公司
- getExpress(expressCode) {
- getExpress({
- expressCode
- }).then(res => {
- if (res.code == 200) {
- if (!res.data.Success) {
- uni.showModal({
- content: '请重新扫码或手动选择输入',
- showCancel: false
- });
- return false;
- }
- this.express_no = res.data.LogisticCode;
- if (res.data.Shippers) {
- const {
- ShipperName,
- ShipperCode
- } = res.data.Shippers[0];
- this.express_company = ShipperName;
- this.express_code = ShipperCode;
- } else {
- uni.showModal({
- content: '请重新扫码或手动选择输入',
- showCancel: false
- });
- this.logsName = this.logsCode = '';
- }
- } else {
- uni.showModal({
- content: res.data || '获取数据失败',
- showCancel: false
- });
- }
- });
- },
- /*获取物流的*/
- getCode() {
- getLogsCode().then(res => {
- if (res.code == 200) {
- let list = res.data;
- for (let key in list) {
- this.logs.push({
- code: key,
- name: list[key]
- });
- }
- } else {
- uni.showModal({
- content: res.data || '获取物流公司失败',
- showCancel: false
- });
- }
- });
- },
- /*选择物流公司*/
- bindPickerChange(e) {
- let idx = e.detail.value;
- this.index = idx;
- this.express_company = this.logs[idx].name;
- this.express_code = this.logs[idx].code;
- console.log(this.express_code);
- },
- /*选择日期*/
- bindDateChange(e) {
- this.date = e.target.value;
- },
- submit() {
- if (!this.express_no) {
- uni.showModal({
- content: '物流单号不能为空',
- showCancel: false
- });
- return false;
- }
- if (this.express_company == '请选择物流公司') {
- uni.showModal({
- content: '物流名称不能为空',
- showCancel: false
- });
- return false;
- }
- if (this.express_company == '顺丰速运' && !this.express_phone) {
- uni.showModal({
- content: '请输入收货人手机号',
- showCancel: false
- });
- return false;
- }
- if (!this.date) {
- uni.showModal({
- content: '发货日期不能为空',
- showCancel: false
- });
- return false;
- }
- editLog({
- order_no: this.order_no,
- express_no: this.express_no,
- express_code: this.express_code,
- express_company: this.express_company,
- express_time: this.date,
- express_phone: this.express_phone
- }).then(res => {
- if (res.code == 200) {
- uni.showModal({
- content: '修改成功',
- showCancel: false,
- success: res => {
- if (res.confirm) {
- uni.reLaunch({
- url: '../logistics-detail/logistics-detail?order_no=' +
- this.order_no + '&img=' + this.img
- });
- }
- }
- });
- } else {
- uni.showModal({
- content: res.data || '修改失败',
- showCancel: false
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .guide_box {
- width: 100vw;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- z-index: 999;
- .express_img {
- width: 608rpx;
- height: 731rpx;
- }
- }
- .address_box {
- padding: 30rpx;
- width: 100%;
- box-sizing: border-box;
- background-color: #f9f9fb;
- border-radius: 24rpx;
- // margin: 30rpx 0;
- .icondizhi1 {
- color: $base-color;
- font-size: 50rpx;
- vertical-align: middle;
- }
- .gray {
- margin-left: 20rpx;
- }
- .iconiconfontjiantou2 {
- color: #999;
- }
- .ads_info {
- margin: 0 15rpx;
- .shop_info {
- font-size: 32rpx;
- font-weight: bold;
- text:last-child {
- font-size: 28rpx;
- color: #999;
- }
- }
- .ads_del {
- margin-top: 15rpx;
- }
- }
- }
- .new_user {
- .ads_picker {
- width: 690rpx;
- background: #f9f9fb;
- padding-right: 15rpx;
- input {
- width: 92%;
- font-size: 28rpx;
- }
- .iconfont {
- color: #999;
- }
- }
- }
- .send_box {
- width: 100%;
- min-height: 100%;
- background: #fff;
- .send_goods {
- width: 690rpx;
- margin: 0 auto;
- padding-top: 30rpx;
- .label {
- margin: 30rpx 0;
- text:first-child {
- font-size: 32rpx;
- font-weight: bold;
- }
- text:last-child {
- font-size: 32rpx;
- color: $base-color;
- font-weight: bold;
- }
- }
- .scan_box {
- width: 690rpx;
- background: #f9f9fb;
- border-radius: 8rpx;
- .scan_btn {
- width: 196rpx;
- height: 60rpx;
- background: #fff4f3;
- border: 2rpx solid #fb231f;
- border-radius: 34rpx;
- color: $base-color;
- margin-right: 10rpx;
- z-index: 999999;
- }
- input {
- width: 70%;
- }
- }
- .picker {
- background: #f9f9fb;
- height: 88rpx;
- line-height: 88rpx;
- border-radius: 8rpx;
- padding: 0 30rpx;
- .iconfont {
- color: #999;
- }
- .inp_box {
- font-size: 30rpx;
- }
- }
- input {
- height: 88rpx;
- background: #f9f9fb;
- border-radius: 8rpx;
- padding-left: 30rpx;
- box-sizing: border-box;
- }
- .place {
- font-size: 30rpx;
- color: #999;
- }
- .sub_btn {
- margin: 60rpx auto 50rpx;
- }
- }
- }
- </style>
|