|
@@ -56,17 +56,11 @@
|
|
<van-col span="8">交易数量</van-col>
|
|
<van-col span="8">交易数量</van-col>
|
|
<van-col span="8">单价¥</van-col>
|
|
<van-col span="8">单价¥</van-col>
|
|
</van-row>
|
|
</van-row>
|
|
- <van-row justify="center">
|
|
|
|
- <van-col span="8">张三</van-col>
|
|
|
|
- <van-col span="8">1000</van-col>
|
|
|
|
- <van-col span="8">11.01</van-col>
|
|
|
|
- </van-row>
|
|
|
|
- <van-row justify="center">
|
|
|
|
- <van-col span="8">李四</van-col>
|
|
|
|
- <van-col span="8">1500</van-col>
|
|
|
|
- <van-col span="8">11.21</van-col>
|
|
|
|
|
|
+ <van-row v-for="(item, index) in sellerList" :key="index" justify="center">
|
|
|
|
+ <van-col span="8">卖家{{ index + 1 }}</van-col>
|
|
|
|
+ <van-col span="8">{{ item.amount }}</van-col>
|
|
|
|
+ <van-col span="8">{{ item.price }}</van-col>
|
|
</van-row>
|
|
</van-row>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 分割线 -->
|
|
<!-- 分割线 -->
|
|
@@ -139,36 +133,28 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
|
-import { onMounted, reactive, toRefs, ref, onActivated } from "vue";
|
|
|
|
-import { showFailToast, showSuccessToast, showToast, showDialog } from "vant";
|
|
|
|
|
|
+import { onMounted, reactive, toRefs, ref } from "vue";
|
|
import sHeader from "@/components/SimpleHeader";
|
|
import sHeader from "@/components/SimpleHeader";
|
|
import { getLoginUser, Format_calcuDecial, styleUrl } from "@/common/js/utils";
|
|
import { getLoginUser, Format_calcuDecial, styleUrl } from "@/common/js/utils";
|
|
import {
|
|
import {
|
|
- eliminate,
|
|
|
|
- Api_getReplenishment,
|
|
|
|
- changeSleepDesc,
|
|
|
|
|
|
+
|
|
} from "../../service/trading/index";
|
|
} from "../../service/trading/index";
|
|
-import { onBeforeRouteLeave, useRouter } from "vue-router";
|
|
|
|
-import dateUtil from "../../utils/dateUtil";
|
|
|
|
-import { useI18n } from "vue-i18n";
|
|
|
|
-import { onBeforeUnmount } from "vue";
|
|
|
|
|
|
+import { useRouter } from "vue-router";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "trading",
|
|
name: "trading",
|
|
components: { sHeader },
|
|
components: { sHeader },
|
|
setup() {
|
|
setup() {
|
|
- const { t } = useI18n();
|
|
|
|
|
|
+ const router = useRouter();
|
|
const searchRef = ref(null);
|
|
const searchRef = ref(null);
|
|
const oprRef = ref(null);
|
|
const oprRef = ref(null);
|
|
const list = ref([]);
|
|
const list = ref([]);
|
|
const loading = ref(true);
|
|
const loading = ref(true);
|
|
const error = ref(false);
|
|
const error = ref(false);
|
|
const finished = ref(false);
|
|
const finished = ref(false);
|
|
- const router = useRouter();
|
|
|
|
const sys = ref(null);
|
|
const sys = ref(null);
|
|
const user = getLoginUser();
|
|
const user = getLoginUser();
|
|
- const verticalScrollPosition = ref(0);
|
|
|
|
const labelList = ref([]);
|
|
const labelList = ref([]);
|
|
|
|
|
|
const countDownTime = ref(0);
|
|
const countDownTime = ref(0);
|
|
@@ -182,84 +168,30 @@ export default {
|
|
{ name: '钱七', amount: 60, price: 70 }
|
|
{ name: '钱七', amount: 60, price: 70 }
|
|
];
|
|
];
|
|
|
|
|
|
- const calculateCountDownTime = () => {
|
|
|
|
- const nowTime = new Date();
|
|
|
|
- const endTime = new Date();
|
|
|
|
- endTime.setHours(17, 0, 0, 0);
|
|
|
|
-
|
|
|
|
- let timeDiff = endTime.getTime() - nowTime.getTime();
|
|
|
|
- if (timeDiff <= 0) {
|
|
|
|
- // 如果目标时间已经过了或者就是现在,则将倒计时时间设置为 0
|
|
|
|
- countDownTime.value = 0;
|
|
|
|
- } else {
|
|
|
|
- countDownTime.value = timeDiff;
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+ const sellerList = ref([]);
|
|
|
|
+ sellerList.value = [
|
|
|
|
+ { name: '张xx', amount: 10000, price: 50 },
|
|
|
|
+ { name: '李xx', amount: 9000, price: 51 },
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
|
|
const pushPageList = (url) => {
|
|
const pushPageList = (url) => {
|
|
router.push(url);
|
|
router.push(url);
|
|
- };
|
|
|
|
-
|
|
|
|
- // 返回顶部
|
|
|
|
- const backTop = () => {
|
|
|
|
- window.scrollY = 0;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- onActivated(() => {
|
|
|
|
- // 当组件被激活时,可能是从 keep-alive 缓存中激活的
|
|
|
|
- // 这时重新添加滚动事件监听器
|
|
|
|
- console.log("进入时的位置", verticalScrollPosition.value);
|
|
|
|
- document.documentElement.scrollTop = verticalScrollPosition.value;
|
|
|
|
- document.body.scrollTop = verticalScrollPosition.value;
|
|
|
|
- window.scrollY = verticalScrollPosition.value;
|
|
|
|
- // window.addEventListener('scroll', handleScroll);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- onBeforeRouteLeave(() => {
|
|
|
|
- verticalScrollPosition.value = document.documentElement.scrollTop || document.body.scrollTop || window.scrollY;
|
|
|
|
- console.log("离开时的位置", verticalScrollPosition.value);
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- // 在组件卸载前清除定时器
|
|
|
|
- onBeforeUnmount(() => {
|
|
|
|
- clearInterval(updateDataInterval);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- const updateDataInterval = () => {
|
|
|
|
- // 每隔5分钟更新数据
|
|
|
|
- setInterval(() => {
|
|
|
|
- init();
|
|
|
|
- if (oprRef.value) {
|
|
|
|
- oprRef.value.closeOper();
|
|
|
|
- }
|
|
|
|
- // verticalScrollPosition.value = 0;
|
|
|
|
- }, 5 * 60 * 1000); // 5分钟的毫秒数
|
|
|
|
- };
|
|
|
|
- //控制睡眠描述的显示隐藏
|
|
|
|
- const sleepDescBoxShow = ref(true);
|
|
|
|
|
|
+
|
|
|
|
+
|
|
// 页面列表查询参数
|
|
// 页面列表查询参数
|
|
let searchParams = reactive({
|
|
let searchParams = reactive({
|
|
- id: "", // 用户账户id
|
|
|
|
- // adminName: '', // 用户登录名
|
|
|
|
- current: 1, // 页数
|
|
|
|
- size: 10, // 页大小
|
|
|
|
- todayDate: dateUtil.formateDate(new Date(), "yyyy-MM-dd"), // 当天时间
|
|
|
|
- labelId: "", // 分组标签
|
|
|
|
|
|
+ current: 1, // 当前页,默认第一页,1
|
|
|
|
+ size: 10, // 每页多少条数据,默认10条
|
|
});
|
|
});
|
|
|
|
+
|
|
// 初始化页面获取列表
|
|
// 初始化页面获取列表
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- sleepDescBoxShow.value = true;
|
|
|
|
init();
|
|
init();
|
|
- updateDataInterval();
|
|
|
|
- // window.addEventListener('scroll', handleScroll);
|
|
|
|
// 加载样式
|
|
// 加载样式
|
|
styleUrl('trading');
|
|
styleUrl('trading');
|
|
- calculateCountDownTime();
|
|
|
|
- setInterval(() => {
|
|
|
|
- calculateCountDownTime();
|
|
|
|
- }, 1000);
|
|
|
|
|
|
+
|
|
});
|
|
});
|
|
// 初始化
|
|
// 初始化
|
|
const init = () => {
|
|
const init = () => {
|
|
@@ -270,9 +202,6 @@ export default {
|
|
// }
|
|
// }
|
|
list.value = [];
|
|
list.value = [];
|
|
searchParams.current = 1;
|
|
searchParams.current = 1;
|
|
- if (user) {
|
|
|
|
- searchParams.id = user.id;
|
|
|
|
- }
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -283,144 +212,8 @@ export default {
|
|
searchParams.current = searchParams.current + 1;
|
|
searchParams.current = searchParams.current + 1;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- // 搜索点击
|
|
|
|
- const searchClick = () => {
|
|
|
|
- searchRef.value.showSearch();
|
|
|
|
- };
|
|
|
|
- // 搜索条件触发查询
|
|
|
|
- const search = (e) => {
|
|
|
|
- list.value = [];
|
|
|
|
- loading.value = true;
|
|
|
|
- searchParams.current = 1;
|
|
|
|
- searchParams = Object.assign(searchParams, e);
|
|
|
|
- };
|
|
|
|
- // 跳转设备编辑
|
|
|
|
- const tradingSet = (e) => {
|
|
|
|
- router.push({ path: "tradingSet", query: { tradingId: e.id } });
|
|
|
|
- };
|
|
|
|
- // 常用操作弹窗展示触发
|
|
|
|
- const tradingOprShow = (e) => {
|
|
|
|
- oprRef.value.showOper(e);
|
|
|
|
- };
|
|
|
|
- // 消除报警
|
|
|
|
- const clearAlarm = async (e) => {
|
|
|
|
- const params = {
|
|
|
|
- id: e.id,
|
|
|
|
- name: e.name,
|
|
|
|
- selfName: e.selfName,
|
|
|
|
- areaId: e.areaId,
|
|
|
|
- channel: e.channel,
|
|
|
|
- contactName: e.contactName,
|
|
|
|
- contactPhone: e.contactPhone,
|
|
|
|
- flowers: e.flowers,
|
|
|
|
- operationalName: e.operationalName,
|
|
|
|
- operationalPhone: e.operationalPhone,
|
|
|
|
- timeRuleId: e.timeRuleId,
|
|
|
|
- };
|
|
|
|
- const { data } = await eliminate(Object.assign({}, params));
|
|
|
|
- if (data.code) {
|
|
|
|
- showSuccessToast(t("trading.successfullyEliminatedTheAlarm"));
|
|
|
|
- e.alarmList = [];
|
|
|
|
- } else {
|
|
|
|
- showFailToast(data.message);
|
|
|
|
- }
|
|
|
|
- console.log("/tEquipment/eliminate", e);
|
|
|
|
- };
|
|
|
|
- const showDateTime = (date) => {
|
|
|
|
- if (!date) {
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
- const currentDate = new Date(dateUtil.formateDate(new Date(date), "yyyy/MM/dd hh:mm:ss"));
|
|
|
|
- return dateUtil.timeZoneDate(currentDate);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- // 点击查看定位
|
|
|
|
- const viewPosiClk = (row) => {
|
|
|
|
- console.log("row 是 >>>", row);
|
|
|
|
- if (row.latitude) {
|
|
|
|
- router.push({
|
|
|
|
- path: "viewPosition",
|
|
|
|
- query: {
|
|
|
|
- latitude: row.latitude,
|
|
|
|
- longitude: row.longitude,
|
|
|
|
- fullName: row.fullName,
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- showToast(`${t("trading.noPosition")}!!!`);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- // 点击补料
|
|
|
|
- const replenishmentClk = (row) => {
|
|
|
|
- console.log("row >>>", row);
|
|
|
|
- Api_getReplenishment({ equipmentId: row.id }).then((res) => {
|
|
|
|
- console.log("res >>>", res);
|
|
|
|
- // Toast(res.data.message);
|
|
|
|
- showDialog({
|
|
|
|
- message: t('trading.sentSuccessfully'),
|
|
|
|
- }).then(() => {
|
|
|
|
- //返回上一页
|
|
|
|
- router.go(0);
|
|
|
|
- });
|
|
|
|
- setTimeout(() => {
|
|
|
|
- }, 500);
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- // 操作弹窗完成的回调
|
|
|
|
- const operFinish = () => {
|
|
|
|
- init();
|
|
|
|
- };
|
|
|
|
- // 设备状况
|
|
|
|
- const equipStatus = ref({});
|
|
|
|
-
|
|
|
|
- // 点击运行总数和总设备数
|
|
|
|
- const eqeStatusClk = (val) => {
|
|
|
|
- searchParams.eqeStatus = val;
|
|
|
|
- // 初始化
|
|
|
|
- searchParams.current = 1;
|
|
|
|
- list.value = [];
|
|
|
|
- };
|
|
|
|
- // 点击修改图标
|
|
|
|
- const editSleepDesc = () => {
|
|
|
|
- sleepDescBoxShow.value = !sleepDescBoxShow.value;
|
|
|
|
- }
|
|
|
|
- // 点击睡眠描述的确定按钮
|
|
|
|
- const sleepDescChg = async (sleepDesc, id) => {
|
|
|
|
- console.log(sleepDesc);
|
|
|
|
- if (!sleepDesc) {
|
|
|
|
- showToast(t("trading.sleepDescPlace"));
|
|
|
|
- } else {
|
|
|
|
- const { data } = await changeSleepDesc({
|
|
|
|
- equipmentId: id,
|
|
|
|
- sleepDesc,
|
|
|
|
- });
|
|
|
|
- if (data.code === "00000") {
|
|
|
|
- sleepDescBoxShow.value = true;
|
|
|
|
- showToast(data.message);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 点击标签
|
|
|
|
- const active = ref("");
|
|
|
|
- const clickLabel = (item) => {
|
|
|
|
- console.log(item);
|
|
|
|
- list.value = [];
|
|
|
|
- searchParams.current = 1;
|
|
|
|
- searchParams.labelId = item.name;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- const selectLabel = (action) => {
|
|
|
|
- // showToast(action.value);
|
|
|
|
- if (action.value == '0') {
|
|
|
|
- router.push('/labelMan');
|
|
|
|
- }
|
|
|
|
- if (action.value == '1') {
|
|
|
|
- router.push("/labelManAdd");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
return {
|
|
return {
|
|
...toRefs(searchParams),
|
|
...toRefs(searchParams),
|
|
list,
|
|
list,
|
|
@@ -429,32 +222,15 @@ export default {
|
|
finished,
|
|
finished,
|
|
onLoad,
|
|
onLoad,
|
|
searchRef,
|
|
searchRef,
|
|
- searchClick,
|
|
|
|
- search,
|
|
|
|
- tradingSet,
|
|
|
|
- clearAlarm,
|
|
|
|
oprRef,
|
|
oprRef,
|
|
- tradingOprShow,
|
|
|
|
- showDateTime,
|
|
|
|
sys,
|
|
sys,
|
|
- viewPosiClk,
|
|
|
|
- replenishmentClk,
|
|
|
|
Format_calcuDecial,
|
|
Format_calcuDecial,
|
|
- operFinish,
|
|
|
|
- equipStatus,
|
|
|
|
- eqeStatusClk,
|
|
|
|
- editSleepDesc,
|
|
|
|
- sleepDescBoxShow,
|
|
|
|
- sleepDescChg,
|
|
|
|
- backTop,
|
|
|
|
user,
|
|
user,
|
|
labelList,
|
|
labelList,
|
|
- clickLabel,
|
|
|
|
- active,
|
|
|
|
- selectLabel,
|
|
|
|
countDownTime,
|
|
countDownTime,
|
|
- pushPageList,
|
|
|
|
- buyerList
|
|
|
|
|
|
+ buyerList,
|
|
|
|
+ sellerList,
|
|
|
|
+ pushPageList
|
|
};
|
|
};
|
|
},
|
|
},
|
|
};
|
|
};
|