0.3.9 • Published 2 years ago

iov-petrochina v0.3.9

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

智能小程序中石油页面模板

Introduction:

为了方便开发者组件开发,提供一个可用于开发、调试的模板

Quick Start

安装依赖: npm i iov-petrochina

使用示例

getPerm 授权信息

授权信息

属性说明:

属性名类型默认值必填说明
retryfunction重试按钮的函数

示例

json

{
    "navigationBarTitleText": "",
    "usingComponents": {
        "getperm": "iov-petrochina/lib/getPerm"
    }
}

swan

<getperm bindretry="retry" />

js

Page({
    retry: function (e) {
        console.log('重试');
    }
});

verify 发送验证码

发送验证码

属性说明:

属性名类型默认值必填说明
imgUrlString图片的 Url
logUrlString登录跳转的 Url
phoneNumString手机号码
correctCodeString获取到的验证码
bindgetcodefunction获取验证码的事件函数
bindloginfunction登录的事件函数
msgString验证码错误的提示信息

示例

json

{
    "usingComponents": {
        "verify": "iov-petrochina/lib/verify"
    }
}

swan

<verify
    imgUrl="https://img.yzcdn.cn/vant/cat.jpeg"
    logUrl="../oilStation/index"
    phoneNum="13987654321"
    correctCode="1234"
    bindlogin="login"
    bindgetcode="getcode"
/>

js

Page({
    data: {},
    login: function (e) {
        console.log('登录函数');
    },
    getcode: function (e) {
        console.log('获取验证码函数');
    }
});

oilStation 油站列表

油站列表

属性说明:

属性名类型默认值必填说明
linkUrlString跳转页面的 Url
listArray油站列表
list.distanceString距离
list.addressString油站地址
list.posYString油站纬度
list.posXString油站经度
list.stationNameString油站名
list.oliStationCodeString油站编号
list.oilPriceNumber油站价格
list.oilNoString油号
bindselectedfunction选择油站的事件函数
bindclickNavifunction导航去油站的事件函数

示例

json

{
    "usingComponents": {
        "oilstation": "iov-petrochina/lib/oilStation"
    }
}

swan

<oilstation linkUrl="../detail/index" list="{{oilList}}" bindclickNavi="navigation" bindselected="selected" />

js

Page({
    selected: function (e) {
        console.log('选择油站函数,已选择: ');
        console.log(e);
    },
    navigation: function (e) {
        console.log('触发导航事件');
        console.log('油站信息', e);
    },
    data: {
        oilList: [
            {
                address: '湖南省长沙县黄兴镇035县道',
                beginDate: null,
                beginTime: null,
                cityCode: '102',
                cityCompany: '湖南长沙销售分公司',
                cityName: null,
                closingTime: '23:00:00',
                creationTime: '2019-08-23T02:25:15.000+0000',
                distance: '0.34',
                endDate: null,
                endTime: null,
                founder: null,
                id: null,
                isCaChe: true,
                isCardpay: null,
                isFood: true,
                isFreeBoiledWater: true,
                isFreeWater: true,
                isSelfHelp: true,
                isWC: true,
                isWeixiuJiJiu: true,
                landmark: null,
                lastChangeTime: null,
                localName: '仙人加油站',
                manage: null,
                managerName: '段益',
                managerPhone: '13787107002',
                modifier: null,
                nature: null,
                oilNo: null,
                oilPrice: null,
                oliStationCode: '1A2J',
                openingTime: '6:00:00',
                otherServices: null,
                posX: 116.410125,
                posY: 39.891903,
                provinceCode: '1000',
                provinceCompany: '中国石油湖南销售分公司',
                provinceName: null,
                rechargeStation: true,
                roundBBQ: null,
                roundBank: null,
                roundJingDian: null,
                roundStayRoom: null,
                stationName: '湖南长沙仙人加油站',
                stationPhone: null,
                status: 2,
                telePhone: '13787107002',
                tollStation: null,
                type: null
            }
        ]
    }
});

detail 选择油枪号

选择油枪号

属性说明:

属性名类型默认值必填说明
backUrlString重选油站的 Url
linkUrlString跳转页面的 Url
gasNameString油站名
distanceString油站距离
gasAddressString油站地址
gasIndexNumber所选油枪的下标
gasListArray油枪号列表
bindselectedfunction选择油枪号的事件函数
bindbackfunction重选油站的事件函数
bindinputfunction输入时的事件函数
bindfocusfunction获取焦点时的事件函数
bindblurfunction失去焦点时的事件函数
bindconfirmfunction点击完成按钮时的事件函数

示例:

json

{
    "usingComponents": {
        "detail": "iov-petrochina/lib/detail"
    }
}

swan

<detail
    backUrl="../pageList/index"
    linkUrl="../selectOrder/index"
    gasName="广州市黄浦区加油站(黄埔南路向西786加油站…黄埔南…"
    distance="100m"
    gasAddress="南山区登良路25-1南山区登良路25-1南山区登良路25-1南山区登良..."
    gasList="{{list}}"
    bindselected="selected"
    bindback="back"
    bindinput="input"
    bindfocus="focus"
    bindblur="blur"
    bindconfirm="confirm"
/>

js

Page({
    selected: function (e) {
        console.log(`选择油枪号函数,已选择: 第 ${e.currentTarget.dataset.value + 1} 个`);
        console.log(e.currentTarget.dataset.info);
    },
    back: function (e) {
        console.log(`重选油站函数`);
    },
    input: function (e) {
        console.log(`监听输入事件`);
    },
    focus: function (e) {
        console.log(`监听获取焦点事件`);
    },
    blur: function (e) {
        console.log(`监听失去焦点事件`);
    },
    confirm: function (e) {
        console.log(`监听点击完成按钮事件`);
    },
    data: {}
});

selectOrder 选择订单

选择订单

属性说明:

属性名类型默认值必填说明
linkUrlString跳转页面的 Url
gasNameString油站名
distanceString油站距离
gasAddressString油站地址
gasAddressLatitudeString油站纬度
gasAddressLongitudeString油站经度
gasArray油枪号列表
gasi.oilNameString已选油号
gasi.gunIndexString已选油枪号
gasIndexNumber所选油枪号下标
amountListArray[]价格列表
amountIndexNumber所选价格下标
failedToLoadBooleanfalse订单是否获取失败
bindselectedfunction选择订单号的事件函数
bindbackfunction重选油站的事件函数
bindretryfunction'再试一次'的事件函数

示例:

json

{
    "usingComponents": {
        "selectorder": "iov-petrochina/lib/selectOrder"
    }
}

swan

<selectorder
    backUrl="../pageList/index"
    linkUrl="../detailOrder/index"
    gasName="广州市黄浦区加油站(黄埔南路向西786加油站…黄埔南…"
    distance="100m"
    gasAddress="南山区登良路25-1南山区登良路25-1南山区登良路25-1南山区登良..."
    amountList="{{amountList}}"
    gas="{{gasData}}"
    gasIndex="{{gasIndex}}"
    bindback="back"
    bindselected="selected"
    bindretry="retry"
    failedToLoad="{{false}}"
/>

js

Page({
    back: function (e) {
        console.log('重选油站事件函数');
    },
    retry: function (e) {
        console.log('"再试一次"事件函数');
    },
    selected: function (e) {
        console.log(`选择订单函数,已选择: 第 ${e.currentTarget.dataset.value + 1} 个`);
        console.log(e.currentTarget.dataset.info);
    },
    data: {
        gasIndex: 0,
        gasData: [
            {
                oilName: '92#',
                gunIndex: 1
            }
        ],
        amountList: [
            {
                liter: 2.3,
                price: 13.26,
                data: {}
            },
            {
                liter: 5.77,
                price: 4.42,
                data: {}
            },
            {
                liter: 2.7,
                price: 1.53,
                data: {}
            },
            {
                liter: 5.7,
                price: 4.42,
                data: {}
            },
            {
                liter: 2.4,
                price: 13.23,
                data: {}
            },
            {
                liter: 0.56,
                price: 3.4,
                data: {}
            }
        ]
    }
});

detailOrder 确认下单

确认下单

属性说明:

属性名类型默认值必填说明
backUrlString重选油站页面的 Url
couponsUrlString优惠券页面的 Url
linkUrlString支付跳转的 Url
gasNameString油站名
distanceString油站距离
gasAddressString油站地址
gasAddressLatitudeString油站纬度
gasAddressLongitudeString油站经度
gasArray油枪号列表
gasIndexNumber所选油枪号下标
totalAmountNumber价格
coupCanOrderListArray[]优惠券列表
coupCanOrderIndexNumber[]所选优惠下标
coupSelectBooleanfalse是否选择优惠券
showModalBooleanfalse是否显示弹出框
bindbackfunction重选油站的事件函数
bindpayfunction支付按钮的事件函数
bindcouponsfunction优惠券的事件函数
bindcheckedfunction弹出框的事件函数

示例:

json

{
    "usingComponents": {
        "detail-order": "iov-petrochina/lib/detailOrder"
    }
}

swan

<detail-order
    couponsUrl="../selectCoupons/index"
    backUrl="../oilStation/index"
    linkUrl="../alipay/index"
    gasName="广州市黄浦区加油站(黄埔南路向西786加油站…黄埔南…"
    distance="100m"
    gasAddress="南山区登良路25-1南山区登良路25-1南山区登良路25-1南山区登良..."
    gas="{{gasData}}"
    gasIndex="{{gasIndex}}"
    totalAmount="{{price}}"
    coupCanOrderList="{{coupCanOrderList}}"
    coupCanOrderIndex="{{coupCanOrderIndex}}"
    coupSelect="{{true}}"
    showModal="{{showModal}}"
    bindchecked="checked"
    bindcoupons="coupons"
    bindback="back"
    bindpay="pay"
/>

js

Page({
    pay: function (e) {
        console.log('支付按钮的函数');
    },
    back: function (e) {
        console.log('重选油站的函数');
    },
    coupons: function (e) {
        console.log('选择优惠券列表的函数');
    },
    checked: function (e) {
        console.log('确认');
        this.setData({
            showModal: false
        });
    },
    data: {
        price: '300',
        gasIndex: 0,
        sumText: '300',
        showModal: false,
        gasData: [
            {
                oilName: '92#',
                gunIndex: 1
            },
            {
                oilName: '95#',
                gunIndex: 2
            },
            {
                oilName: '97#',
                gunIndex: 3
            }
        ],
        coupCanOrderIndex: 0,
        coupCanOrderList: [
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            }
        ]
    }
});

selectCoupons 选择优惠券

选择优惠券

属性说明:

属性名类型默认值必填说明
linkUrlString跳转页面的 Url
coupCanOrderListArray优惠券列表
bindconfirmfunction确认选择按钮的事件函数
isCheckedObject默认选择的优惠券
isChecked.indexNumber默认选择的优惠券下标
isChecked.dataObject默认选择的优惠券信息

示例:

json

{
    "usingComponents": {
        "select-coupons": "iov-petrochina/lib/selectCoupons"
    }
}

swan

<select-coupons coupCanOrderList="{{list}}" linkUrl="{{url}}" bindconfirm="confirm" />

js

Page({
    confirm: function (e) {
        console.log(`选择优惠券函数,已选择:`);
        console.log(e.detail.index, e.detail.data);
    },
    data: {
        url: '../detailOrder/index',
        checkedCoup: {
            index: 2,
            data: {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            }
        },
        list: [
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '油品无限制条件',
                coupMoney: 50,
                condMoney: 300,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '油品无限制条件',
                coupMoney: 50,
                condMoney: 300,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '油品无限制条件',
                coupMoney: 50,
                condMoney: 300,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '油品无限制条件',
                coupMoney: 50,
                condMoney: 300,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '广州支付宝油品',
                coupMoney: 20,
                condMoney: 200,
                expireEnd: '2022-01-01'
            },
            {
                coupId: '油品无限制条件',
                coupMoney: 50,
                condMoney: 300,
                expireEnd: '2022-01-01'
            }
        ]
    }
});

qrCode 二维码页面

免密支付

属性说明:

属性名类型默认值必填说明
codeMsgString二维码提示的信息
statusString二维码图片状态
codeUrlObject二维码图片 Url
codeUrl.successUrlString获取成功时的 Url
codeUrl.loadingUrlString正在加载时的 Url
codeUrl.failedUrlString获取失败时的 Url

示例

json

{
    "navigationBarTitleText": "开通免密支付",
    "usingComponents": {
        "qrcode": "iov-petrochina/lib/qrCode"
    }
}

swan

<qrcode codeMsg="{{msg}}" codeUrl="{{url}}" status="2" />

js

Page({
    data: {
        msg: '手机 “支付宝” APP 扫码关联',
        url: {
            successUrl: 'https://img.yzcdn.cn/vant/cat.jpeg',
            loadingUrl: '',
            failed: ''
        }
    }
});

orderDetail 订单详情

订单详情

属性说明:

属性名类型默认值必填说明
qrCodeUrlString二维码 Url
spOrderNumString订单号
totalPriceNumber合计价格
phoneNumberString人工客服电话
detailObject{}订单信息
detail.gasNameString加油站名称
detail.oilStrString油号信息
detail.oilGunNumString油枪号
detail.payTypeString支付方式
detail.createTimeString创建时间
detail.coupMoneyString优惠券
detail.statusObject{}支付状态
detail.status.typeString支付状态图标
detail.status.strString支付状态文本
bindcheckedfunction弹出框的事件函数
showCouponsBooleanfalse是否展示优惠券弹出框
titleMsgString弹出框显示的标题
mainMsgString弹出框显示的信息
btnMsgString弹出框按钮的文本
countDownBooleanfalse弹出框是否有倒计时
secondNumber弹出框倒计时的秒数

示例:

json

{
    "usingComponents": {
        "order": "iov-petrochina/lib/orderDetail"
    }
}

swan

<order
    qrCodeUrl=""
    cardMsg="【退款】【开发票】请下载中油好客e站App"
    spOrderNum="{{orderNum}}"
    detail="{{detail}}"
    phoneNumber="13987654321"
    totalPrice="300"
    bindchecked="checked"
    showCoupons="{{showCoupons}}"
    titleMsg="恭喜你,获得一张优惠券!"
    mainMsg="优惠券可在【中油好客e站】App上查看"
    btnMsg="完成"
    countDown="true,"
    second="5"
/>

js

Page({
    checked: function (e) {
        console.log('确认');
        this.setData({
            showCoupons: false
        });
    },
    data: {
        showCoupons: false,
        orderNum: '00000001',
        detail: {
            status: {
                type: 'success', // success | loading | failed
                str: '支付成功'
            },
            oilStr: '92# 汽油',
            oilGunNum: '1',
            payType: '支付宝支付',
            createTime: '2021.12.09 11:24:05',
            coupMoney: '优惠券'
        }
    }
});

modal 弹出框组件

弹出框

属性说明:

属性名类型默认值必填说明
titleMsgString显示的标题
mainMsgString显示信息
btnMsgString按钮的文本
isShowBooleanfalse是否展示弹出框
countDownBooleanfalse弹出框是否有倒计时
secondNumber弹出框倒计时的秒数
bindcheckedfunction按钮点击事件函数

示例

json

{
    "navigationBarTitleText": "",
    "usingComponents": {
        "modal": "iov-petrochina/lib/modal"
    }
}

swan

<modal
    titleMsg="{{titleMsg}}"
    mainMsg="{{mainMsg}}"
    btnMsg="{{btnMsg}}"
    bindchecked="checked"
    isShow="{{show}}"
    countDown="{{countDown}}"
    second="{{second}}"
/>

js

Page({
    data: {
        titleMsg: '恭喜你,获得一张优惠券!',
        mainMsg: '优惠券可在【中油好客e站】App上查看',
        btnMsg: '完成',
        show: true,
        countDown: true,
        second: 5
    },
    checked: function (e) {
        console.log('确认');
        this.setData({
            show: false
        });
    }
});
0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.9

2 years ago

0.3.0

2 years ago

0.2.7

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago