123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- // components/inner-order-item/index.js
- import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';
- import http from '../../utils/http'
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- item: Object,
- role: Object
- },
- /**
- * 组件的初始数据
- */
- data: {
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- navigate: function(e) {
- wx.navigateTo({
- url: e.currentTarget.dataset.url,
- })
- },
- doAction: function(e) {
- var type = e.currentTarget.dataset.type
- var that = this
- var order = e.currentTarget.dataset.order
- console.log(type)
- if(type == 'edit' || type == 'detail') {
- this.navigate(e)
- } else if(type == 'confirm') {
- Dialog.confirm({
- title: '提示',
- message: '确定订单吗',
- })
- .then(() => {
- that.submitCheck(order)
- })
- } else if(type == 'delete') {
- Dialog.confirm({
- title: '提示',
- message: '确定删除订单吗',
- })
- .then(() => {
- that.delete(order)
- })
- }
- },
- delete(order) {
- var that = this
- http({
- url: 'orders/delete',
- data: {
- id: order.id
- },
- success: function (res) {
- if (res.code == 0) {
- that.triggerEvent("update")
- }
- }
- })
- },
-
- submitCheck(order) {
- var that = this
- http({
- url: 'orders/check',
- data: {
- id: order.id,
- type: 'confirm',
- remark: order.remark
- },
- success: function (res) {
- if (res.code == 0) {
- that.triggerEvent('update', {})
- }
- }
- })
- },
- }
- })
|