Commit 1abb49e5 authored by knight's avatar knight

客户端-入仓须知

parent ce9f9b43
import request from '@/utils/request'
export function getNeedKnowByKey(param){
return request.get('/app-api/system/need-know/getByKey',param);
}
export function getUserIsAgree(param){
return request.get('/app-api/system/need-know/isAgreeBestVersion',param);
}
export function createUserAcceptance(param){
return request.post('/app-api/system/need-know/createUserAcceptance',param);
}
......@@ -86,25 +86,34 @@
<text style="background-color: #F59123" class="footer-btn" @tap="copyAll" @click="copyAll" text="">
一键复制
</text>
<text style="background-color: var(--c427)" @tap="navigateTo('address')" class="footer-btn"
<text style="background-color: var(--c427)" @tap="needKnowToggle('dialog','popupWarehouseIn')" class="footer-btn"
text="">{{ $lang.lang.cons.warehouseInNotice }}
</text>
<text style="background-color: red" class="footer-btn" @tap="navigateTo('prohibited')"
<text style="background-color: red" class="footer-btn" @tap="needKnowToggle('dialog','popupConsBanGoods')"
text="">{{ $lang.lang.cons.banGoods }}
</text>
</view>
</view>
</view>
<!-- 入仓须知 -->
<need-know ref="popupWarehouseIn" knowType="consWarehousingIn" :showButtons=false />
<!-- 禁运物品 -->
<need-know ref="popupConsBanGoods" knowType="consBanGoods" :showButtons=false />
</view>
</template>
<script>
import {getWarehouseList, getCountryTree, getWarehouse} from "@/api/ecw/warehouse";
import lang from "@/common/lang";
import SignInPicture from "@/pages/cons/components/signInPicture.vue";
import NeedKnow from "@/pages/need_know/components/needKnow.vue";
export default {
components: {NeedKnow, SignInPicture},
data() {
return {
warehouseList: null,
......@@ -198,6 +207,11 @@ export default {
});
},
// 入仓须知弹窗
needKnowToggle(type,knowType){
this.$refs[knowType].open(type)
},
/**
* 单项选择器切换事件
*/
......
......@@ -157,10 +157,10 @@
<text style="background-color: #F59123" class="footer-btn" @tap="navigateTo('address')" text="">
{{ $lang.lang.cons.myConsAddress }}
</text>
<text style="margin-left: 20upx;background-color: #910012" @tap="navigateTo('address')" class="footer-btn"
<text style="margin-left: 20upx;background-color: #910012" @tap="showNeedKnow('dialog','popupWarehouseInNotAgree')" class="footer-btn"
text="">{{ $lang.lang.cons.warehouseInNotice }}
</text>
<text style="margin-left: 20upx;background-color: red" class="footer-btn" @tap="navigateTo('prohibited')"
<text style="margin-left: 20upx;background-color: red" class="footer-btn" @tap="showNeedKnow('dialog','popupConsBanGoods')"
text="">{{ $lang.lang.cons.banGoods }}
</text>
</view>
......@@ -170,6 +170,13 @@
<button class="submit-btn" type="primary" @tap="handleSubmit">编辑</button>
<button class="cancel-btn" type="warning" @tap="navigateTo('../cons/index')">取消</button>
</view>
<!-- 入仓须知(自动弹出) -->
<need-know ref="popupWarehouseIn" knowType="consWarehousingIn" :showButtons=true />
<!-- 手动触发(没有同意按钮) -->
<need-know ref="popupWarehouseInNotAgree" knowType="consWarehousingIn" :showButtons=false />
<!-- 禁运物品 -->
<need-know ref="popupConsBanGoods" knowType="consBanGoods" :showButtons=false />
</view>
</view>
</view>
......@@ -180,8 +187,10 @@
import {getWarehouseList, getCountryTree} from "@/api/ecw/warehouse";
import {createCons, getExpressNo, getCons, updateCons} from "@/api/order/cons";
import lang from "@/common/lang";
import NeedKnow from "@/pages/need_know/components/needKnow.vue";
export default {
components: {NeedKnow},
data() {
const initForm = {
id: null, // 包裹id(编辑才有)
......@@ -237,9 +246,19 @@ export default {
this.getTransportType();
this.getCountryTree();
// 设置包裹id
this.form.id = option.id;
this.form.id = option.id > 0 ? option.id : null;
// 初始化编辑页面数据
this.init();
},
onReady() {
// 页面加载后自动弹出入仓须知页面
this.$nextTick(() => {
if (this.$refs.popupWarehouseIn && this.$refs.popupWarehouseIn.open && this.form.id === null) {
this.$refs.popupWarehouseIn.open("dialog");
}
});
},
computed: {
......@@ -264,6 +283,13 @@ export default {
}
},
/**
* 弹出入仓须知
*/
showNeedKnow(type,knowType){
this.$refs[knowType].open(type)
},
/**
* 获取运输方式
*/
......
......@@ -932,14 +932,18 @@
</uni-popup>
<drawee ref="drawee" :value="params.customDraweeVOList" @confirm="setCustomDrawee"></drawee>
<!-- 入仓须知(自动弹出) -->
<need-know ref="popupWarehouseIn" knowType="warehousing" :showButtons=true />
</view>
</template>
<script>
import Drawee from "@/pages/create_order/components/drawee.vue";
import NeedKnow from "@/pages/need_know/components/needKnow.vue";
export default {
components: {Drawee},
components: {NeedKnow, Drawee},
data() {
const currentDate = this.getDate({
format: true
......@@ -1194,6 +1198,18 @@ export default {
showFullConsignee: false
}
},
onReady() {
// 页面加载后自动弹出入仓须知页面
this.$nextTick(() => {
// 只有创建订单页面才显示
if (this.$refs.popupWarehouseIn && this.$refs.popupWarehouseIn.open && this.orderId === 0) {
// 如果不显示弹窗大概率是因为orderId不为0
this.$refs.popupWarehouseIn.open("dialog");
}
});
},
async onLoad (op) {
await this.getDstCountryList()
await this.getTransport()
......
<template>
<uni-popup ref="popupWarehouseIn" type="center" style="overflow-y: auto;">
<view class="popup-container">
<!-- 须知内容 -->
<scroll-view scroll-y="true" :style="{ maxHeight: showButtons ? '70vh' : '80vh' }">
<view v-if="detail.contentZh" class="html-content" v-html="detail.contentZh"></view>
<!-- 搜索结果为空 -->
<u-empty mode="data" v-else></u-empty>
</scroll-view>
<!-- 底部按钮 -->
<view class="button-group" v-if="showButtons">
<button class="btn agree" @tap="handleDisagree">我已同意</button>
<button class="btn disagree" @tap="handleAgree">我不同意</button>
</view>
</view>
</uni-popup>
</template>
<script>
import {createUserAcceptance, getNeedKnowByKey, getUserIsAgree} from "@/api/system/needKnow";
export default {
name: 'NeedKnow',
props:{
knowType: String,
showButtons: Boolean
},
data(){
return {
detail: {},
}
},
created(){
this.getNeedKnow();
},
methods:{
async getNeedKnow(){
await getNeedKnowByKey({key:this.knowType}).then(res => {
this.detail = res.data
});
},
async open(type){
if (this.showButtons && ( this.knowType === "consWarehousingIn" || this.knowType === "warehousing" )){
const needKnow = await getNeedKnowByKey({key:this.knowType});
this.detail = needKnow.data;
// 如果是入仓须知需要显示同意按钮判断是否同意过最新版本
const res = await getUserIsAgree({needKnowId:needKnow.data.id , version:needKnow.data.currentVersion});
if (res.data === false || res.data === null){
// 未同意过则弹出
this.$refs.popupWarehouseIn.open(type)
}
}else{
this.$refs.popupWarehouseIn.open(type)
}
},
// 点击同意
handleDisagree(){
// 当用户点击同意后则生成一条记录
createUserAcceptance({
needKnowId: this.detail.id,
version: this.detail.currentVersion,
});
this.$refs.popupWarehouseIn.close();
},
// 点击不同意
handleAgree(){
uni.navigateBack({delta: 1}) // 返回上一页
},
}
}
</script>
<style scoped>
@import url(../../../static/css/need_know.css);
</style>
.popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: flex-start; /* 顶部对齐 */
padding-top: 200rpx; /* 增加顶部间距 */
}
.popup-container {
margin-top: 100rpx;
width: 650rpx;
background: #fff;
border-radius: 16rpx;
overflow: hidden;
padding: 10upx;
}
.html-content {
line-height: 1.6;
font-size: 28rpx;
color: #333;
}
.title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
margin-bottom: 24rpx;
}
.sub-title {
font-weight: bold;
margin: 24rpx 0 16rpx;
}
.item {
margin-bottom: 12rpx;
}
.button-group {
display: flex;
justify-content: space-between;
padding: 24rpx 32rpx;
border-top: 1rpx solid #eee;
}
.btn {
flex: 0.48;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
font-size: 30rpx;
}
.disagree {
background: var(--ce6);
color: var(--c0);
}
.agree {
background: #007aff;
color: var(--c0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment