123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687 |
- <template>
- <view v-if="is_submitaudit!=1" class="container">
- <form>
- <view class="tui-box">
- <tui-list-cell @click="choosecatid" :arrow="true" unlined>
- <view class="tui-item-box">
- <text class="tui-list-cell_name">需求分类</text>
- <view class="tui-right">{{cat_name || '请先选择分类'}}</view>
- </view>
- </tui-list-cell>
- <tui-list-cell :hover="false" :lineLeft="false" padding="0">
- <view class="tui-remark-box tui-padding tui-flex">
- <view>您的要求</view>
- <input type="text" @input="remarkInput" name="remark" class="tui-remark" placeholder="请输入您的要求"
- placeholder-class="tui-phcolor"></input>
- </view>
- </tui-list-cell>
- <tui-list-cell :hover="false" :lineLeft="false" padding="0">
- <view class="tui-remark-box tui-padding tui-flex">
- <view>期望价格</view>
- <input type="text" v-model="total" name="remark" class="tui-remark" placeholder="请输入您的期望价格"
- placeholder-class="tui-phcolor">元</input>
- </view>
- </tui-list-cell>
- <tui-list-cell :arrow="true" unlined :radius="true" @click="chooseAddr">
- <view class="tui-address">
- <label class="serviceaddr">服务地址</label>
- <view v-if="curAddressData.address">
- <view class="tui-userinfo">
- <text class="tui-name">{{curAddressData.name}}</text>{{curAddressData.telephone}}
- </view>
- <view class="tui-addr">
- <text>{{curAddressData.address_default}}{{curAddressData.address}}</text>
- </view>
- </view>
- <view class="tui-none-addr" v-else>
- <image src="/static/images/location_fill.png" class="tui-addr-img" mode="widthFix"></image>
- <text>请选择地址</text>
- </view>
- </view>
- </tui-list-cell>
- <tui-list-cell v-if="(deliverymode==1 || deliverymode==4) && is_times==0" :arrow="true" unlined
- :radius="true" @click="chooseTime">
- <view class="tui-address">
- <view v-if="servicetime">
- <view class="tui-addr">
- <text>期望上门时间:{{servicetime}}</text>
- </view>
- </view>
- <view class="tui-none-addr" v-else>
- <text>请选择期望服务时间</text>
- </view>
- </view>
- </tui-list-cell>
- <tui-list-cell :hover="false">
- <view class="tui-img__title">添加图片</view>
- <view>
- <tui-upload :value="imgvalue" :limit="5" @complete="uploadresult" @remove="remove"></tui-upload>
- </view>
- </tui-list-cell>
- </view>
- <view class="tui-safe-area"></view>
- <view class="tui-tabbar">
- <view class="tui-flex-end tui-color-red tui-pr-20">
- <view class="tui-black">应付金额: </view>
- <view class="tui-size-26">¥</view>
- <view class="tui-price-large">{{total}}</view>
- <!--<view class="tui-size-26"></view>-->
- </view>
- <view class="tui-pr25 tui-flex-end">
- <button class="paybutt" @click="btnPay" :style="'background:'+ pagestyleconfig.appstylecolor">确认提交</button>
- </view>
-
- </view>
- <t-pay-way :show="show" :stylecolor="pagestyleconfig.appstylecolor" :amuont="total" @goPay="goPay" :paymethod="paymethod" @close="popupClose">
- </t-pay-way>
- </form>
- </view>
- </template>
- <script>
- import tPayWay from "@/components/views/t-pay-way/t-pay-way"
- import pay from '@/common/pay.js'
- export default {
- components: {
- tPayWay
- },
- data() {
- return {
- technicalId: '',
- is_submitaudit: 1,
- pagestyleconfig: [],
- show: false,
- islogin: 1, //是否要需要登录,需要在onLoad加截 app.page.onLoad(this,e);
- servicetime: '',
- cat_id: '',
- cat_name: '',
- curAddressData: [],
- total: 0,
- remark: "",
- orderType: "", //订单类型,购物车下单或立即支付下单,默认是购物车,
- selIndex: 0,
- payment: '0', //是否支持货到付款
- chargeset: '0', //是否开启服务费
- paymentType: "",
- deliverymode: '1',
- is_times: 0,
- ptype: 2,
- service: 0,
- paymethod: {},
- orderimage: [],
- imgvalue: [] //初始化图片
- }
- },
- onLoad: function(e) {
- let _this = this
-
- uni.setStorageSync('gotopage', '/pagesA/submitOrder/demandOrder');
- this.sam.checktelephone().then(res => {
- });
- _this.$request.post('config', {
- mo: 'pagestyle'
- }).then(res => {
- if (res.errno == 0) {
- _this.pagestyleconfig = res.data
- }
- });
-
- if (e.orderType) {
- _this.orderType = e.orderType;
- }
- _this.$request.get('Paymethod.list').then(res => {
- if (res.errno == 0) {
- _this.paymethod = res.data;
- _this.paymentType = res.data[0].default;
- //console.log(_this.paymentType);
- }
- })
- },
- onShow: function() {
- let _this = this
- _this.$request.post('Config.audit', {
- samkey: (new Date()).valueOf()
- }).then(res => {
- _this.is_submitaudit = res.data.is_submitaudit;
- });
- _this.servicetime = uni.getStorageSync('servicetime');
- _this.cat_id = uni.getStorageSync('cat_id');
- _this.cat_name = uni.getStorageSync('cat_name');
- _this.initShippingAddress();
- },
- methods: {
- uploadresult: function(e) {
- console.log(e)
- this.orderimage = e.imgArr;
- },
- remove: function(e) {
- //移除图片
- console.log(e)
- let index = e.index
- },
- chooseAddr() {
- uni.navigateTo({
- url: "/pagesA/my/address/address"
- })
- },
- chooseTime() {
- uni.navigateTo({
- url: "/pagesA/submitOrder/timelist"
- })
- },
- choosecatid() {
- uni.navigateTo({
- url: "/pagesA/submitOrder/cat"
- })
- },
- btnPay() {
- if (this.total == 0) {
- this.createOrder();
- } else {
- this.show = true
- }
- },
- popupClose() {
- this.show = false
- },
- goPay(e) {
- if (e.paymentType) {
- this.paymentType = e.paymentType;
- }
- this.createOrder();
- },
- createOrder: function() {
- var _this = this;
- if (_this.remark == undefined) {
- _this.remark = '';
- }
-
- if (!_this.cat_id) {
- uni.hideLoading();
- uni.showModal({
- title: '错误',
- content: '请选择需求分类!',
- showCancel: false
- })
- return;
- }
- if (_this.paymentType == 0) {
- uni.hideLoading();
- uni.showModal({
- title: '错误',
- content: '请选择支付方式!',
- showCancel: false
- })
- return;
- }
- let postData = {
- technicalId: _this.technicalId,
- cat_id: _this.cat_id,
- otype: 1,
- remark: _this.remark,
- total: _this.total,
- paymentType: _this.paymentType,
- orderimage: _this.orderimage
- };
- postData.payment = postData.paymentType;
- postData.is_times = _this.is_times;
- if (_this.deliverymode == 1) {
- if (_this.is_times == 0) {
- if (!_this.servicetime) {
- uni.hideLoading();
- uni.showModal({
- title: '错误',
- content: '请选择期望上门时间!',
- showCancel: false
- })
- return;
- }
- postData.servicetime = _this.servicetime;
- }
- postData.address_id = _this.curAddressData.id;
- _this.ptype = 2;
- }
- _this.$request.post('order.create', postData).then(res => {
- if (res.errno != 0) {
- uni.showModal({
- title: '错误',
- content: res.msg,
- showCancel: false
- })
- return;
- }
- const redirectUrl = "/pagesA/submitOrder/success?ptype=" + _this.ptype;
- if (res.data.payment_code == 'wx_pay') {
- pay.wxpay('order', res.data.pay_total, res.data.id, redirectUrl);
- } else if (res.data.payment_code == 'balance_pay') {
- _this.$request.post('order.pay', {
- orderid: res.data.id
- }).then(res => {
- if (res.errno == 0) {
- wx.showModal({
- title: '成功',
- content: '使用余额支付成功',
- showCancel: false,
- success: function(res) {
- wx.redirectTo({
- url: redirectUrl
- });
- }
- })
- } else {
- wx.showModal({
- title: '失败',
- content: res.msg,
- showCancel: false
- })
- }
- })
- } else if (res.data.payment_code == 'offline_pay') {
- _this.sam.navigateTo('/pagesA/submitOrder/offlinepayment?id=' + res.data.id);
- } else if (res.data.payment_code == 'delivery_pay') {
- _this.sam.navigateTo(redirectUrl);
- } else {
- _this.sam.navigateTo(redirectUrl);
- }
- })
- },
- initShippingAddress: function() {
- var _this = this;
- _this.$request.get('address.default', {
- samkey: (new Date()).valueOf()
- }).then(res => {
- if (res.errno == 0) {
- _this.curAddressData = res.data;
- } else {
- _this.curAddressData = null;
- }
- })
- },
- remarkInput: function(e) {
- this.remark = e.target.value;
- },
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- setTimeout(() => {
- uni.stopPullDownRefresh()
- }, 200);
- },
- }
- </script>
- <style>
- .container {
- padding-bottom: 98rpx;
- }
- .tui-item-box {
- width: 100%;
- display: flex;
- align-items: center;
- }
- .tui-list-cell_name {
- padding-left: 5rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .tui-right {
- margin-left: auto;
- margin-right: 34rpx;
- font-size: 26rpx;
- color: #999;
- }
- .tui-box {
- padding: 20rpx 0 118rpx;
- box-sizing: border-box;
- }
- .tui-address {
- min-height: 80rpx;
- padding: 10rpx 0;
- box-sizing: border-box;
- position: relative;
- }
- .serviceaddr {
- color: #999999;
- }
- .tui-userinfo {
- font-size: 30rpx;
- font-weight: 500;
- line-height: 30rpx;
- padding-top: 10rpx;
- padding-bottom: 12rpx;
- }
- .tui-name {
- padding-right: 40rpx;
- }
- .tui-addr {
- font-size: 24rpx;
- word-break: break-all;
- padding-right: 25rpx;
- }
- .tui-addr-tag {
- padding: 5rpx 8rpx;
- flex-shrink: 0;
- background: #EB0909;
- color: #fff;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- font-size: 25rpx;
- line-height: 25rpx;
- transform: scale(0.8);
- transform-origin: 0 center;
- border-radius: 6rpx;
- }
- .tui-top {
- margin-top: 20rpx;
- overflow: hidden;
- }
- .tui-goods-title {
- font-size: 28rpx;
- display: flex;
- align-items: center;
- }
- .tui-padding {
- box-sizing: border-box;
- }
- .tui-goods-item {
- width: 100%;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- }
- .tui-goods-img {
- width: 180rpx;
- height: 180rpx;
- display: block;
- flex-shrink: 0;
- }
- .tui-goods-center {
- flex: 1;
- padding: 20rpx 8rpx;
- box-sizing: border-box;
- }
- .tui-goods-name {
- max-width: 310rpx;
- word-break: break-all;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- font-size: 26rpx;
- line-height: 32rpx;
- }
- .tui-goods-attr {
- font-size: 22rpx;
- color: #888888;
- line-height: 32rpx;
- padding-top: 20rpx;
- word-break: break-all;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .tui-price-right {
- text-align: right;
- font-size: 24rpx;
- color: #888888;
- line-height: 30rpx;
- padding-top: 20rpx;
- }
- .tui-flex {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 26rpx;
- }
- .tui-total-flex {
- justify-content: flex-end;
- }
- .tui-color-red {
- color: #E41F19;
- padding-right: 30rpx;
- }
- .tui-balance {
- font-size: 28rpx;
- font-weight: 500;
- }
- .tui-black {
- color: #222;
- line-height: 30rpx;
- }
- .tui-gray {
- color: #888888;
- font-weight: 400;
- }
- .tui-light-dark {
- color: #666;
- }
- .tui-goods-price {
- display: flex;
- align-items: center;
- padding-top: 20rpx;
- }
- .tui-size-26 {
- font-size: 26rpx;
- line-height: 26rpx;
- }
- .tui-price-large {
- font-size: 34rpx;
- line-height: 32rpx;
- font-weight: 600;
- }
- .tui-flex-end {
- display: flex;
- align-items: flex-end;
- padding-right: 0;
- }
- .tui-phcolor {
- color: #B3B3B3;
- font-size: 26rpx;
- }
- /* #ifndef H5 */
- .tui-remark-box {
- padding: 22rpx 30rpx;
- }
- /* #endif */
- /* #ifdef H5 */
- .tui-remark-box {
- padding: 26rpx 30rpx;
- }
- /* #endif */
- .tui-remark {
- flex: 1;
- font-size: 26rpx;
- padding-left: 64rpx;
- }
- .tui-scale-small {
- transform: scale(0.8);
- transform-origin: 100% center;
- }
- .tui-scale-small .wx-switch-input {
- margin: 0 !important;
- }
- /* #ifdef H5 */
- >>>uni-switch .uni-switch-input {
- margin-right: 0 !important;
- }
- /* #endif */
- .tui-tabbar {
- width: 100%;
- height: 98rpx;
- background: #fff;
- position: fixed;
- left: 0;
- bottom: 0;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- font-size: 26rpx;
- box-shadow: 0 0 1px rgba(0, 0, 0, .3);
- padding-bottom: env(safe-area-inset-bottom);
- z-index: 996;
- }
- .tui-pr-30 {
- padding-right: 30rpx;
- }
- .tui-pr-20 {
- padding-right: 20rpx;
- }
- .tui-none-addr {
- height: 80rpx;
- padding-left: 5rpx;
- display: flex;
- align-items: center;
- }
- .tui-addr-img {
- width: 36rpx;
- height: 46rpx;
- display: block;
- margin-right: 15rpx;
- }
- .tui-pr25 {
- padding-right: 25rpx;
- }
-
- .paybutt {
- width: 380rpx;
- height: 70rpx;
- line-height: 70rpx;
- font-size: 28rpx;
- border-radius: 50rpx;
- color: #ffffff;
- align-items: center;
- }
- .tui-safe-area {
- height: 1rpx;
- padding-bottom: env(safe-area-inset-bottom);
- }
- .tui-pay-item__title {
- width: 100%;
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 20rpx;
- box-sizing: border-box;
- font-size: 28rpx;
- }
- .tui-pay-amuont {
- color: #eb0909;
- font-weight: 500;
- font-size: 34rpx;
- }
- .tui-pay-item {
- width: 100%;
- height: 80rpx;
- display: flex;
- align-items: center;
- padding: 0 20rpx;
- box-sizing: border-box;
- font-size: 28rpx;
- }
- .tui-pay-logo {
- width: 48rpx;
- height: 48rpx;
- margin-right: 15rpx;
- }
- .tui-radio {
- margin-left: auto;
- transform: scale(0.8);
- transform-origin: 100% center;
- }
- .tui-btn-pay {
- width: 100%;
- padding: 68rpx 60rpx 50rpx;
- box-sizing: border-box;
- }
- .tui-recharge {
- color: #fc872d;
- margin-left: auto;
- padding: 12rpx 0;
- }
- .acea-row {
- font-size: 28rpx;
- padding-top: 30rpx;
- padding-left: 20rpx;
- height: 60rpx;
- background-color: #fff;
- }
- .acea-row label {
- padding: 10rpx;
- }
- .tui-img__title {
- padding-bottom: 24rpx;
- }
-
- </style>
|