| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <template>
- <view>
- <my-add-button
- @handleClick="addChange"
- :is-batch="true"
- :button-list="addButtonList"
- />
- <!-- <view class="border-bottom">
- <u-tabs
- class="p-fixed left0 right0 zIndex"
- :list="list"
- :name="'label'"
- :is-scroll="true"
- :current="current"
- @change="change"
- ></u-tabs>
- </view> -->
- <common-tabs :list="list" :current="current" @change="change" />
- <my-page
- :loadData="loadData"
- :swipe-action="true"
- :row-show-params="{
- statusValue: $DictCache.VALUE.SB_OIL_STATUS,
- statusMap: statusMap,
- statusColor: $DictCache.COLOR.SB_OIL_STATUS,
- }"
- @rowClick="handleDetail"
- :page-size="10"
- ref="myPage"
- >
- <template #pageRow="{ recordModel, rowShowParams }">
- <view
- class="mx3 my2 p3 bg-color-white box p-relative"
- @longpress="showMask(recordModel.id,$event)">
- <common-mask :item="recordModel" :maskId="maskId" @hide="maskId = 0" @del="handleDel(recordModel)" />
- <view class="d-flex j-between border-bottom pb-2 a-center">
- <view class="text-color-b f-size-26">{{
- recordModel.updateTime
- }}</view>
- <my-badge
- :text="rowShowParams.statusMap[recordModel.status]"
- :status="rowShowParams.statusColor[recordModel.status]"
- />
- </view>
- <view class="mt-2 d-flex j-between">
- <view class="text-color-3 f-size-32 f-weight-bold">{{
- recordModel.sbName
- }}</view>
- <view class="text-color-3 f-size-32 f-weight-bold">{{
- recordModel.storeName
- }}</view>
- </view>
- <view class="mt-2 d-flex j-between">
- <view class="f-size-26 text-color-6 f-weight-4 mt-2">
- {{ recordModel.sbNo }}
- </view>
- </view>
- <view class="d-flex j-end edit-box">
- <view
- class="text-color-3 f-size-32 edit"
- v-if="recordModel.status === rowShowParams.statusValue.OIL"
- >
- <view @click.stop="confirmHandle(recordModel)">确认</view>
- </view>
- </view>
- </view>
- </template>
- </my-page>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- statusMap: {},
- current: 0,
- maskId: 0,
- addButtonList: [
- {
- text: '扫码',
- index: 0
- },
- {
- text: '新增',
- index: 1
- }
- ]
- };
- },
- onPullDownRefresh() {
- this.$refs.myPage.pagePullDownRefresh();
- },
- onReachBottom() {
- this.$refs.myPage.pageReachBottom();
- },
- created() {
- const sbOilStatusList = this.$DictCache.getChildrenList(
- this.$DictCache.TYPE.SB_OIL_STATUS
- );
- const statusList = [{ label: '全部', value: '' }];
- sbOilStatusList.forEach((item) => {
- if (
- item.value !== this.$DictCache.VALUE.SB_OIL_STATUS.APPLY &&
- item.value !== this.$DictCache.VALUE.SB_OIL_STATUS.REJECT
- ) {
- statusList.push(item);
- }
- });
- this.list = statusList;
- this.statusMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.SB_OIL_STATUS
- );
- },
- onShow() {
- this.$nextTick(() => {
- this.$refs.myPage.initPage();
- });
- },
- onLoad() {},
- onHide() {
- this.maskId = 0
- },
- methods: {
- addChange(select) {
- const index = select.index
- if (index === 0) {
- uni.scanCode({
- success(e) {
- console.log(e.result);
- if (e.result) {
- uni.navigateTo({
- url: '/pages/oiling/my-oiling-add?sbId=' + e.result
- });
- }
- }
- });
- } else if (index === 1) {
- uni.navigateTo({
- url: '/pages/oiling/my-oiling-add'
- });
- } else if (index === 2) {
- this.$Http
- .copySbOils({})
- .then((res) => {
- this.$refs.myPage.pagePullDownRefresh();
- });
- } else if (index === 3) {
- uni.navigateTo({
- url: '/pages/oiling/batch-oiling-select'
- });
- }
- },
- showMask(id, e) {
- this.maskId = id
- // #ifdef H5
- e.preventDefault()
- // #endif
- },
- // tab
- change(index, e) {
- this.current = index;
- this.$refs.myPage.initPage();
- },
- // 删除
- handleDel(recordModel) {
- const that = this;
- const params = [];
- params.push(recordModel.id);
- uni.showModal({
- title: '提示',
- content: '您确认删除吗?',
- success: (res) => {
- if (res.confirm) {
- this.$Http.deleteSbOils(params).then((res) => {
- uni.showToast({ title: '删除成功' });
- that.$refs.myPage.listData = [];
- that.$refs.myPage.loadMore = true;
- that.$refs.myPage.pageNum = 1;
- that.$refs.myPage.initData();
- });
- } else if (res.cancel) {
- }
- }
- });
- },
- loadData(parameter) {
- return this.$Http
- .getSbOilPage({
- ...parameter,
- filter: 1,
- status: this.list[this.current].value
- })
- .then((res) => {
- return res.data;
- });
- },
- confirmHandle(recordModel) {
- uni.navigateTo({
- url: '/pages/oiling/my-oiling-detail?confirm=1&id=' + recordModel.id
- });
- },
- // 详情
- handleDetail(recordModel) {
- if (this.maskId !== 0) {
- this.maskId = 0
- return
- }
- uni.navigateTo({
- url: '/pages/oiling/my-oiling-detail?id=' + recordModel.id
- });
- }
- }
- };
- </script>
- <style lang="less">
- .main {
- .box {
- border-radius: unit(20, rpx);
- padding-right: 0;
- }
- }
- page {
- background-color: #f4f4f4;
- }
- .edit-box {
- padding: 0 30rpx;
- margin-top: 40rpx;
- .edit {
- padding: 8rpx 40rpx;
- border: 1px solid #ddd;
- border-radius: 20rpx;
- font-size: 26rpx;
- color: #666;
- margin-left: 30rpx;
- }
- }
- </style>
|