123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <view class="content">
- <view class="itemDetail">
- <view class="typeName clamp2" :class="{wargin:type==2,base:type==1}">
- {{actionCart.title}}
- </view>
- <view class="detail">
- {{actionCart.add_time}}
- </view>
- <view class="contentDetail detail-desc">
- <rich-text class="detail-centent" :nodes="actionCart.content"></rich-text>
- </view>
- </view>
- <view class="mapBox" v-if="type==2">
- <map :enable-zoom='false' :enable-scroll='false' @click="openMap(actionCart.latitude,actionCart.longitude)"
- class="map" :latitude="actionCart.latitude" :longitude="actionCart.longitude" :markers="[{
- latitude:actionCart.latitude,
- longitude:actionCart.longitude,
- iconPath: '../../static/image/location.png',
- heighe:35,
- width:35
- }]"></map>
- <view class="mapBottom flex">
- <view>
- <image src="../../static/icon/gpsW.png" mode="widthFix"></image>
- </view>
- <view class="clamp">
- {{actionCart.title}}
- </view>
- </view>
- <!-- <view class="mapTip flex">
- <view class="leftMapTip flex" :class="{success:actionCart.xh,error:!actionCart.xh}">
- <image class="topTip" src="../../static/icon/mpXh.png" mode="widthFix"></image>
- </view>
- <view class="leftMapTip flex" :class="{success:actionCart.gps,error:!actionCart.gps}">
- <image class="topTip" src="../../static/icon/mpGps.png" mode="widthFix"></image>
- </view>
- </view> -->
- </view>
- <!-- <view class="base-buttom" v-if="type==1">
- </view> -->
- </view>
- </template>
- <script>
- import {
- share
- } from '@/api/wx';
- import {
- mapState,
- } from 'vuex';
- import {
- details,
- } from '@/api/index.js';
- export default {
- data() {
- return {
- id: '', //保存信息id
- type: 0, //2为警报1为非警报
- actionCart: {},
- };
- },
- onLoad(options) {
- const that = this;
- that.id = options.id;
- that.type = options.type;
- if(+options.type==2){
- // #ifdef APP-NVUE
- const eventChannel = that.$scope.eventChannel; // 兼容APP-NVUE
- // #endif
- // #ifndef APP-NVUE
- const eventChannel = that.getOpenerEventChannel();
- // #endif
- // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
- eventChannel.on('addPushData', function(data) {
- that.actionCart = data;
- that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
- })
- }
- if(+options.type==1){
- that.loadData();
- }
- if(+options.type==3){
- that.loadData();
- }
- that.share()
- },
- // #ifdef MP
- onShareAppMessage(options) {
- // 设置菜单中的转发按钮触发转发事件时的转发内容
- let pages = getCurrentPages(); //获取加载的页面
- let currentPage = pages[pages.length - 1]; //获取当前页面的对象
- let url = currentPage.route; //当前页面url
- let item = currentPage.options; //如果要获取url中所带的参数可以查看options
- let shareObj = {
- title: this.shareData.title, // 默认是小程序的名称(可以写slogan等)
- path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: this.shareData.img,
- desc:this.shareData.synopsis,
- success: function(res) {
- // 转发成功之后的回调
- if (res.errMsg == 'shareAppMessage:ok') {}
- },
- fail: function() {
- // 转发失败之后的回调
- if (res.errMsg == 'shareAppMessage:fail cancel') {
- // 用户取消转发
- } else if (res.errMsg == 'shareAppMessage:fail') {
- // 转发失败,其中 detail message 为详细失败信息
- }
- }
- };
- // 判断是否可以邀请
- if (this.userInfo) {
- shareObj.path += '&spread=' + this.userInfo.uid;
- }
- return shareObj;
- },
- // #endif
- methods: {
- share() {
- console.log('加载分享');
- const that = this;
- // 请求获取默认数据
- share({}).then(({
- data
- }) => {
- console.log('分享回调', data);
- that.shareData = data.data
- });
- },
- // 打开地图导航
- openMap(lat, long) {
- uni.openLocation({
- latitude: lat,
- longitude: long,
- })
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- })
- },
- // 转换金额为数字
- moneyNum(value) {
- return +value;
- },
- // 确认收货
- //获取订单列表
- loadData() {
- const that = this;
- details({},this.id)
- .then(({
- data
- }) => {
- this.actionCart = data;
- that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
- uni.setNavigationBarTitle({
- title:data.title
- })
- })
- .catch(e => {
-
- });
- }
- }
- };
- </script>
- <style lang="scss">
- /deep/ .iconenter {
- font-size: $font-base + 2rpx;
- color: #888;
- }
-
- /deep/ .con_image {
- width: 130rpx;
- height: 130rpx;
- display: inline-block;
- padding: 15rpx;
-
- image {
- width: 100%;
- height: 100%;
- }
- }
-
- /* 商品详情中限制图片大小 */
- /deep/ .rich-img {
- width: 100% !important;
- height: auto;
- }
- .detail-desc {
- background: #fff;
- /deep/ img {
- max-width: 100% !important;
- display: inline !important;
- }
- /deep/ div {
- max-width: 100% !important;
- }
- }
- page,
- .content {
- background: $page-color-base;
- height: 100%;
- }
- // .content {
- // padding-top: 30rpx;
- // }
- .base-buttom {
- position: relative;
- bottom: auto;
- right: auto;
- left: auto;
- }
- .itemDetail {
- margin-bottom: 30rpx;
- padding: 50rpx;
- padding-top: 44px;
- background-color: #FFFFFF;
- .base {
- color: $font-color-base;
- }
- .wargin {
- color: $color-red;
- }
- .typeName {
- font-size: 36rpx;
- }
- .detail {
- margin-top: 10rpx;
- font-size: 24rpx;
- color: $font-color-light;
- }
- .contentDetail {
- margin-top: 40rpx;
- font-size: 28rpx;
- color: $font-color-light;
- }
- }
- .mapBox {
- position: relative;
- .mapBottom {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- padding: 15rpx;
- font-size: 24rpx;
- ;
- color: #ffffff;
- justify-content: flex-start;
- background-color: rgba($color: #000000, $alpha: 0.75);
- image {
- width: 30rpx;
- margin-right: 10rpx;
- }
- }
- .map {
- width: 750rpx;
- height: 300rpx;
- font-size: 35rpx;
- }
- .mapTip {
- position: absolute;
- top: 0;
- left: 0;
- padding: 20rpx;
- .leftMapTip {
- margin-right: 20rpx;
- width: 44rpx;
- height: 44rpx;
- border-radius: 10rpx;
- justify-content: center;
- .topTip {
- width: 24rpx;
- }
- &.success {
- background-color: $color-green;
- }
- &.error {
- background-color: $color-red;
- }
- }
- }
- }
- </style>
|